uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_sdp)
{
uint8_t match = 0;
- switch_payload_t te = 0, cng_pt = 0;
+ switch_payload_t best_te = 0, te = 0, cng_pt = 0;
private_object_t *tech_pvt = switch_core_session_get_private(session);
sdp_media_t *m;
sdp_attribute_t *attr;
rm_encoding = "";
}
- if (!te && !strcasecmp(rm_encoding, "telephone-event")) {
- if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
- 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_event(tech_pvt->rtp_session, (switch_payload_t) map->rm_pt);
- }
- } else {
- 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, te);
- switch_rtp_set_telephony_recv_event(tech_pvt->rtp_session, te);
- }
+ if (!strcasecmp(rm_encoding, "telephone-event")) {
+ if (!best_te || map->rm_rate == tech_pvt->rm_rate) {
+ best_te = (switch_payload_t) map->rm_pt;
}
}
-
+
if (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) && !cng_pt && !strcasecmp(rm_encoding, "CN")) {
cng_pt = (switch_payload_t) map->rm_pt;
if (tech_pvt->rtp_session) {
}
if (match) {
- if (te && cng_pt) {
- break;
- }
continue;
}
}
}
+ if (best_te) {
+ if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
+ te = tech_pvt->te = (switch_payload_t) best_te;
+ 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_event(tech_pvt->rtp_session, (switch_payload_t) best_te);
+ }
+ } else {
+ te = tech_pvt->recv_te = tech_pvt->te = (switch_payload_t) best_te;
+ 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, te);
+ switch_rtp_set_telephony_recv_event(tech_pvt->rtp_session, te);
+ }
+ }
+ }
+
+
if (!match && greedy && mine < tech_pvt->num_codecs) {
mine++;
skip = 0;