Revision
16896
Author
brian
Date
2010-03-04 10:44:56 -0600 (Thu, 04 Mar 2010)

Log Message

 allow option of contact-host to mirror the sip-ip on a gateway 

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (16895 => 16896)


--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	2010-03-04 16:27:21 UTC (rev 16895)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	2010-03-04 16:44:56 UTC (rev 16896)
@@ -1976,8 +1976,19 @@
 			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>";
 				gateway->register_contact = switch_core_sprintf(gateway->pool, format, extension,