From 7b93c2d0719ca5803a203f875de7bfee188c86c4 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 16 Apr 2013 13:40:07 -0500 Subject: [PATCH] prevent offering vid codec on recover when one was not chosen --- src/mod/endpoints/mod_sofia/sofia_glue.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index f77f2bf165..770e238ada 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -652,6 +652,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch } if (sofia_test_flag(tech_pvt, TFLAG_VIDEO)) { + if (!tech_pvt->local_sdp_video_port) { sofia_glue_tech_choose_video_port(tech_pvt, 0); } @@ -861,6 +862,7 @@ void sofia_glue_tech_prepare_codecs(private_object_t *tech_pvt) if (codec_string) { char *tmp_codec_string; + switch_channel_set_variable(tech_pvt->channel, "rtp_use_codec_string", codec_string); if ((tmp_codec_string = switch_core_session_strdup(tech_pvt->session, codec_string))) { tech_pvt->codec_order_last = switch_separate_string(tmp_codec_string, ',', tech_pvt->codec_order, SWITCH_MAX_CODECS); tech_pvt->num_codecs = @@ -875,7 +877,7 @@ void sofia_glue_tech_prepare_codecs(private_object_t *tech_pvt) void sofia_glue_check_video_codecs(private_object_t *tech_pvt) { - if (tech_pvt->num_codecs && !sofia_test_flag(tech_pvt, TFLAG_VIDEO)) { + if (tech_pvt->num_codecs && !sofia_test_flag(tech_pvt, TFLAG_VIDEO) && !switch_channel_test_flag(tech_pvt->channel, CF_RECOVERING)) { int i; tech_pvt->video_count = 0; for (i = 0; i < tech_pvt->num_codecs; i++) { @@ -5913,6 +5915,13 @@ int sofia_recover_callback(switch_core_session_t *session) } } + if ((tmp = switch_channel_get_variable(channel, "rtp_use_codec_string"))) { + char *tmp_codec_string = switch_core_session_strdup(session, tmp); + tech_pvt->codec_order_last = switch_separate_string(tmp_codec_string, ',', tech_pvt->codec_order, SWITCH_MAX_CODECS); + tech_pvt->num_codecs = switch_loadable_module_get_codecs_sorted(tech_pvt->codecs, SWITCH_MAX_CODECS, tech_pvt->codec_order, tech_pvt->codec_order_last); + } + + rr = switch_channel_get_variable(channel, "sip_invite_record_route"); if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {