mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-14 16:15:04 +00:00
prefer telephone-event with same rate over others
This commit is contained in:
parent
e9405ba64b
commit
01b17ec69e
@ -3486,7 +3486,7 @@ switch_t38_options_t *sofia_glue_extract_t38_options(switch_core_session_t *sess
|
|||||||
uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_sdp)
|
uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_sdp)
|
||||||
{
|
{
|
||||||
uint8_t match = 0;
|
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);
|
private_object_t *tech_pvt = switch_core_session_get_private(session);
|
||||||
sdp_media_t *m;
|
sdp_media_t *m;
|
||||||
sdp_attribute_t *attr;
|
sdp_attribute_t *attr;
|
||||||
@ -3786,23 +3786,12 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s
|
|||||||
rm_encoding = "";
|
rm_encoding = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!te && !strcasecmp(rm_encoding, "telephone-event")) {
|
if (!strcasecmp(rm_encoding, "telephone-event")) {
|
||||||
if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
|
if (!best_te || map->rm_rate == tech_pvt->rm_rate) {
|
||||||
te = tech_pvt->te = (switch_payload_t) map->rm_pt;
|
best_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 (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) && !cng_pt && !strcasecmp(rm_encoding, "CN")) {
|
if (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) && !cng_pt && !strcasecmp(rm_encoding, "CN")) {
|
||||||
cng_pt = (switch_payload_t) map->rm_pt;
|
cng_pt = (switch_payload_t) map->rm_pt;
|
||||||
if (tech_pvt->rtp_session) {
|
if (tech_pvt->rtp_session) {
|
||||||
@ -3812,9 +3801,6 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
if (te && cng_pt) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3943,6 +3929,24 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
if (!match && greedy && mine < tech_pvt->num_codecs) {
|
||||||
mine++;
|
mine++;
|
||||||
skip = 0;
|
skip = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user