From 698b1b1b56639a92bbe3cc99fc6a99736351f208 Mon Sep 17 00:00:00 2001
From: Anthony Minessale <anthony.minessale@gmail.com>
Date: Sat, 5 Jan 2008 17:32:13 +0000
Subject: [PATCH] update

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7099 d0543943-73ff-0310-b7d9-9358b9ac24b2
---
 src/include/switch_types.h               | 4 +++-
 src/mod/applications/mod_fifo/mod_fifo.c | 2 +-
 src/switch_channel.c                     | 2 +-
 src/switch_ivr.c                         | 6 ++++--
 src/switch_ivr_bridge.c                  | 4 ++--
 5 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/include/switch_types.h b/src/include/switch_types.h
index 0bc1b0e602..1641d09d89 100644
--- a/src/include/switch_types.h
+++ b/src/include/switch_types.h
@@ -629,6 +629,7 @@ CF_VIDEO		= (1 << 22) - Channel has video
 CF_EVENT_LOCK   = (1 << 23) - Don't parse events
 CF_RESET        = (1 << 24) - Tell extension parser to reset
 CF_ORIGINATING  = (1 << 25) - Channel is originating
+CF_STOP_BROADCAST = (1 << 26) - Signal to stop broadcast
 </pre>
  */
 
@@ -658,7 +659,8 @@ typedef enum {
 	CF_VIDEO = (1 << 22),
 	CF_EVENT_LOCK = (1 << 23),
 	CF_RESET = (1 << 24),
-	CF_ORIGINATING = (1 << 25)
+	CF_ORIGINATING = (1 << 25),
+	CF_STOP_BROADCAST = (1 << 26),
 } switch_channel_flag_t;
 
 
diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c
index 9df1995c54..2e7b25c142 100644
--- a/src/mod/applications/mod_fifo/mod_fifo.c
+++ b/src/mod/applications/mod_fifo/mod_fifo.c
@@ -414,7 +414,7 @@ SWITCH_STANDARD_APP(fifo_function)
 
                 if (switch_channel_test_flag(other_channel, CF_TAGGED)) {
                     switch_channel_clear_flag(other_channel, CF_CONTROLLED);
-                    switch_channel_clear_flag(other_channel, CF_BROADCAST);
+                    switch_channel_set_flag(other_channel, CF_STOP_BROADCAST);
                     switch_channel_set_flag(other_channel, CF_BREAK);
                     switch_core_session_kill_channel(other_session, SWITCH_SIG_BREAK);
                     while (switch_channel_test_flag(other_channel, CF_TAGGED)) {
diff --git a/src/switch_channel.c b/src/switch_channel.c
index 9bb53708d8..e2bdb129f3 100644
--- a/src/switch_channel.c
+++ b/src/switch_channel.c
@@ -1224,7 +1224,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_hangup(switch_chan
 	}
 
 	switch_set_flag(channel, CF_BREAK);
-	switch_clear_flag(channel, CF_BROADCAST);
+	switch_set_flag(channel, CF_STOP_BROADCAST);
 	
 	if (channel->state < CS_HANGUP) {
 		switch_event_t *event;
diff --git a/src/switch_ivr.c b/src/switch_ivr.c
index 8db7e81c5e..313155b7a7 100644
--- a/src/switch_ivr.c
+++ b/src/switch_ivr.c
@@ -315,11 +315,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se
 			if ((application_interface = switch_loadable_module_get_application_interface(app_name))) {
 				if (application_interface->application_function) {
 					int x;
+					switch_channel_clear_flag(channel, CF_STOP_BROADCAST);
 					switch_channel_set_flag(channel, CF_BROADCAST);
 					for (x = 0; x < loops || loops < 0; x++) {
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Command Execute %s(%s)\n", app_name, app_arg);
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Command Execute %s(%s)\n", 
+										  switch_channel_get_name(channel), app_name, app_arg);
 						switch_core_session_exec(session, application_interface, app_arg);
-						if (!switch_channel_ready(channel) || !switch_channel_test_flag(channel, CF_BROADCAST)) {
+						if (!switch_channel_ready(channel) || switch_channel_test_flag(channel, CF_STOP_BROADCAST)) {
 							break;
 						}
 					}
diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c
index 19eff4e063..236741ae10 100644
--- a/src/switch_ivr_bridge.c
+++ b/src/switch_ivr_bridge.c
@@ -222,8 +222,8 @@ static void *audio_bridge_thread(switch_thread_t * thread, void *obj)
  end:
 
 	switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK);
-	//switch_channel_clear_flag(chan_b, CF_BROADCAST);
-	//switch_channel_set_flag(chan_b, CF_BREAK);
+	switch_channel_set_flag(chan_b, CF_STOP_BROADCAST);
+	switch_channel_set_flag(chan_b, CF_BREAK);
 	switch_core_session_reset(session_a);
 	switch_channel_set_variable(chan_a, SWITCH_BRIDGE_VARIABLE, NULL);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "BRIDGE THREAD DONE [%s]\n", switch_channel_get_name(chan_a));