diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 281aa511da..d865be6ee7 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -5815,7 +5815,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, tech_pvt->remote_sdp_str = switch_core_session_strdup(session, r_sdp); switch_channel_set_variable(channel, SWITCH_R_SDP_VARIABLE, r_sdp); - if (sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) && (parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0))) { + if ((sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) || switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) && (parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0))) { if ((sdp = sdp_session(parser))) { sofia_glue_set_r_sdp_codec_string(session, sofia_glue_get_codec_string(tech_pvt), sdp); } diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 2cb2fdd551..e96f1e1802 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -776,19 +776,23 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch const char *sofia_glue_get_codec_string(private_object_t *tech_pvt) { - const char *codec_string = NULL, *preferred = NULL, *fallback = NULL; - - if (switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { - preferred = tech_pvt->profile->outbound_codec_string; - fallback = tech_pvt->profile->inbound_codec_string; - } else { - preferred = tech_pvt->profile->inbound_codec_string; - fallback = tech_pvt->profile->outbound_codec_string; + const char *preferred = NULL, *fallback = NULL; + + if (!(preferred = switch_channel_get_variable(tech_pvt->channel, "absolute_codec_string"))) { + preferred = switch_channel_get_variable(tech_pvt->channel, "codec_string"); + } + + if (!preferred) { + if (switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { + preferred = tech_pvt->profile->outbound_codec_string; + fallback = tech_pvt->profile->inbound_codec_string; + } else { + preferred = tech_pvt->profile->inbound_codec_string; + fallback = tech_pvt->profile->outbound_codec_string; + } } - codec_string = !zstr(preferred) ? preferred : fallback; - - return codec_string; + return !zstr(preferred) ? preferred : fallback; } void sofia_glue_tech_prepare_codecs(private_object_t *tech_pvt) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index c18da450a6..72d0ab0393 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -384,8 +384,10 @@ static void inherit_codec(switch_channel_t *caller_channel, switch_core_session_ { const char *var = switch_channel_get_variable(caller_channel, "inherit_codec"); switch_channel_t *channel = switch_core_session_get_channel(session); - - if (switch_true(var)) { + + if (!zstr(var) && !strcasecmp(var, "passthru")) { + switch_channel_set_variable(caller_channel, "absolute_codec_string", switch_channel_get_variable(channel, "ep_codec_string")); + } else if (switch_true(var)) { switch_codec_implementation_t impl = { 0 }; switch_codec_implementation_t video_impl = { 0 }; char tmp[128] = "";