]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
slowly unbreak things broken since the 'break everything' commit
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 3 Mar 2006 17:49:22 +0000 (17:49 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 3 Mar 2006 17:49:22 +0000 (17:49 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@742 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_channel.c
src/switch_core.c
src/switch_ivr.c

index cc60d33f06be435d58c8e4b1a10c2d292c65fa29..cdeb37be4b83e551d30faeccd0d2c498e1a23a83 100644 (file)
@@ -575,7 +575,11 @@ SWITCH_DECLARE(switch_status) switch_channel_pre_answer(switch_channel *channel)
        msg.message_id = SWITCH_MESSAGE_INDICATE_PROGRESS;
        msg.from = channel->name;
        status = switch_core_session_message_send(uuid, &msg);
-       switch_channel_set_flag(channel, CF_EARLY_MEDIA);
+
+       if (status == SWITCH_STATUS_SUCCESS) {
+               switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Pre-Answer %s!\n", channel->name);
+               switch_channel_set_flag(channel, CF_EARLY_MEDIA);
+       }
 
        return status;
 }
index 9ccb824e5d5736023a901783ad7235e3f66846b7..d4cc51c56fef8fe073bddae4069f86d72890d116 100644 (file)
@@ -857,9 +857,7 @@ SWITCH_DECLARE(switch_status) switch_core_session_receive_message(switch_core_se
                                }
                        }
                }
-       } else {
-               status = SWITCH_STATUS_SUCCESS;
-       }
+       } 
 
        return status;
 }
index 763b74bd1c16af75ae1d7c609b9d204ae35927b5..f4a633487984cd83119dc748c2e8839f0a6ed6e1 100644 (file)
@@ -862,7 +862,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_multi_threaded_bridge(switch_core_sessi
        int stream_id = 0;
        switch_frame *read_frame;
 
-
+       
 
        caller_channel = switch_core_session_get_channel(session);
        assert(caller_channel != NULL);
@@ -896,6 +896,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_multi_threaded_bridge(switch_core_sessi
        switch_channel_add_state_handler(peer_channel, &audio_bridge_peer_state_handlers);
        switch_core_session_thread_launch(peer_session);
 
+
        for (;;) {
                int state = switch_channel_get_state(peer_channel);
                if (state > CS_RING) {
@@ -904,16 +905,23 @@ SWITCH_DECLARE(switch_status) switch_ivr_multi_threaded_bridge(switch_core_sessi
                switch_yield(1000);
        }
 
+       switch_channel_pre_answer(caller_channel);
+       
        time(&start);
        while (switch_channel_ready(caller_channel) &&
                   switch_channel_ready(peer_channel) &&
                   !switch_channel_test_flag(peer_channel, CF_ANSWERED) &&
                   !switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA) &&
                   ((time(NULL) - start) < timelimit)) {
-               if (switch_core_session_read_frame(session, &read_frame, 1000, 0) != SWITCH_STATUS_SUCCESS) {
-                       break;
+
+               /* read from the channel while we wait if the audio is up on it */
+               if (switch_channel_test_flag(caller_channel, CF_ANSWERED) || switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA)) {
+                       if (switch_core_session_read_frame(session, &read_frame, 1000, 0) != SWITCH_STATUS_SUCCESS) {
+                               break;
+                       }
+               } else {
+                       switch_yield(1000);
                }
-               switch_yield(1000);
        }
 
        if (switch_channel_test_flag(peer_channel, CF_ANSWERED)) {