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

Freeswitch SVN anthm at freeswitch.org
Tue May 29 10:59:03 EDT 2007


Author: anthm
Date: Tue May 29 10:59:03 2007
New Revision: 5228

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

Log:
Enact the 'No device left behind' act.  All stupid sip params that only help broken things *MUST* be prefixed with NDLB-

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	Tue May 29 10:59:03 2007
@@ -317,7 +317,7 @@
 		}
 
 		nua_respond(tech_pvt->nh, SIP_200_OK,
-					SIPTAG_CONTACT_STR(tech_pvt->to_uri),
+					SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
 					SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
 
 	}
@@ -680,7 +680,7 @@
 			sofia_glue_set_local_sdp(tech_pvt, ip, atoi(port), msg->string_arg, 1);
 		}
 		nua_respond(tech_pvt->nh, SIP_200_OK,
-					SIPTAG_CONTACT_STR(tech_pvt->to_uri),
+					SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
 					SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
 		switch_channel_mark_answered(channel);
 	}

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h	Tue May 29 10:59:03 2007
@@ -114,6 +114,11 @@
 	PFLAG_RESPAWN = (1 << 9)
 } PFLAGS;
 
+
+typedef enum {
+	PFLAG_NDLB_TO_IN_200_CONTACT = (1 << 1)
+} sofia_NDLB_t;
+
 typedef enum {
 	TFLAG_IO = (1 << 0),
 	TFLAG_CHANGE_MEDIA = (1 << 1),
@@ -223,6 +228,7 @@
 	int dtmf_duration;
 	unsigned int flags;
 	unsigned int pflags;
+	unsigned int ndlb;
 	uint32_t max_calls;
 	uint32_t nonce_ttl;
 	nua_t *nua;
@@ -287,6 +293,7 @@
 	switch_port_t adv_sdp_audio_port;
 	char *proxy_sdp_audio_ip;
 	switch_port_t proxy_sdp_audio_port;
+	char *reply_contact;
 	char *from_uri;
 	char *to_uri;
 	char *from_address;

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	Tue May 29 10:59:03 2007
@@ -789,6 +789,10 @@
 						if (switch_true(val)) {
 							profile->pflags |= PFLAG_PRESENCE;
 						}
+					} else if (!strcasecmp(var, "NDLB-to-in-200-contact")) {
+						if (switch_true(val)) {
+							profile->ndlb |= PFLAG_NDLB_TO_IN_200_CONTACT;
+						}
 					} else if (!strcasecmp(var, "pass-rfc2833")) {
 						if (switch_true(val)) {
 							profile->pflags |= PFLAG_PASS_RFC2833;
@@ -1837,8 +1841,14 @@
 		url_set_chanvars(session, sip->sip_to->a_url, sip_to);
 		if ((val = switch_channel_get_variable(channel, "sip_to_uri"))) {
 			tech_pvt->to_uri = switch_core_session_sprintf(session, "sip:%s", val);
+			if (profile->ndlb & PFLAG_NDLB_TO_IN_200_CONTACT) {
+				tech_pvt->reply_contact = tech_pvt->to_uri;
+			} else {
+				tech_pvt->reply_contact = tech_pvt->profile->url;
+			}
 		} else {
 			tech_pvt->to_uri = tech_pvt->profile->url;
+			tech_pvt->reply_contact = tech_pvt->profile->url;
 		}
 	}
 

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 29 10:59:03 2007
@@ -365,7 +365,7 @@
 		}
 		
 		if (v_event && *v_event && (v_contact_str = switch_event_get_header(*v_event, "force-contact"))) {
-			if (!strcasecmp(v_contact_str, "nat-connectile-dysfunction")) {
+			if (!strcasecmp(v_contact_str, "nat-connectile-dysfunction") || !strcasecmp(v_contact_str, "NDLB-connectile-dysfunction")) {
 				if (contact->m_url->url_params) {
 					snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d;%s>",
 							 display, contact->m_url->url_user, network_ip, network_port, contact->m_url->url_params);



More information about the Freeswitch-svn mailing list