From 3f106e4b9142d749f2a0dbc3d17bcb6bafeefaaf Mon Sep 17 00:00:00 2001 From: zhaojiecll Date: Wed, 20 Nov 2024 17:18:22 +0800 Subject: [PATCH] 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. --- src/switch_core_media.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index de5d0eff74..09e222a2a8 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -5829,6 +5829,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s if (best_te) { 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 || 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); } + 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"))) { a_engine->cur_payload_map->rm_rate = atoi(tmp); a_engine->cur_payload_map->adv_rm_rate = a_engine->cur_payload_map->rm_rate;