]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
allow option of contact-host to mirror the sip-ip on a gateway
authorBrian West <brian@freeswitch.org>
Thu, 4 Mar 2010 16:44:56 +0000 (16:44 +0000)
committerBrian West <brian@freeswitch.org>
Thu, 4 Mar 2010 16:44:56 +0000 (16:44 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16896 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/sofia.c

index 835155e0b4700da36be5d187ba9e2fb46104e5c8..a95234f6c6336b1e33bde679e7888b85b5564826 100644 (file)
@@ -1976,7 +1976,18 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
                        gateway->register_from = switch_core_sprintf(gateway->pool, "<sip:%s@%s;transport=%s>",
                                                                                                                 from_user, !zstr(from_domain) ? from_domain : proxy, register_transport);
 
-                       sipip = contact_host ? contact_host : profile->extsipip ? profile->extsipip : profile->sipip;
+
+                       if (contact_host) {
+                               if (!strcmp(contact_host, "sip-ip")) {
+                                       sipip = profile->sipip;
+                               } else {
+                                       sipip = contact_host;
+                               }
+                       } else if (profile->extsipip) {
+                               sipip = profile->extsipip;
+                       } else {
+                               sipip = profile->sipip;
+                       }
 
                        if (extension_in_contact) {
                                format = strchr(sipip, ':') ? "<sip:%s@[%s]:%d%s>" : "<sip:%s@%s:%d%s>";