git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1215 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2006-04-20 23:57:04 +00:00
parent da448c26a3
commit a84fce3eb9
2 changed files with 24 additions and 19 deletions

View File

@@ -688,6 +688,7 @@ static void *audio_bridge_thread(switch_thread *thread, void *obj)
int *stream_id_p;
int stream_id = 0, ans_a = 0, ans_b = 0;
switch_dtmf_callback_function dtmf_callback;
switch_core_session_message msg = {0};
void *user_data;
switch_channel *chan_a, *chan_b;
@@ -760,17 +761,22 @@ static void *audio_bridge_thread(switch_thread *thread, void *obj)
/* read audio from 1 channel and write it to the other */
if (switch_core_session_read_frame(session_a, &read_frame, -1, stream_id) == SWITCH_STATUS_SUCCESS && read_frame->datalen) {
if (switch_core_session_write_frame(session_b, read_frame, -1, stream_id) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "write: %s Bad Frame....[%u] Bubye!\n", switch_channel_get_name(chan_b), read_frame->datalen);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "write: %s Bad Frame....[%u] Bubye!\n", switch_channel_get_name(chan_b), read_frame->datalen);
data->running = -1;
}
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "read: %s Bad Frame.... Bubye!\n", switch_channel_get_name(chan_a));
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "read: %s Bad Frame.... Bubye!\n", switch_channel_get_name(chan_a));
data->running = -1;
}
//switch_yield(1000);
}
msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE;
msg.from = __FILE__;
switch_core_session_receive_message(session_a, &msg);
data->running = 0;
if (his_thread->running > 0 && switch_channel_test_flag(chan_a, CF_ORIGINATOR)) {
@@ -936,6 +942,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_multi_threaded_bridge(switch_core_sessi
msg.message_id = SWITCH_MESSAGE_INDICATE_BRIDGE;
msg.from = __FILE__;
msg.pointer_arg = session;
switch_core_session_receive_message(peer_session, &msg);
msg.pointer_arg = peer_session;
switch_core_session_receive_message(session, &msg);
@@ -944,11 +951,6 @@ SWITCH_DECLARE(switch_status) switch_ivr_multi_threaded_bridge(switch_core_sessi
switch_core_session_launch_thread(peer_session, audio_bridge_thread, (void *) &other_audio_thread);
audio_bridge_thread(NULL, (void *) &this_audio_thread);
msg.pointer_arg = NULL;
msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE;
switch_core_session_receive_message(peer_session, &msg);
switch_core_session_receive_message(session, &msg);
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(caller_channel, event);
switch_event_fire(&event);