[Freeswitch-branches] [commit] r13568 - freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia

FreeSWITCH SVN brian at freeswitch.org
Wed Jun 3 07:33:32 PDT 2009


Author: brian
Date: Wed Jun  3 09:33:32 2009
New Revision: 13568

Log:
 adding nat detection to the gateways now 

Modified:
   freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c

Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	(original)
+++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	Wed Jun  3 09:33:32 2009
@@ -2550,6 +2550,7 @@
 	if (!strncasecmp(profile_name, "gateway", 7)) {
 		char *gw, *params;
 		sofia_gateway_t *gateway_ptr = NULL;
+		char *dup_dest = NULL, *dest_host, *dest_user;
 
 		if (!(gw = strchr(profile_name, '/'))) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid URL\n");
@@ -2632,6 +2633,12 @@
 			tech_pvt->invite_contact = switch_core_session_strdup(nsession, gateway_ptr->register_contact);
 		}
 		
+		dup_dest = strdup(dest);
+		switch_assert(dup_dest != NULL);
+		sofia_glue_get_user_host(dup_dest, &dest_user, &dest_host);
+		tech_pvt->remote_ip = switch_core_session_sprintf(nsession, "%s", dest_host);
+		switch_safe_free(dup_dest);
+
 		gateway_ptr->ob_calls++;
 
 		if (gateway_ptr->ob_vars) {
@@ -2645,7 +2652,6 @@
 
 	} else {
 		char *dup_dest = NULL, *dest_host, *dest_user;
-
 		
 		if (!(dest = strchr(profile_name, '/'))) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid URL\n");
@@ -2669,7 +2675,7 @@
 		sofia_glue_get_user_host(dup_dest, &dest_user, &dest_host);
 		tech_pvt->remote_ip = switch_core_session_sprintf(nsession, "%s", dest_host);
 		switch_safe_free(dup_dest);
-
+		
 		if (!strncasecmp(dest, "sip:", 4) || !strncasecmp(dest, "sips:", 5)) {
 			tech_pvt->dest = switch_core_session_strdup(nsession, dest);
 		} else if ((host = strchr(dest, '%'))) {



More information about the Freeswitch-branches mailing list