fix the issue of wrong sample rate of telephone -event when recover happened

If recover happens, fs sends a re-invite with sdp info to re-establish the call. unfortunately,  telephone-event's sample rate comes to zero, so dtmf will not work.
This commit is contained in:
zhaojiecll 2024-11-20 17:18:22 +08:00 committed by GitHub
parent 4658192547
commit 3f106e4b91
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 0 deletions

View File

@ -5829,6 +5829,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
if (best_te) { if (best_te) {
smh->mparams->te_rate = best_te_rate; smh->mparams->te_rate = best_te_rate;
switch_channel_set_variable_printf(session->channel, "rtp_2833_send_rate", "%d", smh->mparams->te_rate);
if (smh->mparams->dtmf_type == DTMF_AUTO || smh->mparams->dtmf_type == DTMF_2833 || if (smh->mparams->dtmf_type == DTMF_AUTO || smh->mparams->dtmf_type == DTMF_2833 ||
switch_channel_test_flag(session->channel, CF_LIBERAL_DTMF)) { switch_channel_test_flag(session->channel, CF_LIBERAL_DTMF)) {
@ -14075,6 +14076,10 @@ SWITCH_DECLARE (void) switch_core_media_recover_session(switch_core_session_t *s
smh->mparams->recv_te = (switch_payload_t)atoi(tmp); smh->mparams->recv_te = (switch_payload_t)atoi(tmp);
} }
if ((tmp = switch_channel_get_variable(session->channel, "rtp_2833_send_rate"))) {
smh->mparams->te_rate = atoi(tmp);
}
if ((tmp = switch_channel_get_variable(session->channel, "rtp_use_codec_rate"))) { if ((tmp = switch_channel_get_variable(session->channel, "rtp_use_codec_rate"))) {
a_engine->cur_payload_map->rm_rate = atoi(tmp); a_engine->cur_payload_map->rm_rate = atoi(tmp);
a_engine->cur_payload_map->adv_rm_rate = a_engine->cur_payload_map->rm_rate; a_engine->cur_payload_map->adv_rm_rate = a_engine->cur_payload_map->rm_rate;