]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix telephone-event negotiation with devices that don't do what the rfc says they...
authorMichael Jerris <mike@jerris.com>
Thu, 25 Mar 2010 03:51:04 +0000 (03:51 +0000)
committerMichael Jerris <mike@jerris.com>
Thu, 25 Mar 2010 03:51:04 +0000 (03:51 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@17097 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia_glue.c

index 9d10bbdd300b4d8d23c4de545e9883d5e45c2b18..bff6087cfd85c39066f4604733b4059b7c7593ae 100644 (file)
@@ -622,6 +622,7 @@ struct private_object {
        switch_mutex_t *flag_mutex;
        switch_mutex_t *sofia_mutex;
        switch_payload_t te;
+       switch_payload_t recv_te;
        switch_payload_t bte;
        switch_payload_t cng_pt;
        switch_payload_t bcng_pt;
index 22c5377ea5ec1a3aa4817e2ea294392e40f1b81b..aeffdbfc4928c0d034674b08d140065dada4aa35 100644 (file)
@@ -549,9 +549,9 @@ void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *
        switch_mutex_unlock(tech_pvt->flag_mutex);
 
        if (tech_pvt->bte) {
-               tech_pvt->te = tech_pvt->bte;
+               tech_pvt->recv_te = tech_pvt->te = tech_pvt->bte;
        } else if (!tech_pvt->te) {
-               tech_pvt->te = profile->te;
+               tech_pvt->recv_te = tech_pvt->te = profile->te;
        }
 
        tech_pvt->dtmf_type = profile->dtmf_type;
@@ -2771,8 +2771,13 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
                }
 
                if (tech_pvt->te) {
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Set 2833 dtmf send payload to %u\n", tech_pvt->te);
                        switch_rtp_set_telephony_event(tech_pvt->rtp_session, tech_pvt->te);
-                       switch_rtp_set_telephony_recv_event(tech_pvt->rtp_session, tech_pvt->te);
+               }
+
+               if (tech_pvt->recv_te) {
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Set 2833 dtmf receive payload to %u\n", tech_pvt->recv_te);
+                       switch_rtp_set_telephony_recv_event(tech_pvt->rtp_session, tech_pvt->recv_te);
                }
 
                if (sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) ||
@@ -3509,16 +3514,17 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
 
                                if (!te && !strcasecmp(rm_encoding, "telephone-event")) {
                                        if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
-                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Set 2833 dtmf recv payload to %u\n", te);
+                                               te = tech_pvt->te = (switch_payload_t) map->rm_pt;
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Set 2833 dtmf send payload to %u\n", map->rm_pt);
                                                if (tech_pvt->rtp_session) {
-                                                       switch_rtp_set_telephony_recv_event(tech_pvt->rtp_session, (switch_payload_t) map->rm_pt);
+                                                       switch_rtp_set_telephony_event(tech_pvt->rtp_session, (switch_payload_t) map->rm_pt);
                                                }
                                        } else {
-                                               te = tech_pvt->te = (switch_payload_t) map->rm_pt;
-                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Set 2833 dtmf send payload to %u\n", te);
+                                               te = tech_pvt->recv_te = tech_pvt->te = (switch_payload_t) map->rm_pt;
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Set 2833 dtmf send/recv payload to %u\n", te);
                                                if (tech_pvt->rtp_session) {
-                                                       switch_rtp_set_telephony_event(tech_pvt->rtp_session, tech_pvt->te);
-                                                       switch_rtp_set_telephony_recv_event(tech_pvt->rtp_session, tech_pvt->te);
+                                                       switch_rtp_set_telephony_event(tech_pvt->rtp_session, te);
+                                                       switch_rtp_set_telephony_recv_event(tech_pvt->rtp_session, te);
                                                }
                                        }
                                }