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

Freeswitch SVN anthm at freeswitch.org
Mon Oct 22 23:00:15 EDT 2007


Author: anthm
Date: Mon Oct 22 23:00:15 2007
New Revision: 6025

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

Log:
make outbound invites put transport param in contact when it's tcp

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	Mon Oct 22 23:00:15 2007
@@ -560,13 +560,29 @@
 			url = tech_pvt->dest;
 		}
 
+		if (switch_strlen_zero(tech_pvt->invite_contact)) {
+			tech_pvt->invite_contact = tech_pvt->profile->url;
+		}
+		
+		if (switch_stristr("port=tcp", url)) {
+			char *tmp;
+
+			if (strchr(tech_pvt->invite_contact, ';')) {
+				tmp = switch_core_session_sprintf(session, "<%s&transport=tcp>", tech_pvt->invite_contact);
+			} else {
+				tmp = switch_core_session_sprintf(session, "<%s;transport=tcp>", tech_pvt->invite_contact);
+			}
+			assert(tmp);
+			tech_pvt->invite_contact = tmp;
+		}
+		
+
 		tech_pvt->nh = nua_handle(tech_pvt->profile->nua, NULL,
 								  NUTAG_URL(url),
 								  SIPTAG_TO_STR(tech_pvt->dest_to),
 								  TAG_IF(tech_pvt->gateway_from_str, SIPTAG_FROM_STR(tech_pvt->gateway_from_str)),
 								  TAG_IF(!tech_pvt->gateway_from_str, SIPTAG_FROM_STR(tech_pvt->from_str)),
-								  TAG_IF(tech_pvt->invite_contact, SIPTAG_CONTACT_STR(tech_pvt->invite_contact)),
-								  TAG_IF(!tech_pvt->invite_contact, SIPTAG_CONTACT_STR(tech_pvt->profile->url)),
+								  SIPTAG_CONTACT_STR(tech_pvt->invite_contact),
 								  TAG_END());
 
 		switch_safe_free(d_url);



More information about the Freeswitch-svn mailing list