fix MODENDP-121

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9305 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2008-08-15 19:30:34 +00:00
parent 5c63629f0d
commit 5572f25a0f
3 changed files with 10 additions and 1 deletions

View File

@ -269,6 +269,7 @@ struct sofia_gateway {
char *register_scheme;
char *register_realm;
char *register_username;
char *auth_username;
char *register_password;
char *register_from;
char *register_contact;

View File

@ -775,6 +775,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
char *register_str = "true", *scheme = "Digest",
*realm = NULL,
*username = NULL,
*auth_username = NULL,
*password = NULL,
*caller_id_in_from = "false",
*extension = NULL,
@ -807,6 +808,8 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
realm = val;
} else if (!strcmp(var, "username")) {
username = val;
} else if (!strcmp(var, "auth-username")) {
auth_username = val;
} else if (!strcmp(var, "password")) {
password = val;
} else if (!strcmp(var, "caller-id-in-from")) {
@ -886,6 +889,10 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
from_domain = realm;
}
if (switch_strlen_zero(auth_username)) {
auth_username = username;
}
if (!switch_strlen_zero(register_proxy)) {
gateway->register_sticky_proxy = switch_core_strdup(gateway->pool, register_proxy);
}
@ -899,6 +906,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
gateway->register_context = switch_core_strdup(gateway->pool, context);
gateway->register_realm = switch_core_strdup(gateway->pool, realm);
gateway->register_username = switch_core_strdup(gateway->pool, username);
gateway->auth_username = switch_core_strdup(gateway->pool, auth_username);
gateway->register_password = switch_core_strdup(gateway->pool, password);
if (switch_true(caller_id_in_from)) {
switch_set_flag(gateway, REG_FLAG_CALLERID);

View File

@ -1094,7 +1094,7 @@ void sofia_reg_handle_sip_r_challenge(int status,
goto cancel;
}
switch_snprintf(authentication, sizeof(authentication), "%s:%s:%s:%s", scheme, realm, gateway->register_username, gateway->register_password);
switch_snprintf(authentication, sizeof(authentication), "%s:%s:%s:%s", scheme, realm, gateway->auth_username, gateway->register_password);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Authenticating '%s' with '%s'.\n", profile->username, authentication);