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

Freeswitch SVN anthm at freeswitch.org
Tue May 20 13:44:55 EDT 2008


Author: anthm
Date: Tue May 20 13:44:55 2008
New Revision: 8493

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

Log:
add recieved param to contact ala MODENDP-104

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c	Tue May 20 13:44:55 2008
@@ -427,6 +427,7 @@
 	const char *to_user = NULL;
 	const char *to_host = NULL;
 	char contact_str[1024] = "";
+	int nat_hack = 0;
 	//char buf[512];
 	uint8_t stale = 0, forbidden = 0;
 	auth_res_t auth_res;
@@ -541,6 +542,7 @@
 						reg_desc = "Registered(NATHACK)";
 						exptime = 20;
 					}
+					nat_hack = 1;
 				} else {
 					char *p;
 					switch_copy_string(contact_str, v_contact_str, sizeof(contact_str));
@@ -702,7 +704,11 @@
 		char *new_contact = NULL;
 
 		if (exptime) {
-			new_contact = switch_mprintf("%s;expires=%ld", contact_str, (long)exptime);
+			if (nat_hack) {
+				new_contact = switch_mprintf("%s;expires=%ld;received=\"%s:%d\"", contact_str, (long)exptime, network_ip, network_port);
+			} else {
+				new_contact = switch_mprintf("%s;expires=%ld", contact_str, (long)exptime);
+			}
 			nua_respond(nh, 
 						SIP_200_OK, 
 						TAG_IF(sticky, NUTAG_PROXY(sticky)),						



More information about the Freeswitch-svn mailing list