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

FreeSWITCH SVN anthm at freeswitch.org
Wed Dec 3 09:13:02 PST 2008


Author: anthm
Date: Wed Dec  3 12:13:02 2008
New Revision: 10573

Log:
log ip and port you get reply to invite from

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

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 Dec  3 12:13:02 2008
@@ -2258,9 +2258,23 @@
 		const char *uuid;
 		switch_core_session_t *other_session;
 		private_object_t *tech_pvt = switch_core_session_get_private(session);
+		su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua));
+		char network_ip[80];
+		int network_port = 0;
+		switch_caller_profile_t *caller_profile = NULL;
 
-		switch_channel_clear_flag(channel, CF_REQ_MEDIA);
+		get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr, my_addrinfo->ai_addrlen);
+		network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port);
+
+		switch_channel_set_variable(channel, "sip_reply_host", network_ip);
+		switch_channel_set_variable_printf(channel, "sip_reply_port", "%d", network_port);
+		
+		if ((caller_profile = switch_channel_get_caller_profile(channel))) {
+			caller_profile->network_addr = switch_core_strdup(caller_profile->pool, network_ip);
+		}
 
+		switch_channel_clear_flag(channel, CF_REQ_MEDIA);
+		
 		if ((status == 180 || status == 183 || status == 200)) { 
 			if (sip->sip_user_agent && sip->sip_user_agent->g_string) {
 				switch_channel_set_variable(channel, "sip_user_agent", sip->sip_user_agent->g_string);



More information about the Freeswitch-svn mailing list