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

FreeSWITCH SVN brian at freeswitch.org
Tue Jun 2 16:02:13 PDT 2009


Author: brian
Date: Tue Jun  2 18:02:13 2009
New Revision: 13558

Log:
 patch the XML so that if it happens to traverse nat it'll display the pickup and barge correctly for the phone 

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

Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
==============================================================================
--- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c	(original)
+++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c	Tue Jun  2 18:02:13 2009
@@ -1426,7 +1426,6 @@
 		if ((ptr = sofia_glue_find_parameter(o_contact, "transport="))) {
 			sofia_transport_t transport = sofia_glue_str2transport(ptr);
 			user_via = switch_mprintf("SIP/2.0/%s %s;rport",  sofia_glue_transport2str(transport), profile->extsipip);
-			printf("user_via -> %s\n", user_via);
 		} else {
 			user_via = switch_mprintf("SIP/2.0/UDP %s;rport", profile->extsipip);
 		}

Modified: freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c
==============================================================================
--- freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c	(original)
+++ freeswitch/branches/brian/trunk/src/mod/endpoints/mod_sofia/sofia_sla.c	Tue Jun  2 18:02:13 2009
@@ -313,7 +313,7 @@
 							 sip->sip_contact->m_url->url_host, sofia_glue_transport2str(transport));
 
 	if (sip->sip_payload && sip->sip_payload->pl_data) {
-		sql = switch_mprintf("select subscriber,call_id,aor,profile_name,hostname,contact_str from sip_shared_appearance_subscriptions where "
+		sql = switch_mprintf("select subscriber,call_id,aor,profile_name,hostname,contact_str,network_ip from sip_shared_appearance_subscriptions where "
 		"aor='%q' and profile_name='%q' and hostname='%q'",
 		aor, profile->name, mod_sofia_globals.hostname); 
 
@@ -338,9 +338,10 @@
 	/* char *profile_name = argv[3]; */
 	/* char *hostname = argv[4]; */
 	char *contact_str = argv[5];
+	char *network_ip = argv[6];
 	nua_handle_t *nh;
 	char *route_uri = NULL;
-
+	char *xml_fixup = NULL;
 	nh = nua_handle_by_call_id(helper->profile->nua, call_id);  /* that's all you need to find the subscription's nh */
 
 	if (nh) {
@@ -363,14 +364,23 @@
 				*p++ = '\0';
 			}
 		}
-
+		
+		if (sofia_test_pflag(helper->profile, PFLAG_AUTO_NAT) && !switch_check_network_list_ip(network_ip, helper->profile->local_network)) {
+			xml_fixup = switch_string_replace(helper->payload, helper->profile->sipip, helper->profile->extsipip);
+		} else if (sofia_test_pflag(helper->profile, PFLAG_AUTO_NAT) && switch_check_network_list_ip(network_ip, helper->profile->local_network)) {
+			xml_fixup = switch_string_replace(helper->payload, helper->profile->extsipip, helper->profile->sipip);
+		} else {
+			xml_fixup = helper->payload;
+		}
+		
 		nua_notify(nh,
 				   SIPTAG_SUBSCRIPTION_STATE_STR("active;expires=300"), /* XXX MTK FIXME - this is totally fake calculation */
 				   TAG_IF(route_uri, NUTAG_PROXY(route_uri)),
 				   SIPTAG_CONTENT_TYPE_STR("application/dialog-info+xml"),	/* could've just kept the type from the payload */
-				   SIPTAG_PAYLOAD_STR(helper->payload),
+				   SIPTAG_PAYLOAD_STR(xml_fixup),
 				   TAG_END());
 		switch_safe_free(route_uri);
+		switch_safe_free(xml_fixup);
 	}
 	return 0;
 }



More information about the Freeswitch-svn mailing list