]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix issue MODENDP-165
authorAnthony Minessale <anthony.minessale@gmail.com>
Sat, 3 Jan 2009 03:10:11 +0000 (03:10 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Sat, 3 Jan 2009 03:10:11 +0000 (03:10 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11061 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_ivr_bridge.c
src/switch_ivr_originate.c

index 9c08dcc7a27d381da6043bb2785411ba12eeeaf3..55f57d41ed171bc990dbb31009514cf4078cb255 100644 (file)
@@ -829,8 +829,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
                        switch_channel_set_variable(peer_channel, SWITCH_BRIDGE_VARIABLE, switch_core_session_get_uuid(session));
 
                        if (!switch_channel_media_ready(caller_channel) || 
-                               !(switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA))) {
-                               if ((status = switch_ivr_wait_for_answer(session, peer_session)) != SWITCH_STATUS_SUCCESS) {
+                               (!switch_channel_test_flag(peer_channel, CF_ANSWERED) && !switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA))) {
+                               if ((status = switch_ivr_wait_for_answer(session, peer_session)) != SWITCH_STATUS_SUCCESS || !switch_channel_ready(caller_channel)) {
                                        switch_channel_state_t w_state = switch_channel_get_state(caller_channel);
                                        switch_channel_hangup(peer_channel, SWITCH_CAUSE_ALLOTTED_TIMEOUT);
                                        if (w_state < CS_HANGUP && w_state != CS_ROUTING && w_state != CS_PARK && 
@@ -850,6 +850,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
                                        switch_core_session_rwunlock(peer_session);
                                        goto done;
                                }
+
                                if (switch_channel_test_flag(peer_channel, CF_ANSWERED) && !switch_channel_test_flag(caller_channel, CF_ANSWERED)) {
                                        switch_channel_answer(caller_channel);
                                }
index b218275e42b4f696528c7c66436460b87a162b0c..8bb21d6f295db15a7065dab1eb429593eae2fc39 100644 (file)
@@ -330,7 +330,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t
        }
 
        if ((switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA))) {
-               return SWITCH_STATUS_SUCCESS;
+               goto end;
        }
 
        switch_zmalloc(write_frame.data, SWITCH_RECOMMENDED_BUFFER_SIZE);
@@ -551,7 +551,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t
 
        switch_safe_free(write_frame.data);
 
-       return status;
+ end:
+
+       return (!caller_channel || switch_channel_ready(caller_channel)) ? status : SWITCH_STATUS_FALSE;
 }
 
 static void process_import(switch_core_session_t *session, switch_channel_t *peer_channel)