]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
mod_sofia: add contact-user profile param to override default contact username for...
authorMichael Jerris <mike@jerris.com>
Tue, 19 May 2009 21:16:03 +0000 (21:16 +0000)
committerMichael Jerris <mike@jerris.com>
Tue, 19 May 2009 21:16:03 +0000 (21:16 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13397 d0543943-73ff-0310-b7d9-9358b9ac24b2

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

index 39ebaa70354866601146979d457cc0626022351d..2df89939c39bfe0328a29af9b75ccae039ff4344 100644 (file)
@@ -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 @@ struct sofia_profile {
        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 {
index 5f218b33b70f1df595cbba232b7f5ad93374bc6a..13e18051a31bcc170edcccb87b4970f1d0463dbc 100644 (file)
@@ -2017,6 +2017,7 @@ switch_status_t config_sofia(int reload, char *profile_name)
                                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 @@ switch_status_t config_sofia(int reload, char *profile_name)
                                                } 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 @@ switch_status_t config_sofia(int reload, char *profile_name)
                                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 @@ switch_status_t config_sofia(int reload, char *profile_name)
                                } 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 @@ switch_status_t config_sofia(int reload, char *profile_name)
                                                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 @@ switch_status_t config_sofia(int reload, char *profile_name)
                                                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 ? "]" : "",