]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
try to pass 2833-pt across calls
authorAnthony Minessale <anthony.minessale@gmail.com>
Wed, 21 Feb 2007 21:46:32 +0000 (21:46 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Wed, 21 Feb 2007 21:46:32 +0000 (21:46 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4344 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_core.h
src/mod/endpoints/mod_sofia/mod_sofia.c
src/switch_core.c

index a88f00e923b9e79879471ff15ff00cef8de27b3e..6f9130c4b409d773d7f3bfa89e754ab47180c1c4 100644 (file)
@@ -1454,6 +1454,14 @@ SWITCH_DECLARE(void) switch_core_launch_thread(void *(*func)(switch_thread_t *,
   \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);
 ///\}
 
 /*!
index 49d17bff35464d96bd3036a80262adf19818386b..04837ea5b5dfedd2fab0894064887cb9233d0702 100644 (file)
@@ -317,6 +317,7 @@ struct private_object {
        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 @@ static void attach_private(switch_core_session_t *session,
        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 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
                //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 @@ static uint8_t negotiate_sdp(switch_core_session_t *session, sdp_session_t *sdp)
     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);
        
index 0f2a2c99b98ce3e98b10acfac93e4d207f566540..234f52748f4e3a174bd90a612e86f0341d963faf 100644 (file)
@@ -4466,6 +4466,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(int vg)
        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