diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index 00e6afedb2..7cbcc9c479 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -504,6 +504,10 @@ SWITCH_DECLARE(void) switch_channel_set_private_flag(switch_channel_t *channel, 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 diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 6ab295a556..ee4ddf8392 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -846,6 +846,12 @@ typedef enum { 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 diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 85f07b4597..d21449f457 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -42,7 +42,6 @@ SWITCH_MODULE_DEFINITION(mod_fifo, mod_fifo_load, mod_fifo_shutdown, NULL); 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_STANDARD_APP(fifo_function) 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 @@ SWITCH_STANDARD_APP(fifo_function) } 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_STANDARD_APP(fifo_function) } } - switch_channel_clear_flag(channel, CF_TAGGED); + switch_channel_clear_app_flag(channel, CF_APP_TAGGED); abort: @@ -1176,7 +1175,7 @@ SWITCH_STANDARD_APP(fifo_function) 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; diff --git a/src/switch_channel.c b/src/switch_channel.c index 36893d49d8..18cfaa0fb4 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -118,6 +118,7 @@ struct switch_channel { 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 @@ SWITCH_DECLARE(int) switch_channel_test_private_flag(switch_channel_t *channel, 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);