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

FreeSWITCH SVN anthm at freeswitch.org
Thu Jan 22 06:01:15 PST 2009


Author: anthm
Date: Thu Jan 22 08:01:15 2009
New Revision: 11356

Log:
tweak fifo and add app_flags

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

Modified: freeswitch/trunk/src/include/switch_channel.h
==============================================================================
--- freeswitch/trunk/src/include/switch_channel.h	(original)
+++ freeswitch/trunk/src/include/switch_channel.h	Thu Jan 22 08:01:15 2009
@@ -504,6 +504,10 @@
 SWITCH_DECLARE(void) switch_channel_clear_private_flag(switch_channel_t *channel, uint32_t flags);
 SWITCH_DECLARE(int) switch_channel_test_private_flag(switch_channel_t *channel, uint32_t flags);
 
+SWITCH_DECLARE(void) switch_channel_set_app_flag(switch_channel_t *channel, uint32_t flags);
+SWITCH_DECLARE(void) switch_channel_clear_app_flag(switch_channel_t *channel, uint32_t flags);
+SWITCH_DECLARE(int) switch_channel_test_app_flag(switch_channel_t *channel, uint32_t flags);
+
 /** @} */
 
 SWITCH_END_EXTERN_C

Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h	(original)
+++ freeswitch/trunk/src/include/switch_types.h	Thu Jan 22 08:01:15 2009
@@ -846,6 +846,12 @@
 	CF_FLAG_MAX
 } switch_channel_flag_t;
 
+
+typedef enum {
+	CF_APP_TAGGED = (1 << 0)
+} switch_channel_app_flag_t;
+
+
 /*!
   \enum switch_frame_flag_t
   \brief Frame Flags

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	Thu Jan 22 08:01:15 2009
@@ -42,7 +42,6 @@
 static switch_status_t load_config(int reload, int del_all);
 #define MAX_PRI 10
 
-
 struct fifo_node {
 	char *name;
 	switch_mutex_t *mutex;
@@ -847,8 +846,9 @@
 		switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
 		switch_channel_set_variable(channel, "fifo_status", "WAITING");
 		switch_channel_set_variable(channel, "fifo_timestamp", date);
+		switch_channel_set_variable(channel, "fifo_serviced_uuid", NULL);
 
-		switch_channel_set_flag(channel, CF_TAGGED);
+		switch_channel_set_app_flag(channel, CF_APP_TAGGED);
 
 		if (chime_list) {
 			char *list_dup = switch_core_session_strdup(session, chime_list);
@@ -878,7 +878,6 @@
 			}
 
 			if ((serviced_uuid = switch_channel_get_variable(channel, "fifo_serviced_uuid"))) {
-				switch_channel_set_variable(channel, "fifo_serviced_uuid", NULL);
 				break;
 			}
 
@@ -921,7 +920,7 @@
 			}
 		}
 
-		switch_channel_clear_flag(channel, CF_TAGGED);
+		switch_channel_clear_app_flag(channel, CF_APP_TAGGED);
 
 	  abort:
 
@@ -1176,7 +1175,7 @@
 
 				switch_channel_set_flag(other_channel, CF_BREAK);
 
-				while (switch_channel_ready(channel) && switch_channel_ready(other_channel) && switch_channel_test_flag(other_channel, CF_TAGGED)) {
+				while (switch_channel_ready(channel) && switch_channel_ready(other_channel) && switch_channel_test_app_flag(other_channel, CF_APP_TAGGED)) {
 					status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
 					if (!SWITCH_READ_ACCEPTABLE(status)) {
 						break;

Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c	(original)
+++ freeswitch/trunk/src/switch_channel.c	Thu Jan 22 08:01:15 2009
@@ -118,6 +118,7 @@
 	uint8_t flags[CF_FLAG_MAX];
 	uint8_t state_flags[CF_FLAG_MAX];
 	uint32_t private_flags;
+	uint32_t app_flags;
 	switch_caller_profile_t *caller_profile;
 	const switch_state_handler_table_t *state_handlers[SWITCH_MAX_STATE_HANDLERS];
 	int state_handler_index;
@@ -789,6 +790,32 @@
 	return (channel->private_flags & flags);
 }
 
+SWITCH_DECLARE(void) switch_channel_set_app_flag(switch_channel_t *channel, uint32_t flags)
+{
+	switch_assert(channel != NULL);
+	switch_mutex_lock(channel->flag_mutex);
+	channel->app_flags |= flags;
+	switch_mutex_unlock(channel->flag_mutex);
+}
+
+SWITCH_DECLARE(void) switch_channel_clear_app_flag(switch_channel_t *channel, uint32_t flags)
+{
+	switch_assert(channel != NULL);
+	switch_mutex_lock(channel->flag_mutex);
+	if (!flags) {
+		channel->app_flags = 0;
+	} else {
+		channel->app_flags &= ~flags;
+	}
+	switch_mutex_unlock(channel->flag_mutex);
+}
+
+SWITCH_DECLARE(int) switch_channel_test_app_flag(switch_channel_t *channel, uint32_t flags)
+{
+	switch_assert(channel != NULL);
+	return (channel->app_flags & flags);
+}
+
 SWITCH_DECLARE(void) switch_channel_set_state_flag(switch_channel_t *channel, switch_channel_flag_t flag)
 {
 	switch_assert(channel != NULL);



More information about the Freeswitch-svn mailing list