Asterisk - The Open Source Telephony Project
21.4.1
|
Internal API for the Stasis application controller. More...
#include "asterisk/stasis_app.h"
Go to the source code of this file.
Functions | |
int | control_add_channel_to_bridge (struct stasis_app_control *control, struct ast_channel *chan, void *data) |
Command callback for adding a channel to a bridge. More... | |
struct stasis_app * | control_app (struct stasis_app_control *control) |
Returns the pointer (non-reffed) to the app associated with this control. More... | |
int | control_command_count (struct stasis_app_control *control) |
Returns the count of items in a control's command queue. More... | |
struct stasis_app_control * | control_create (struct ast_channel *channel, struct stasis_app *app) |
Create a control object. More... | |
int | control_dispatch_all (struct stasis_app_control *control, struct ast_channel *chan) |
Dispatch all commands enqueued to this control. More... | |
void | control_flush_queue (struct stasis_app_control *control) |
Flush the control command queue. More... | |
int | control_is_done (struct stasis_app_control *control) |
Returns true if control_continue() has been called on this control. More... | |
void | control_mark_done (struct stasis_app_control *control) |
void | control_move_cleanup (struct stasis_app_control *control) |
Free any memory that was allocated for switching applications via /channels/{channelId}/move. More... | |
char * | control_next_app (struct stasis_app_control *control) |
Returns the name of the application we are moving to. More... | |
char ** | control_next_app_args (struct stasis_app_control *control) |
Returns the list of arguments to pass to the application we are moving to. More... | |
int | control_next_app_args_size (struct stasis_app_control *control) |
Returns the number of arguments to be passed to the application we are moving to. More... | |
int | control_prestart_dispatch_all (struct stasis_app_control *control, struct ast_channel *chan) |
Dispatch all queued prestart commands. More... | |
void | control_set_app (struct stasis_app_control *control, struct stasis_app *app) |
Set the application the control object belongs to. More... | |
void | control_set_thread (struct stasis_app_control *control, pthread_t threadid) |
set the control's thread id More... | |
void | control_silence_stop_now (struct stasis_app_control *control) |
Stop playing silence to a channel right now. More... | |
int | control_swap_channel_in_bridge (struct stasis_app_control *control, struct ast_bridge *bridge, struct ast_channel *chan, struct ast_channel *swap) |
Command for swapping a channel in a bridge. More... | |
void | control_wait (struct stasis_app_control *control) |
Blocks until control's command queue has a command available. More... | |
int control_add_channel_to_bridge | ( | struct stasis_app_control * | control, |
struct ast_channel * | chan, | ||
void * | data | ||
) |
Command callback for adding a channel to a bridge.
control | The control for chan |
chan | The channel on which commands should be executed |
data | Bridge to be passed to the callback |
Definition at line 1400 of file control.c.
References control_swap_channel_in_bridge().
Referenced by stasis_app_control_add_channel_to_bridge().
struct stasis_app* control_app | ( | struct stasis_app_control * | control | ) |
Returns the pointer (non-reffed) to the app associated with this control.
control | Control to query. |
Definition at line 1585 of file control.c.
References stasis_app_control::app.
Referenced by stasis_app_exec().
int control_command_count | ( | struct stasis_app_control * | control | ) |
Returns the count of items in a control's command queue.
control | Control to count commands on |
Definition at line 365 of file control.c.
References ao2_container_count(), and stasis_app_control::command_queue.
Referenced by stasis_app_control_execute_until_exhausted().
struct stasis_app_control* control_create | ( | struct ast_channel * | channel, |
struct stasis_app * | app | ||
) |
Create a control object.
channel | Channel to control. |
app | stasis_app for which this control is being created. |
NULL | on error. |
Definition at line 129 of file control.c.
References stasis_app_control::add_rules, AO2_ALLOC_OPT_LOCK_MUTEX, ao2_bump, ao2_container_alloc_list, ao2_ref, stasis_app_control::app, ast_channel_ref, AST_LIST_HEAD_INIT, AST_VECTOR_INIT, stasis_app_control::channel, stasis_app_control::command_queue, control_set_thread(), stasis_app_control::next_app, stasis_app_control::next_app_args, and stasis_app_control::remove_rules.
Referenced by stasis_app_control_create(), and stasis_app_exec().
int control_dispatch_all | ( | struct stasis_app_control * | control, |
struct ast_channel * | chan | ||
) |
Dispatch all commands enqueued to this control.
control | Control object to dispatch. |
chan | Associated channel. |
Definition at line 1517 of file control.c.
References ao2_iterator_destroy(), ao2_iterator_init(), AO2_ITERATOR_UNLINK, ao2_ref, stasis_app_control::channel, and stasis_app_control::command_queue.
Referenced by stasis_app_control_execute_until_exhausted(), and stasis_app_exec().
void control_flush_queue | ( | struct stasis_app_control * | control | ) |
Flush the control command queue.
control | Control object to flush command queue. |
Definition at line 1504 of file control.c.
References ao2_iterator_destroy(), ao2_iterator_init(), AO2_ITERATOR_UNLINK, ao2_ref, and stasis_app_control::command_queue.
Referenced by stasis_app_control_flush_queue(), and stasis_app_exec().
int control_is_done | ( | struct stasis_app_control * | control | ) |
Returns true if control_continue() has been called on this control.
control | Control to query. |
True | (non-zero) if control_continue() has been called. |
False | (zero) otherwise. |
Definition at line 370 of file control.c.
References stasis_app_control::is_done.
Referenced by stasis_app_control_execute_until_exhausted(), stasis_app_control_is_done(), and stasis_app_exec().
void control_move_cleanup | ( | struct stasis_app_control * | control | ) |
Free any memory that was allocated for switching applications via /channels/{channelId}/move.
control | The control for the channel |
Definition at line 1724 of file control.c.
References ast_free_ptr(), AST_VECTOR_RESET, stasis_app_control::next_app, and stasis_app_control::next_app_args.
Referenced by stasis_app_exec().
char* control_next_app | ( | struct stasis_app_control * | control | ) |
Returns the name of the application we are moving to.
control | The control for the channel |
Definition at line 1719 of file control.c.
References stasis_app_control::next_app.
Referenced by stasis_app_exec().
char** control_next_app_args | ( | struct stasis_app_control * | control | ) |
Returns the list of arguments to pass to the application we are moving to.
control | The control for the channel |
Definition at line 1732 of file control.c.
References AST_VECTOR_STEAL_ELEMENTS, and stasis_app_control::next_app_args.
Referenced by stasis_app_exec().
int control_next_app_args_size | ( | struct stasis_app_control * | control | ) |
Returns the number of arguments to be passed to the application we are moving to.
control | The control for the channel |
Definition at line 1737 of file control.c.
References AST_VECTOR_SIZE, and stasis_app_control::next_app_args.
Referenced by stasis_app_exec().
int control_prestart_dispatch_all | ( | struct stasis_app_control * | control, |
struct ast_channel * | chan | ||
) |
Dispatch all queued prestart commands.
control | The control for chan |
chan | The channel on which commands should be executed |
Definition at line 1557 of file control.c.
References ao2_iterator_destroy(), ao2_iterator_init(), AO2_ITERATOR_UNLINK, command_prestart_get_container(), and stasis_app_control::command_queue.
Referenced by stasis_app_exec().
void control_set_app | ( | struct stasis_app_control * | control, |
struct stasis_app * | app | ||
) |
Set the application the control object belongs to.
control | The control for the channel |
app | The application this control will now belong to |
Definition at line 1713 of file control.c.
References ao2_bump, and stasis_app_control::app.
Referenced by stasis_app_exec().
void control_set_thread | ( | struct stasis_app_control * | control, |
pthread_t | threadid | ||
) |
set the control's thread id
control | Control object on which to set the thread id. |
threadid | id to set |
Definition at line 196 of file control.c.
References stasis_app_control::command_queue, and stasis_app_control::control_thread.
Referenced by control_create(), and stasis_app_exec().
void control_silence_stop_now | ( | struct stasis_app_control * | control | ) |
Stop playing silence to a channel right now.
control | The control for chan |
Definition at line 859 of file control.c.
References ast_channel_stop_silence_generator(), ast_debug, stasis_app_control::channel, stasis_app_control::silgen, and stasis_app_control_get_channel_id().
Referenced by stasis_app_exec().
int control_swap_channel_in_bridge | ( | struct stasis_app_control * | control, |
struct ast_bridge * | bridge, | ||
struct ast_channel * | chan, | ||
struct ast_channel * | swap | ||
) |
Command for swapping a channel in a bridge.
control | The control for chan |
chan | The channel on which commands should be executed |
bridge | Bridge to be passed to the callback |
swap | Channel to swap with when joining the bridge |
Definition at line 1306 of file control.c.
References stasis_app_control::app, app_subscribe_bridge(), ast_bridge_depart(), ast_bridge_impart(), AST_BRIDGE_IMPART_CHAN_DEPARTABLE, AST_BRIDGE_IMPART_INHIBIT_JOIN_COLP, ast_bridge_set_after_callback(), ast_debug, stasis_app_control::bridge, stasis_app_control::bridge_features, ast_bridge_features::inhibit_colp, stasis_app_control::pbx, set_interval_hook(), stasis_app_control_get_channel_id(), stasis_app_get_bridge(), and ast_bridge::uniqueid.
Referenced by control_add_channel_to_bridge().
void control_wait | ( | struct stasis_app_control * | control | ) |
Blocks until control's command queue has a command available.
control | Control to block on. |
Definition at line 1537 of file control.c.
References ao2_container_count(), ao2_object_get_lockaddr(), and stasis_app_control::command_queue.
Referenced by stasis_app_exec().