[Freeswitch-svn] [commit] r5712 - freeswitch/trunk/src/mod/endpoints/mod_sofia

Freeswitch SVN mikej at freeswitch.org
Wed Sep 19 11:05:55 EDT 2007


Author: mikej
Date: Wed Sep 19 11:05:55 2007
New Revision: 5712

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c

Log:
merge patch from MODENDP-24, add to-domain param to gateway that overrides the proxy domain for the to header

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	Wed Sep 19 11:05:55 2007
@@ -500,7 +500,8 @@
 				*context = "default",
 				*expire_seconds = "3600",
 				*retry_seconds = "30",
-				*from_domain = "";
+				*from_domain = "",
+				*to_domain = "";
 			
 			gateway->pool = profile->pool;
 			gateway->profile = profile;
@@ -536,9 +537,15 @@
 					retry_seconds = val;
 				} else if (!strcmp(var, "from-domain")) {
 					from_domain = val;
+				} else if (!strcmp(var, "to-domain")) {
+					to_domain = val;
 				}
 			}
 
+			if (switch_strlen_zero(to_domain)) {
+				to_domain = proxy;
+			}
+
 			if (switch_strlen_zero(realm)) {
 				realm = name;
 			}
@@ -586,12 +593,12 @@
 			gateway->register_contact = switch_core_sprintf(gateway->pool, "sip:%s@%s:%d", extension,
 															profile->extsipip ? profile->extsipip : profile->sipip, profile->sip_port);
 			
-			if (!strncasecmp(proxy, "sip:", 4)) {
+			if (!strncasecmp(to_domain, "sip:", 4)) {
 				gateway->register_proxy = switch_core_strdup(gateway->pool, proxy);
-				gateway->register_to = switch_core_sprintf(gateway->pool, "sip:%s@%s", username, proxy + 4);
+				gateway->register_to = switch_core_sprintf(gateway->pool, "sip:%s@%s", username, to_domain + 4);
 			} else {
 				gateway->register_proxy = switch_core_sprintf(gateway->pool, "sip:%s", proxy);
-				gateway->register_to = switch_core_sprintf(gateway->pool, "sip:%s@%s", username, proxy);
+				gateway->register_to = switch_core_sprintf(gateway->pool, "sip:%s@%s", username, to_domain);
 			}
 
 			gateway->expires_str = switch_core_strdup(gateway->pool, expire_seconds);



More information about the Freeswitch-svn mailing list