diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 7ffd10eed4..7ecaa5123a 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -3717,6 +3717,8 @@ SWITCH_DECLARE(int) switch_core_media_toggle_hold(switch_core_session_t *session switch_channel_clear_flag(session->channel, CF_HOLD_LOCK); if (switch_channel_test_flag(session->channel, CF_PROTO_HOLD)) { + const char *val; + switch_yield(250000); if (a_engine->max_missed_packets) { @@ -3735,6 +3737,13 @@ SWITCH_DECLARE(int) switch_core_media_toggle_hold(switch_core_session_t *session } } + if (!switch_media_handle_test_media_flag(smh, SCMF_DISABLE_RTP_AUTOADJ) && + !((val = switch_channel_get_variable(session->channel, "disable_rtp_auto_adjust")) && switch_true(val)) && + !switch_channel_test_flag(session->channel, CF_WEBRTC)) { + /* Reactivate the NAT buster flag. */ + switch_rtp_set_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_AUTOADJ); + } + switch_channel_clear_flag(session->channel, CF_PROTO_HOLD); switch_channel_mark_hold(session->channel, SWITCH_FALSE); switch_channel_presence(session->channel, "unknown", "unhold", NULL);