[Freeswitch-svn] [commit] r7100 - in freeswitch/trunk/src: . include mod/applications/mod_fifo

Freeswitch SVN anthm at freeswitch.org
Sat Jan 5 15:44:55 EST 2008


Author: anthm
Date: Sat Jan  5 15:44:54 2008
New Revision: 7100

Modified:
   freeswitch/trunk/src/include/switch_channel.h
   freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c
   freeswitch/trunk/src/switch_channel.c
   freeswitch/trunk/src/switch_ivr_bridge.c

Log:
add funcs

Modified: freeswitch/trunk/src/include/switch_channel.h
==============================================================================
--- freeswitch/trunk/src/include/switch_channel.h	(original)
+++ freeswitch/trunk/src/include/switch_channel.h	Sat Jan  5 15:44:54 2008
@@ -75,6 +75,7 @@
 SWITCH_DECLARE(uint8_t) switch_channel_ready(switch_channel_t *channel);
 
 SWITCH_DECLARE(void) switch_channel_wait_for_state(switch_channel_t *channel, switch_channel_t *other_channel, switch_channel_state_t want_state);
+SWITCH_DECLARE(switch_status_t) switch_channel_wait_for_flag(switch_channel_t *channel, switch_channel_flag_t want_flag, uint32_t to);
 
 SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_state(switch_channel_t *channel,
 																		const char *file, const char *func, int line, switch_channel_state_t state);
@@ -469,6 +470,8 @@
 SWITCH_DECLARE(char *) switch_channel_build_param_string(switch_channel_t *channel, switch_caller_profile_t *caller_profile, const char *prefix);
 SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t *channel);
 
+#define switch_channel_stop_broadcast(_channel)	switch_channel_set_flag(_channel, CF_BREAK | CF_STOP_BROADCAST)
+
 /** @} */
 
 SWITCH_END_EXTERN_C

Modified: freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c	Sat Jan  5 15:44:54 2008
@@ -414,8 +414,7 @@
 
                 if (switch_channel_test_flag(other_channel, CF_TAGGED)) {
                     switch_channel_clear_flag(other_channel, CF_CONTROLLED);
-                    switch_channel_set_flag(other_channel, CF_STOP_BROADCAST);
-                    switch_channel_set_flag(other_channel, CF_BREAK);
+                    switch_channel_stop_broadcast(other_channel);
                     switch_core_session_kill_channel(other_session, SWITCH_SIG_BREAK);
                     while (switch_channel_test_flag(other_channel, CF_TAGGED)) {
                         status = switch_core_session_read_frame(session, &read_frame, -1, 0);

Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c	(original)
+++ freeswitch/trunk/src/switch_channel.c	Sat Jan  5 15:44:54 2008
@@ -550,6 +550,23 @@
 	}
 }
 
+SWITCH_DECLARE(switch_status_t) switch_channel_wait_for_flag(switch_channel_t *channel, switch_channel_flag_t want_flag, uint32_t to)
+{
+
+	if (to) {
+		to++;
+	}
+
+	while(!switch_test_flag(channel, want_flag)) {
+		switch_yield(1000);
+		if (to && !--to) {
+			return SWITCH_STATUS_TIMEOUT;
+		}
+	}
+	
+	return SWITCH_STATUS_SUCCESS;
+}
+
 SWITCH_DECLARE(void) switch_channel_set_flag(switch_channel_t *channel, switch_channel_flag_t flags)
 {
 	switch_assert(channel != NULL);
@@ -1223,8 +1240,7 @@
 		switch_mutex_unlock(channel->profile_mutex);
 	}
 
-	switch_set_flag(channel, CF_BREAK);
-	switch_set_flag(channel, CF_STOP_BROADCAST);
+	switch_channel_stop_broadcast(channel);
 	
 	if (channel->state < CS_HANGUP) {
 		switch_event_t *event;

Modified: freeswitch/trunk/src/switch_ivr_bridge.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_bridge.c	(original)
+++ freeswitch/trunk/src/switch_ivr_bridge.c	Sat Jan  5 15:44:54 2008
@@ -222,8 +222,7 @@
  end:
 
 	switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK);
-	switch_channel_set_flag(chan_b, CF_STOP_BROADCAST);
-	switch_channel_set_flag(chan_b, CF_BREAK);
+	switch_channel_stop_broadcast(chan_b);
 	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));



More information about the Freeswitch-svn mailing list