From b1447dd635aced368df64a7cecb8455cfa6644f4 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 16 Apr 2013 13:02:50 -0500 Subject: [PATCH] fix codec issue on recover --- src/switch_core_media.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index ffb542d88c..316fa7b6d1 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -1078,9 +1078,9 @@ SWITCH_DECLARE(void) switch_core_media_prepare_codecs(switch_core_session_t *ses } ready: - if (codec_string) { char *tmp_codec_string = switch_core_session_strdup(smh->session, codec_string); + switch_channel_set_variable(session->channel, "rtp_use_codec_string", codec_string); smh->codec_order_last = switch_separate_string(tmp_codec_string, ',', smh->codec_order, SWITCH_MAX_CODECS); smh->mparams->num_codecs = switch_loadable_module_get_codecs_sorted(smh->codecs, SWITCH_MAX_CODECS, smh->codec_order, smh->codec_order_last); } else { @@ -7100,6 +7100,12 @@ SWITCH_DECLARE (void) switch_core_media_recover_session(switch_core_session_t *s a_engine->codec_params.iananame = a_engine->codec_params.rm_encoding = (char *) switch_channel_get_variable(session->channel, "rtp_use_codec_name"); a_engine->codec_params.rm_fmtp = (char *) switch_channel_get_variable(session->channel, "rtp_use_codec_fmtp"); + + if ((tmp = switch_channel_get_variable(session->channel, "rtp_use_codec_string"))) { + char *tmp_codec_string = switch_core_session_strdup(smh->session, tmp); + smh->codec_order_last = switch_separate_string(tmp_codec_string, ',', smh->codec_order, SWITCH_MAX_CODECS); + smh->mparams->num_codecs = switch_loadable_module_get_codecs_sorted(smh->codecs, SWITCH_MAX_CODECS, smh->codec_order, smh->codec_order_last); + } if ((tmp = switch_channel_get_variable(session->channel, "rtp_2833_send_payload"))) { smh->mparams->te = (switch_payload_t)atoi(tmp);