]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
<param name="challenge-realm" value="auto_from|auto_to|<hardcoded_val>"/>
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 22 Sep 2008 19:14:54 +0000 (19:14 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 22 Sep 2008 19:14:54 +0000 (19:14 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9617 d0543943-73ff-0310-b7d9-9358b9ac24b2

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

index 875ed1e28e16698ca94994124eada3d4ef09469a..09b9422208a0da6a403dd97407f1bcb1340eeb97 100644 (file)
@@ -1291,6 +1291,8 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
                                stream->write_function(stream, "Pres Hosts    \t\t%s\n", switch_str_nil(profile->presence_hosts));
                                stream->write_function(stream, "Dialplan      \t\t%s\n", switch_str_nil(profile->dialplan));
                                stream->write_function(stream, "Context       \t\t%s\n", switch_str_nil(profile->context));
+                               stream->write_function(stream, "Challenge Realm\t\t%s\n", 
+                                                                          switch_strlen_zero(profile->challenge_realm) ? "auto_to" : profile->challenge_realm);
                                stream->write_function(stream, "RTP-IP        \t\t%s\n", switch_str_nil(profile->rtpip));
                                if (profile->extrtpip) {
                                        stream->write_function(stream, "Ext-RTP-IP    \t\t%s\n", profile->extrtpip);
index d465d5f75afd0fb4233f400c7bb5b690af38247a..f738ad396a97ef577ce747996742901e025c93c3 100644 (file)
@@ -336,6 +336,7 @@ struct sofia_profile {
        char *user_agent;
        char *record_template;
        char *presence_hosts;
+       char *challenge_realm;
        sofia_dtmf_t dtmf_type;
        int sip_port;
        int tls_sip_port;
index 78aa79fb224b93bd6f5075919a8310f80a4fd904..eccfd5af0780f288bd2909c9984787ac53928325 100644 (file)
@@ -1240,6 +1240,8 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
                                                profile->max_calls = atoi(val);
                                        } else if (!strcasecmp(var, "codec-prefs")) {
                                                profile->codec_string = switch_core_strdup(profile->pool, val);
+                                       } else if (!strcasecmp(var, "challenge-realm")) {
+                                               profile->challenge_realm = switch_core_strdup(profile->pool, val);
                                        } else if (!strcasecmp(var, "dtmf-duration")) {
                                                int dur = atoi(val);
                                                if (dur > 10 && dur < 8000) {
@@ -1726,13 +1728,16 @@ switch_status_t config_sofia(int reload, char *profile_name)
                                                profile->max_calls = atoi(val);
                                        } else if (!strcasecmp(var, "codec-prefs")) {
                                                profile->codec_string = switch_core_strdup(profile->pool, val);
+                                       } else if (!strcasecmp(var, "challenge-realm")) {
+                                               profile->challenge_realm = switch_core_strdup(profile->pool, val);
                                        } else if (!strcasecmp(var, "dtmf-duration")) {
                                                int dur = atoi(val);
                                                if (dur > 10 && dur < 8000) {
                                                        profile->dtmf_duration = dur;
                                                } else {
                                                        profile->dtmf_duration = SWITCH_DEFAULT_DTMF_DURATION;
-                                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Duration out of bounds, using default of %d!\n", SWITCH_DEFAULT_DTMF_DURATION);
+                                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Duration out of bounds, using default of %d!\n", 
+                                                                                         SWITCH_DEFAULT_DTMF_DURATION);
                                                }
 
                                                /*
index 7f547987bb5db574fd92937fae0f9a121b487c05..1bb3dcf6dcfe0b349e52d82532d27cbc6ee8dff1 100644 (file)
@@ -734,7 +734,14 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Requesting Registration from: [%s@%s]\n", to_user, to_host);
                        }
                } else {
-                       sofia_reg_auth_challenge(nua, profile, nh, regtype, from_host, 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;
+                       }
+                       sofia_reg_auth_challenge(nua, profile, nh, regtype, realm, stale);
                }
                return 1;
        }