From 2051a86df2ad7d9d05a9ef8527582a6adfb7d601 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 7 Oct 2014 13:47:44 -0500 Subject: [PATCH] FS-6889 #resolve --- src/mod/endpoints/mod_sofia/mod_sofia.c | 16 ++++++++-------- src/mod/endpoints/mod_sofia/sofia.c | 16 +++++++++++++--- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 654daae4c0..7ae8002805 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1439,16 +1439,16 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi } } - if (!switch_core_media_ready(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO)) { - switch_core_media_set_sdp_codec_string(tech_pvt->session, r_sdp, SDP_TYPE_RESPONSE); - switch_channel_set_variable(tech_pvt->channel, "absolute_codec_string", switch_channel_get_variable(tech_pvt->channel, "ep_codec_string")); - switch_core_media_prepare_codecs(tech_pvt->session, SWITCH_TRUE); - if ((status = switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0)) != SWITCH_STATUS_SUCCESS) { - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - goto end_lock; - } + switch_core_media_set_sdp_codec_string(tech_pvt->session, r_sdp, SDP_TYPE_RESPONSE); + switch_channel_set_variable(tech_pvt->channel, "absolute_codec_string", switch_channel_get_variable(tech_pvt->channel, "ep_codec_string")); + switch_core_media_prepare_codecs(tech_pvt->session, SWITCH_TRUE); + + if ((status = switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0)) != SWITCH_STATUS_SUCCESS) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + goto end_lock; } + switch_core_media_gen_local_sdp(session, SDP_TYPE_REQUEST, NULL, 0, NULL, 1); if (send_invite) { diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index f946fd511d..11a8b560d0 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -6922,7 +6922,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, if (switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_INBOUND) { //const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE); - + switch_core_media_prepare_codecs(tech_pvt->session, SWITCH_TRUE); if (sofia_media_tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) { switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR"); @@ -7025,8 +7025,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); } goto done; - } else { - + } else { if (switch_channel_test_app_flag_key("T38", tech_pvt->channel, CF_APP_T38_NEGOTIATED)) { nua_respond(tech_pvt->nh, SIP_200_OK, TAG_END()); goto done; @@ -7038,6 +7037,12 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, match = sofia_media_negotiate_sdp(session, r_sdp, SDP_TYPE_REQUEST); } + + if (switch_channel_test_flag(channel, CF_PROXY_MODE)) { + nua_respond(tech_pvt->nh, SIP_200_OK, TAG_END()); + goto done; + } + if (match && sofia_test_flag(tech_pvt, TFLAG_NOREPLY)) { sofia_clear_flag(tech_pvt, TFLAG_NOREPLY); goto done; @@ -7057,6 +7062,11 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, } switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Processing updated SDP\n"); } else { + if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) { + nua_respond(tech_pvt->nh, SIP_200_OK, TAG_END()); + goto done; + } + switch_channel_set_flag(tech_pvt->channel, CF_REINVITE); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Reinvite Codec Error!\n"); is_ok = 0;