[Freeswitch-svn] [commit] r13397 - freeswitch/trunk/src/mod/endpoints/mod_sofia
FreeSWITCH SVN
mikej at freeswitch.org
Tue May 19 14:16:03 PDT 2009
Author: mikej
Date: Tue May 19 16:16:03 2009
New Revision: 13397
Log:
mod_sofia: add contact-user profile param to override default contact username for a profile (MODSOFIA-8)
Modified:
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
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 Tue May 19 16:16:03 2009
@@ -56,6 +56,7 @@
#define MAX_CODEC_CHECK_FRAMES 50
#define MAX_MISMATCH_FRAMES 3
#define MODNAME "mod_sofia"
+#define SOFIA_DEFAULT_CONTACT_USER MODNAME
static const switch_state_handler_table_t noop_state_handler = { 0 };
struct sofia_gateway;
typedef struct sofia_gateway sofia_gateway_t;
@@ -483,7 +484,8 @@
uint32_t timer_t1;
uint32_t timer_t1x64;
uint32_t timer_t2;
- uint32_t timer_t4;
+ uint32_t timer_t4;
+ char *contact_user;
};
struct private_object {
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 Tue May 19 16:16:03 2009
@@ -2017,6 +2017,7 @@
sofia_set_pflag(profile, PFLAG_AUTOFIX_TIMING);
sofia_set_pflag(profile, PFLAG_MESSAGE_QUERY_ON_REGISTER);
sofia_set_pflag(profile, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE);
+ profile->contact_user = SOFIA_DEFAULT_CONTACT_USER;
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr_soft(param, "name");
@@ -2312,6 +2313,8 @@
} else {
sofia_clear_pflag(profile, PFLAG_AUTOFIX_TIMING);
}
+ } else if (!strcasecmp(var, "contact-user")) {
+ profile->contact_user = switch_core_strdup(profile->pool, val);
} else if (!strcasecmp(var, "nat-options-ping")) {
if (switch_true(val)) {
sofia_set_pflag(profile, PFLAG_NAT_OPTIONS_PING);
@@ -2534,7 +2537,8 @@
if (profile->extsipip) {
char *ipv6 = strchr(profile->extsipip, ':');
profile->url = switch_core_sprintf(profile->pool,
- "sip:mod_sofia@%s%s%s:%d",
+ "sip:%s@%s%s%s:%d",
+ profile->contact_user,
ipv6 ? "[" : "",
profile->extsipip,
ipv6 ? "]" : "",
@@ -2543,7 +2547,8 @@
} else {
char *ipv6 = strchr(profile->sipip, ':');
profile->url = switch_core_sprintf(profile->pool,
- "sip:mod_sofia@%s%s%s:%d",
+ "sip:%s@%s%s%s:%d",
+ profile->contact_user,
ipv6 ? "[" : "",
profile->sipip,
ipv6 ? "]" : "",
@@ -2570,13 +2575,15 @@
char *ipv6 = strchr(profile->extsipip, ':');
profile->tls_url =
switch_core_sprintf(profile->pool,
- "sip:mod_sofia@%s%s%s:%d",
+ "sip:%s@%s%s%s:%d",
+ profile->contact_user,
ipv6 ? "[" : "",
profile->extsipip, ipv6 ? "]" : "",
profile->tls_sip_port);
profile->tls_bindurl =
switch_core_sprintf(profile->pool,
- "sips:mod_sofia@%s%s%s:%d;maddr=%s",
+ "sips:%s@%s%s%s:%d;maddr=%s",
+ profile->contact_user,
ipv6 ? "[" : "",
profile->extsipip,
ipv6 ? "]" : "",
@@ -2586,14 +2593,16 @@
char *ipv6 = strchr(profile->sipip, ':');
profile->tls_url =
switch_core_sprintf(profile->pool,
- "sip:mod_sofia@%s%s%s:%d",
+ "sip:%s@%s%s%s:%d",
+ profile->contact_user,
ipv6 ? "[" : "",
profile->sipip,
ipv6 ? "]" : "",
profile->tls_sip_port);
profile->tls_bindurl =
switch_core_sprintf(profile->pool,
- "sips:mod_sofia@%s%s%s:%d",
+ "sips:%s@%s%s%s:%d",
+ profile->contact_user,
ipv6 ? "[" : "",
profile->sipip,
ipv6 ? "]" : "",
More information about the Freeswitch-svn
mailing list