]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-2801
authorAnthony Minessale <anthm@freeswitch.org>
Mon, 15 Nov 2010 17:22:25 +0000 (11:22 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Mon, 15 Nov 2010 17:22:34 +0000 (11:22 -0600)
src/mod/endpoints/mod_sofia/sofia.c
src/switch_ivr.c

index e5672061bdae38145d5c15df8321988dec198ef6..5bb2ff0d66be712570c19f958a70368d67ee3960 100644 (file)
@@ -4671,9 +4671,8 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                        if (!switch_channel_get_variable(other_channel, SWITCH_B_SDP_VARIABLE)) {
                                                switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, r_sdp);
                                        }
-                                       switch_mutex_unlock(tech_pvt->sofia_mutex);
-                                       switch_channel_pre_answer(other_channel);
-                                       switch_mutex_lock(tech_pvt->sofia_mutex);
+                                       //switch_channel_pre_answer(other_channel);
+                                       switch_core_session_queue_indication(other_session, SWITCH_MESSAGE_INDICATE_PROGRESS);
                                        switch_core_session_rwunlock(other_session);
                                }
                                goto done;
@@ -5100,10 +5099,9 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
                                        if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
                                                && (other_session = switch_core_session_locate(uuid))) {
-                                               other_channel = switch_core_session_get_channel(other_session);
-                                               switch_mutex_unlock(tech_pvt->sofia_mutex);
-                                               switch_channel_answer(other_channel);
-                                               switch_mutex_lock(tech_pvt->sofia_mutex);
+                                               //other_channel = switch_core_session_get_channel(other_session);
+                                               //switch_channel_answer(other_channel);
+                                               switch_core_session_queue_indication(other_session, SWITCH_MESSAGE_INDICATE_ANSWER);
                                                switch_core_session_rwunlock(other_session);
                                        }
                                }
@@ -5132,9 +5130,10 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                                if (!switch_channel_get_variable(other_channel, SWITCH_B_SDP_VARIABLE)) {
                                                        switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, r_sdp);
                                                }
-                                               switch_mutex_unlock(tech_pvt->sofia_mutex);
-                                               switch_channel_answer(other_channel);
-                                               switch_mutex_lock(tech_pvt->sofia_mutex);
+                                               
+                                               //switch_channel_answer(other_channel);
+                                               switch_core_session_queue_indication(other_session, SWITCH_MESSAGE_INDICATE_ANSWER);
+
                                                switch_core_session_rwunlock(other_session);
                                        }
                                        goto done;
index b5c56320b609cce6c563fabe3a11633f015b9394..e599839e164b445b4d6e1178f6aa7d7e3d1f88ac 100644 (file)
@@ -658,12 +658,38 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_next_event(switch_core_session_
 SWITCH_DECLARE(switch_status_t) switch_ivr_parse_all_messages(switch_core_session_t *session)
 {
        switch_core_session_message_t *message;
+       switch_channel_t *channel = switch_core_session_get_channel(session);
        int i = 0;
 
        while (switch_core_session_dequeue_message(session, &message) == SWITCH_STATUS_SUCCESS) {
                i++;
-               switch_core_session_receive_message(session, message);
+               
+               switch(message->message_id) {
+               case SWITCH_MESSAGE_INDICATE_ANSWER:
+                       if (switch_channel_answer(channel) != SWITCH_STATUS_SUCCESS) {
+                               switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+                       }
+                       switch_core_session_free_message(&message);
+                       break;
+               case SWITCH_MESSAGE_INDICATE_PROGRESS:
+                       if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
+                               switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+                       }
+                       switch_core_session_free_message(&message);
+                       break;
+               case SWITCH_MESSAGE_INDICATE_RINGING:
+                       if (switch_channel_ring_ready(channel) != SWITCH_STATUS_SUCCESS) {
+                               switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+                       }
+                       switch_core_session_free_message(&message);
+                       break;
+               default:
+                       switch_core_session_receive_message(session, message);
+                       break;
+               }
+
                message = NULL;
+
        }
 
        return i ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;