Revision
15172
Author
anthm
Date
2009-10-16 14:51:32 -0500 (Fri, 16 Oct 2009)

Log Message

set gateway name in params too

Modified Paths

Diff

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


--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	2009-10-16 19:09:11 UTC (rev 15171)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	2009-10-16 19:51:32 UTC (rev 15172)
@@ -1600,12 +1600,12 @@
 
 			if (contact_params) {
 				if (*contact_params == ';') {
-					params = switch_core_sprintf(gateway->pool, "%s;transport=%s", contact_params, register_transport);
+					params = switch_core_sprintf(gateway->pool, "%s;transport=%s;gw=%s", contact_params, register_transport, gateway->name);
 				} else {
-					params = switch_core_sprintf(gateway->pool, ";%s;transport=%s", contact_params, register_transport);
+					params = switch_core_sprintf(gateway->pool, ";%s;transport=%s;gw=%s", contact_params, register_transport, gateway->name);
 				}
 			} else {
-				params = switch_core_sprintf(gateway->pool, ";transport=%s", register_transport);
+				params = switch_core_sprintf(gateway->pool, ";transport=%s;gw=%s", register_transport, gateway->name);
 			}
 
 			if (!switch_strlen_zero(from_domain)) {
@@ -4823,6 +4823,7 @@
 	char *is_nat = NULL;
 	char acl_token[512] = "";
 	sofia_transport_t transport;
+	const char *gw_name = NULL;
 
 	profile->ib_calls++;
 
@@ -5390,9 +5391,16 @@
 		free(tmp);
 	}
 
+	
+	if (sip->sip_request->rq_url->url_params) {
+		gw_name = sofia_glue_find_parameter(sip->sip_request->rq_url->url_params, "gw=");
+	}
 
 	if (strstr(destination_number, "gw+")) {
-		const char *gw_name = destination_number + 3;
+		gw_name = destination_number + 3;
+	}
+
+	if (gw_name) {
 		sofia_gateway_t *gateway;
 		if (gw_name && (gateway = sofia_reg_find_gateway(gw_name))) {
 			context = switch_core_session_strdup(session, gateway->register_context);