fix telephone-event negotiation with devices that don't do what the rfc says they SHOULD do

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@17097 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2010-03-25 03:51:04 +00:00
parent 0292b7a81d
commit ea8b4f2f20
2 changed files with 16 additions and 9 deletions

View 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;

View 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);
}
}
}