Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
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_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 1387 of file control.c.
References control_swap_channel_in_bridge(), and NULL.
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 1572 of file control.c.
References stasis_app_control::app.
Referenced by bridge_stasis_moving(), bridge_stasis_push_peek(), channel_replaced_cb(), channel_stolen_cb(), and 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 352 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 125 of file control.c.
References stasis_app_control::add_rules, ao2_alloc, AO2_ALLOC_OPT_LOCK_MUTEX, ao2_bump, ao2_container_alloc_list, ao2_ref, app, stasis_app_control::app, ast_channel_ref, ast_cond_init, AST_LIST_HEAD_INIT, ast_log, AST_VECTOR_INIT, stasis_app_control::channel, stasis_app_control::command_queue, control_dtor(), errno, LOG_ERROR, stasis_app_control::next_app, stasis_app_control::next_app_args, NULL, stasis_app_control::remove_rules, and stasis_app_control::wait_cond.
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 1504 of file control.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, AO2_ITERATOR_UNLINK, ao2_ref, ast_assert, stasis_app_control::channel, command_invoke(), 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 1491 of file control.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, AO2_ITERATOR_UNLINK, ao2_ref, command_complete(), 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 357 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_mark_done | ( | struct stasis_app_control * | control | ) |
Definition at line 363 of file control.c.
References ao2_lock, ao2_unlock, stasis_app_control::command_queue, and stasis_app_control::is_done.
Referenced by app_control_continue(), stasis_app_control_execute_until_exhausted(), 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 1711 of file control.c.
References ast_free, ast_free_ptr(), AST_VECTOR_RESET, stasis_app_control::next_app, stasis_app_control::next_app_args, and NULL.
Referenced by app_control_move(), control_dtor(), and 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 1706 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 1719 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 1724 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 1544 of file control.c.
References ao2_cleanup, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, AO2_ITERATOR_UNLINK, ast_channel_lock, ast_channel_unlock, command_invoke(), and command_prestart_get_container().
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 1700 of file control.c.
References ao2_bump, ao2_cleanup, app, and stasis_app_control::app.
Referenced by 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 846 of file control.c.
References ast_channel_stop_silence_generator(), ast_debug, stasis_app_control::channel, NULL, stasis_app_control::silgen, and stasis_app_control_get_channel_id().
Referenced by app_control_silence_stop(), and 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 1293 of file control.c.
References ao2_lock, ao2_unlock, stasis_app_control::app, app_subscribe_bridge(), ast_assert, ast_bridge_depart(), ast_bridge_impart(), AST_BRIDGE_IMPART_CHAN_DEPARTABLE, AST_BRIDGE_IMPART_INHIBIT_JOIN_COLP, ast_bridge_set_after_callback(), ast_channel_lock, ast_channel_pbx(), ast_channel_pbx_set(), ast_channel_unlock, ast_debug, ast_log, stasis_app_control::bridge, bridge_after_cb(), bridge_after_cb_failed(), stasis_app_control::bridge_features, ast_bridge_features::inhibit_colp, LOG_ERROR, NULL, 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(), and defer_bridge_add().
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 1524 of file control.c.
References ao2_container_count(), ao2_lock, ao2_object_get_lockaddr(), ao2_unlock, ast_assert, ast_cond_wait, ast_log, stasis_app_control::command_queue, LOG_ERROR, NULL, and stasis_app_control::wait_cond.
Referenced by stasis_app_exec().