[commit] r9617 - freeswitch/trunk/src/mod/endpoints/mod_sofia
Author: anthm Date: Mon Sep 22 15:14:54 2008 New Revision: 9617 Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Log: <param name="challenge-realm" value="auto_from|auto_to|<hardcoded_val>"/> Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Mon Sep 22 15:14:54 2008 @@ -1291,6 +1291,8 @@ 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); Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h Mon Sep 22 15:14:54 2008 @@ -336,6 +336,7 @@ char *user_agent; char *record_template; char *presence_hosts; + char *challenge_realm; sofia_dtmf_t dtmf_type; int sip_port; int tls_sip_port; Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Mon Sep 22 15:14:54 2008 @@ -1240,6 +1240,8 @@ 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 @@ 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); } /* Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Mon Sep 22 15:14:54 2008 @@ -734,7 +734,14 @@ 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; }
participants (1)
-
Freeswitch SVN