]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix MODENDP-121
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 15 Aug 2008 19:30:34 +0000 (19:30 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 15 Aug 2008 19:30:34 +0000 (19:30 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9305 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_reg.c

index 6a395057f868ce10998603219de3a2aa0b1df982..6b342d5aba728c00f092ba67673bdff7fcb1c1ae 100644 (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;
index d32863096332a5b578c66820ed098a575638ee4f..161d1eb05ed8863738ea907dec119fe883f14886 100644 (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);
index 37ba36a3231b7ab4d6c3554404dd2704941440f1..6dcb76c8d87484f67c6d101b0b4896935b9d6f05 100644 (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);