]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix challenge-realm
authorBrian West <brian@freeswitch.org>
Tue, 17 Feb 2009 20:36:21 +0000 (20:36 +0000)
committerBrian West <brian@freeswitch.org>
Tue, 17 Feb 2009 20:36:21 +0000 (20:36 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12113 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/sofia_reg.c

index 89a4f05dd75f8c230ddd0e05629dffc7c65d10f6..a60e9c0aa9037b2bc40d3683b95d76dd8a9c7ee8 100644 (file)
@@ -877,19 +877,20 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
        }
 
        if (!authorization || stale) {
+               const char *realm = profile->challenge_realm;
+
+               if (switch_strlen_zero(realm) || !strcasecmp(realm, "auto_to")) {
+                       realm = to_host;
+               } else if (!strcasecmp(realm, "auto_from")) {
+                       realm = from_host;
+               }
+
                if (regtype == REG_REGISTER) {
-                       sofia_reg_auth_challenge(nua, profile, nh, regtype, to_host, stale);
+                       sofia_reg_auth_challenge(nua, profile, nh, regtype, realm, stale);
                        if (profile->debug) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Requesting Registration from: [%s@%s]\n", to_user, to_host);
                        }
                } else {
-                       const char *realm = profile->challenge_realm;
-
-                       if (switch_strlen_zero(realm) || !strcasecmp(realm, "auto_to")) {
-                               realm = to_host;
-                       } else if (!strcasecmp(realm, "auto_from")) {
-                               realm = from_host;
-                       }
                        sofia_reg_auth_challenge(nua, profile, nh, regtype, realm, stale);
                }
                return 1;