[Freeswitch-svn] [commit] r4344 - in freeswitch/trunk/src: . include mod/endpoints/mod_sofia

Freeswitch SVN anthm at freeswitch.org
Wed Feb 21 16:46:32 EST 2007


Author: anthm
Date: Wed Feb 21 16:46:32 2007
New Revision: 4344

Modified:
   freeswitch/trunk/src/include/switch_core.h
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
   freeswitch/trunk/src/switch_core.c

Log:
try to pass 2833-pt across calls

Modified: freeswitch/trunk/src/include/switch_core.h
==============================================================================
--- freeswitch/trunk/src/include/switch_core.h	(original)
+++ freeswitch/trunk/src/include/switch_core.h	Wed Feb 21 16:46:32 2007
@@ -1454,6 +1454,14 @@
   \brief Initiate Globals
 */
 SWITCH_DECLARE(void) switch_core_set_globals(void);
+
+/*!
+  \brief indicate if 2 sessions are the same type
+  \param a the first session
+  \param b the second session
+  \return TRUE or FALSE
+*/
+SWITCH_DECLARE(uint8_t) switch_core_session_compare(switch_core_session_t *a, switch_core_session_t *b);
 ///\}
 
 /*!

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	Wed Feb 21 16:46:32 2007
@@ -317,6 +317,7 @@
 	switch_payload_t pt;
 	switch_mutex_t *flag_mutex;
 	switch_payload_t te;
+	switch_payload_t bte;
 	nua_handle_t *nh;
 	nua_handle_t *nh2;
 	su_home_t *home;
@@ -859,7 +860,11 @@
 	tech_pvt->flags = profile->flags;
 	switch_mutex_unlock(tech_pvt->flag_mutex);
 	tech_pvt->profile = profile;
-	tech_pvt->te = profile->te;
+	if (tech_pvt->bte) {
+		tech_pvt->te = tech_pvt->bte;
+	} else {
+		tech_pvt->te = profile->te;
+	}
 	tech_pvt->session = session;
 	tech_pvt->home = su_home_new(sizeof(*tech_pvt->home));
 
@@ -2310,7 +2315,15 @@
 		//switch_channel_t *channel = switch_core_session_get_channel(session);
 		switch_ivr_transfer_variable(session, nsession, SOFIA_REPLACES_HEADER);
 		switch_ivr_transfer_variable(session, nsession, SOFIA_SIP_HEADER_PREFIX_T);
-
+		if (switch_core_session_compare(session, nsession)) {
+			/* It's another sofia channel! so lets cache what they use as a pt for telephone event so 
+			   we can keep it the same
+			*/
+			private_object_t *ctech_pvt;
+			ctech_pvt = switch_core_session_get_private(session);
+			assert(ctech_pvt != NULL);
+			tech_pvt->bte = ctech_pvt->te;
+		}
 	}
 
  done:
@@ -2328,7 +2341,7 @@
     int ptime = 0, dptime = 0;
 
 	tech_pvt = switch_core_session_get_private(session);
-	assert(tech_pvt != NULL);                                                                                                                               
+	assert(tech_pvt != NULL);
 
 	channel = switch_core_session_get_channel(session);
 	

Modified: freeswitch/trunk/src/switch_core.c
==============================================================================
--- freeswitch/trunk/src/switch_core.c	(original)
+++ freeswitch/trunk/src/switch_core.c	Wed Feb 21 16:46:32 2007
@@ -4466,6 +4466,14 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+SWITCH_DECLARE(uint8_t) switch_core_session_compare(switch_core_session_t *a, switch_core_session_t *b)
+{
+	assert(a != NULL);
+	assert(b != NULL);
+
+	return (a->endpoint_interface == b->endpoint_interface);
+}
+
 /* For Emacs:
  * Local Variables:
  * mode:c



More information about the Freeswitch-svn mailing list