]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-6889 #resolve
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 7 Oct 2014 18:47:44 +0000 (13:47 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 7 Oct 2014 18:47:44 +0000 (13:47 -0500)
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/sofia.c

index 654daae4c096295a44b93d7cf2a3993b5cf0cd22..7ae80028053f3a94de232f61eb3bdc984aa00f9a 100644 (file)
@@ -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) {
index f946fd511dba6a2ddd130200dcae135c94d1c7a4..11a8b560d017187ff9df7fcd5be9666f22118e4e 100644 (file)
@@ -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;