mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-24 19:52:35 +00:00
tweak fifo and add app_flags
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11356 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
c19f9fca71
commit
f776a727b0
@ -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(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(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
|
SWITCH_END_EXTERN_C
|
||||||
|
@ -846,6 +846,12 @@ typedef enum {
|
|||||||
CF_FLAG_MAX
|
CF_FLAG_MAX
|
||||||
} switch_channel_flag_t;
|
} switch_channel_flag_t;
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
CF_APP_TAGGED = (1 << 0)
|
||||||
|
} switch_channel_app_flag_t;
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\enum switch_frame_flag_t
|
\enum switch_frame_flag_t
|
||||||
\brief Frame Flags
|
\brief Frame Flags
|
||||||
|
@ -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);
|
static switch_status_t load_config(int reload, int del_all);
|
||||||
#define MAX_PRI 10
|
#define MAX_PRI 10
|
||||||
|
|
||||||
|
|
||||||
struct fifo_node {
|
struct fifo_node {
|
||||||
char *name;
|
char *name;
|
||||||
switch_mutex_t *mutex;
|
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_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_status", "WAITING");
|
||||||
switch_channel_set_variable(channel, "fifo_timestamp", date);
|
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) {
|
if (chime_list) {
|
||||||
char *list_dup = switch_core_session_strdup(session, 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"))) {
|
if ((serviced_uuid = switch_channel_get_variable(channel, "fifo_serviced_uuid"))) {
|
||||||
switch_channel_set_variable(channel, "fifo_serviced_uuid", NULL);
|
|
||||||
break;
|
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:
|
abort:
|
||||||
|
|
||||||
@ -1176,7 +1175,7 @@ SWITCH_STANDARD_APP(fifo_function)
|
|||||||
|
|
||||||
switch_channel_set_flag(other_channel, CF_BREAK);
|
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);
|
status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
|
||||||
if (!SWITCH_READ_ACCEPTABLE(status)) {
|
if (!SWITCH_READ_ACCEPTABLE(status)) {
|
||||||
break;
|
break;
|
||||||
|
@ -118,6 +118,7 @@ struct switch_channel {
|
|||||||
uint8_t flags[CF_FLAG_MAX];
|
uint8_t flags[CF_FLAG_MAX];
|
||||||
uint8_t state_flags[CF_FLAG_MAX];
|
uint8_t state_flags[CF_FLAG_MAX];
|
||||||
uint32_t private_flags;
|
uint32_t private_flags;
|
||||||
|
uint32_t app_flags;
|
||||||
switch_caller_profile_t *caller_profile;
|
switch_caller_profile_t *caller_profile;
|
||||||
const switch_state_handler_table_t *state_handlers[SWITCH_MAX_STATE_HANDLERS];
|
const switch_state_handler_table_t *state_handlers[SWITCH_MAX_STATE_HANDLERS];
|
||||||
int state_handler_index;
|
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);
|
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_DECLARE(void) switch_channel_set_state_flag(switch_channel_t *channel, switch_channel_flag_t flag)
|
||||||
{
|
{
|
||||||
switch_assert(channel != NULL);
|
switch_assert(channel != NULL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user