Asterisk - The Open Source Telephony Project GIT-master-d5a0626
|
Stasis application control support. More...
#include "asterisk.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/stasis_app.h"
#include "command.h"
#include "control.h"
#include "app.h"
#include "asterisk/dial.h"
#include "asterisk/bridge.h"
#include "asterisk/bridge_after.h"
#include "asterisk/bridge_basic.h"
#include "asterisk/bridge_features.h"
#include "asterisk/frame.h"
#include "asterisk/pbx.h"
#include "asterisk/musiconhold.h"
#include "asterisk/app.h"
#include <signal.h>
Go to the source code of this file.
Data Structures | |
struct | app_control_rules |
struct | chanvar |
structure for queuing ARI channel variable setting More... | |
struct | control_dial_args |
struct | stasis_app_control |
struct | stasis_app_control_continue_data |
struct | stasis_app_control_dtmf_data |
struct | stasis_app_control_move_data |
struct | stasis_app_control_mute_data |
Typedefs | |
typedef int(* | app_command_can_exec_cb) (struct stasis_app_control *control) |
Functions | |
static int | add_to_dial_bridge (struct stasis_app_control *control, struct ast_channel *chan) |
Add a channel to the singleton dial bridge. More... | |
static int | app_control_add_role (struct stasis_app_control *control, struct ast_channel *chan, void *data) |
static int | app_control_can_add_channel_to_bridge (struct stasis_app_control *control) |
static int | app_control_can_remove_channel_from_bridge (struct stasis_app_control *control) |
static enum stasis_app_control_channel_result | app_control_check_rules (const struct stasis_app_control *control, struct app_control_rules *list) |
static int | app_control_clear_roles (struct stasis_app_control *control, struct ast_channel *chan, void *data) |
static int | app_control_continue (struct stasis_app_control *control, struct ast_channel *chan, void *data) |
static int | app_control_dial (struct stasis_app_control *control, struct ast_channel *chan, void *data) |
static int | app_control_dtmf (struct stasis_app_control *control, struct ast_channel *chan, void *data) |
static int | app_control_hold (struct stasis_app_control *control, struct ast_channel *chan, void *data) |
static int | app_control_moh_start (struct stasis_app_control *control, struct ast_channel *chan, void *data) |
static int | app_control_moh_stop (struct stasis_app_control *control, struct ast_channel *chan, void *data) |
static int | app_control_move (struct stasis_app_control *control, struct ast_channel *chan, void *data) |
static int | app_control_mute (struct stasis_app_control *control, struct ast_channel *chan, void *data) |
static int | app_control_redirect (struct stasis_app_control *control, struct ast_channel *chan, void *data) |
static void | app_control_register_rule (struct stasis_app_control *control, struct app_control_rules *list, struct stasis_app_control_rule *obj) |
static int | app_control_remove_channel_from_bridge (struct stasis_app_control *control, struct ast_channel *chan, void *data) |
static int | app_control_ring (struct stasis_app_control *control, struct ast_channel *chan, void *data) |
static int | app_control_ring_stop (struct stasis_app_control *control, struct ast_channel *chan, void *data) |
static int | app_control_set_channel_var (struct stasis_app_control *control, struct ast_channel *chan, void *data) |
static int | app_control_silence_start (struct stasis_app_control *control, struct ast_channel *chan, void *data) |
static int | app_control_silence_stop (struct stasis_app_control *control, struct ast_channel *chan, void *data) |
static int | app_control_unhold (struct stasis_app_control *control, struct ast_channel *chan, void *data) |
static int | app_control_unmute (struct stasis_app_control *control, struct ast_channel *chan, void *data) |
static void | app_control_unregister_rule (struct stasis_app_control *control, struct app_control_rules *list, struct stasis_app_control_rule *obj) |
static int | app_send_command_on_condition (struct stasis_app_control *control, stasis_app_command_cb command_fn, void *data, command_data_destructor_fn data_destructor, app_command_can_exec_cb can_exec_fn) |
static void | bridge_after_cb (struct ast_channel *chan, void *data) |
static void | bridge_after_cb_failed (enum ast_bridge_after_cb_reason reason, void *data) |
static int | bridge_channel_depart (struct stasis_app_control *control, struct ast_channel *chan, void *data) |
static int | bridge_timeout (struct ast_bridge_channel *bridge_channel, void *ignore) |
Dial timeout. 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. 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... | |
static struct control_dial_args * | control_dial_args_alloc (const char *dialstring, unsigned int timeout) |
static void | control_dial_args_destroy (void *data) |
int | control_dispatch_all (struct stasis_app_control *control, struct ast_channel *chan) |
Dispatch all commands enqueued to this control. More... | |
static void | control_dtor (void *obj) |
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... | |
static int | depart_channel (struct stasis_app_control *control, struct ast_channel *chan) |
Depart a channel from a bridge, and potentially add it back to the dial bridge. More... | |
static void | dial_bridge_after_cb (struct ast_channel *chan, void *data) |
after bridge callback for the dial bridge More... | |
static void | dial_bridge_after_cb_failed (enum ast_bridge_after_cb_reason reason, void *data) |
static void | dtmf_in_bridge (struct ast_channel *chan, struct stasis_app_control_dtmf_data *dtmf_data) |
static void | dtmf_no_bridge (struct ast_channel *chan, struct stasis_app_control_dtmf_data *dtmf_data) |
static struct stasis_app_command * | exec_command (struct stasis_app_control *control, stasis_app_command_cb command_fn, void *data, command_data_destructor_fn data_destructor) |
static struct stasis_app_command * | exec_command_on_condition (struct stasis_app_control *control, stasis_app_command_cb command_fn, void *data, command_data_destructor_fn data_destructor, app_command_can_exec_cb can_exec_fn) |
static void | free_chanvar (void *data) |
static struct ast_bridge * | get_dial_bridge (void) |
Retrieve a reference to the dial bridge. More... | |
static int | hangup_channel (struct stasis_app_control *control, struct ast_channel *chan, void *data) |
static void | internal_bridge_after_cb (struct ast_channel *chan, void *data, enum ast_bridge_after_cb_reason reason) |
static int | noop_cb (struct stasis_app_control *control, struct ast_channel *chan, void *data) |
static void | set_interval_hook (struct ast_channel *chan) |
Set a dial timeout interval hook on the channel. More... | |
static int | set_timeout (struct ast_channel *chan, unsigned int timeout) |
Set dial timeout on a channel to be dialed. More... | |
void | stasis_app_control_absorb_dtmf_in_bridge (struct stasis_app_control *control, int absorb) |
Set whether DTMF from the channel is absorbed instead of passing through to the bridge. More... | |
int | stasis_app_control_add_channel_to_bridge (struct stasis_app_control *control, struct ast_bridge *bridge) |
Add a channel to the bridge. More... | |
int | stasis_app_control_add_role (struct stasis_app_control *control, const char *role) |
Apply a bridge role to a channel controlled by a stasis app control. More... | |
int | stasis_app_control_bridge_features_init (struct stasis_app_control *control) |
Initialize bridge features into a channel control. More... | |
void | stasis_app_control_clear_roles (struct stasis_app_control *control) |
Clear bridge roles currently applied to a channel controlled by a stasis app control. More... | |
int | stasis_app_control_continue (struct stasis_app_control *control, const char *context, const char *extension, int priority) |
Exit res_stasis and continue execution in the dialplan. More... | |
int | stasis_app_control_dial (struct stasis_app_control *control, const char *dialstring, unsigned int timeout) |
Dial a channel. More... | |
int | stasis_app_control_dtmf (struct stasis_app_control *control, const char *dtmf, int before, int between, unsigned int duration, int after) |
Send DTMF to the channel associated with this control. More... | |
const char * | stasis_app_control_get_channel_id (const struct stasis_app_control *control) |
Returns the uniqueid of the channel associated with this control. More... | |
struct ast_channel_snapshot * | stasis_app_control_get_snapshot (const struct stasis_app_control *control) |
Returns the most recent snapshot for the associated channel. More... | |
void | stasis_app_control_hold (struct stasis_app_control *control) |
Place the channel associated with the control on hold. More... | |
void | stasis_app_control_inhibit_colp_in_bridge (struct stasis_app_control *control, int inhibit_colp) |
Set whether COLP frames should be generated when joining the bridge. More... | |
void | stasis_app_control_moh_start (struct stasis_app_control *control, const char *moh_class) |
Play music on hold to a channel (does not affect hold status) More... | |
void | stasis_app_control_moh_stop (struct stasis_app_control *control) |
Stop playing music on hold to a channel (does not affect hold status) More... | |
int | stasis_app_control_move (struct stasis_app_control *control, const char *app_name, const char *app_args) |
Exit res_stasis and move to another Stasis application. More... | |
int | stasis_app_control_mute (struct stasis_app_control *control, unsigned int direction, enum ast_frame_type frametype) |
Mute the channel associated with this control. More... | |
void | stasis_app_control_mute_in_bridge (struct stasis_app_control *control, int mute) |
Set whether audio from the channel is muted instead of passing through to the bridge. More... | |
void | stasis_app_control_publish (struct stasis_app_control *control, struct stasis_message *message) |
Publish a message to the control's channel's topic. More... | |
int | stasis_app_control_queue_control (struct stasis_app_control *control, enum ast_control_frame_type frame_type) |
Queue a control frame without payload. More... | |
int | stasis_app_control_redirect (struct stasis_app_control *control, const char *endpoint) |
Redirect a channel in res_stasis to a particular endpoint. More... | |
void | stasis_app_control_register_add_rule (struct stasis_app_control *control, struct stasis_app_control_rule *rule) |
Registers an add channel to bridge rule. More... | |
void | stasis_app_control_register_remove_rule (struct stasis_app_control *control, struct stasis_app_control_rule *rule) |
Registers a remove channel from bridge rule. More... | |
int | stasis_app_control_remove_channel_from_bridge (struct stasis_app_control *control, struct ast_bridge *bridge) |
Remove a channel from the bridge. More... | |
int | stasis_app_control_ring (struct stasis_app_control *control) |
Indicate ringing to the channel associated with this control. More... | |
int | stasis_app_control_ring_stop (struct stasis_app_control *control) |
Stop locally generated ringing on the channel associated with this control. More... | |
int | stasis_app_control_set_channel_var (struct stasis_app_control *control, const char *variable, const char *value) |
Set a variable on the channel associated with this control to value. More... | |
void | stasis_app_control_shutdown (void) |
Let Stasis app internals shut down. More... | |
void | stasis_app_control_silence_start (struct stasis_app_control *control) |
Start playing silence to a channel. More... | |
void | stasis_app_control_silence_stop (struct stasis_app_control *control) |
Stop playing silence to a channel. More... | |
void | stasis_app_control_unhold (struct stasis_app_control *control) |
Remove the channel associated with the control from hold. More... | |
int | stasis_app_control_unmute (struct stasis_app_control *control, unsigned int direction, enum ast_frame_type frametype) |
Unmute the channel associated with this control. More... | |
void | stasis_app_control_unregister_add_rule (struct stasis_app_control *control, struct stasis_app_control_rule *rule) |
UnRegister an add channel to bridge rule. More... | |
void | stasis_app_control_unregister_remove_rule (struct stasis_app_control *control, struct stasis_app_control_rule *rule) |
Unregisters a remove channel from bridge rule. More... | |
struct ast_bridge * | stasis_app_get_bridge (struct stasis_app_control *control) |
Gets the bridge currently associated with a control object. More... | |
int | stasis_app_send_command (struct stasis_app_control *control, stasis_app_command_cb command_fn, void *data, command_data_destructor_fn data_destructor) |
Invokes a command on a control's channel. More... | |
int | stasis_app_send_command_async (struct stasis_app_control *control, stasis_app_command_cb command_fn, void *data, command_data_destructor_fn data_destructor) |
Asynchronous version of stasis_app_send_command(). More... | |
Variables | |
static struct ast_bridge * | dial_bridge |
Singleton dial bridge. More... | |
static ast_mutex_t | dial_bridge_lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
static int | shutting_down |
Indicates if the Stasis app internals are being shut down. More... | |
struct ast_datastore_info | timeout_datastore |
Dial timeout datastore. More... | |
Stasis application control support.
Definition in file control.c.
typedef int(* app_command_can_exec_cb) (struct stasis_app_control *control) |
|
static |
Add a channel to the singleton dial bridge.
control | The Stasis control structure |
chan | The channel to add to the bridge |
-1 | Failed |
0 | Success |
Definition at line 1050 of file control.c.
References ao2_ref, ast_bridge_impart(), AST_BRIDGE_IMPART_CHAN_DEPARTABLE, ast_bridge_set_after_callback(), stasis_app_control::bridge, dial_bridge_after_cb(), dial_bridge_after_cb_failed(), get_dial_bridge(), and NULL.
Referenced by app_control_dial(), and depart_channel().
|
static |
Definition at line 317 of file control.c.
References ast_channel_add_bridge_role(), and stasis_app_command::data.
Referenced by stasis_app_control_add_role().
|
static |
Definition at line 247 of file control.c.
References stasis_app_control::add_rules, and app_control_check_rules().
Referenced by stasis_app_control_add_channel_to_bridge().
|
static |
Definition at line 253 of file control.c.
References app_control_check_rules(), and stasis_app_control::remove_rules.
Referenced by stasis_app_control_remove_channel_from_bridge().
|
static |
Definition at line 205 of file control.c.
References AST_LIST_TRAVERSE, and stasis_app_control_rule::next.
Referenced by app_control_can_add_channel_to_bridge(), and app_control_can_remove_channel_from_bridge().
|
static |
Definition at line 339 of file control.c.
References ast_channel_clear_bridge_roles().
Referenced by stasis_app_control_clear_roles().
|
static |
Definition at line 377 of file control.c.
References ast_assert, ast_bridge_depart(), ast_explicit_goto(), stasis_app_control::channel, stasis_app_control_continue_data::context, control_mark_done(), stasis_app_control_continue_data::extension, NULL, stasis_app_control_continue_data::priority, and stasis_app_get_bridge().
Referenced by stasis_app_control_continue().
|
static |
Definition at line 1637 of file control.c.
References add_to_dial_bridge(), args, ast_bridge_setup_after_goto(), ast_call(), ast_channel_is_bridged(), ast_channel_lock, ast_channel_publish_dial(), ast_channel_unlock, AST_SOFTHANGUP_ASYNCGOTO, AST_SOFTHANGUP_DEV, ast_softhangup_nolock(), NULL, and set_timeout().
Referenced by stasis_app_control_dial().
|
static |
Definition at line 556 of file control.c.
References AST_CONTROL_PROGRESS, ast_indicate(), AST_STATE_UP, dtmf_in_bridge(), dtmf_no_bridge(), and stasis_app_get_bridge().
Referenced by stasis_app_control_dtmf().
|
static |
Definition at line 749 of file control.c.
References AST_CONTROL_HOLD, ast_indicate(), and stasis_app_control::channel.
Referenced by stasis_app_control_hold().
|
static |
Definition at line 775 of file control.c.
References AST_CONTROL_PROGRESS, ast_indicate(), ast_moh_start(), AST_STATE_UP, and NULL.
Referenced by stasis_app_control_moh_start().
|
static |
Definition at line 800 of file control.c.
References ast_moh_stop().
Referenced by stasis_app_control_moh_stop().
|
static |
Definition at line 423 of file control.c.
References stasis_app_control_move_data::app_args, stasis_app_control_move_data::app_name, ast_free, ast_log, ast_strdup, AST_VECTOR_APPEND, control_move_cleanup(), LOG_ERROR, stasis_app_control::next_app, and stasis_app_control::next_app_args.
Referenced by stasis_app_control_move().
|
static |
Definition at line 628 of file control.c.
References ast_channel_lock, ast_channel_suppress(), ast_channel_unlock, stasis_app_control::channel, stasis_app_control_mute_data::direction, and stasis_app_control_mute_data::frametype.
Referenced by stasis_app_control_mute().
|
static |
Definition at line 490 of file control.c.
References ast_assert, ast_channel_name(), ast_log, ast_transfer(), stasis_app_control::channel, LOG_NOTICE, and NULL.
Referenced by stasis_app_control_redirect().
|
static |
Definition at line 164 of file control.c.
References ao2_lock, ao2_unlock, AST_LIST_INSERT_TAIL, and stasis_app_control::command_queue.
Referenced by stasis_app_control_register_add_rule(), and stasis_app_control_register_remove_rule().
|
static |
Definition at line 1403 of file control.c.
References ast_debug, ast_log, depart_channel(), LOG_WARNING, stasis_app_control_get_channel_id(), stasis_app_get_bridge(), and ast_bridge::uniqueid.
Referenced by stasis_app_control_remove_channel_from_bridge().
|
static |
Definition at line 593 of file control.c.
References AST_CONTROL_RINGING, ast_indicate(), and stasis_app_control::channel.
Referenced by stasis_app_control_ring().
|
static |
Definition at line 608 of file control.c.
References ast_indicate(), and stasis_app_control::channel.
Referenced by stasis_app_control_ring_stop().
|
static |
Definition at line 710 of file control.c.
References stasis_app_control::channel, pbx_builtin_setvar_helper(), and var.
Referenced by stasis_app_control_set_channel_var().
|
static |
Definition at line 812 of file control.c.
References ast_channel_start_silence_generator(), ast_channel_stop_silence_generator(), AST_CONTROL_PROGRESS, ast_debug, ast_indicate(), ast_log, AST_STATE_UP, stasis_app_control::channel, LOG_WARNING, stasis_app_control::silgen, and stasis_app_control_get_channel_id().
Referenced by stasis_app_control_silence_start().
|
static |
Definition at line 857 of file control.c.
References control_silence_stop_now().
Referenced by stasis_app_control_silence_stop().
|
static |
Definition at line 762 of file control.c.
References AST_CONTROL_UNHOLD, ast_indicate(), and stasis_app_control::channel.
Referenced by stasis_app_control_unhold().
|
static |
Definition at line 656 of file control.c.
References ast_channel_lock, ast_channel_unlock, ast_channel_unsuppress(), stasis_app_control::channel, stasis_app_control_mute_data::direction, and stasis_app_control_mute_data::frametype.
Referenced by stasis_app_control_unmute().
|
static |
Definition at line 173 of file control.c.
References ao2_lock, ao2_unlock, AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, stasis_app_control::command_queue, and stasis_app_control_rule::next.
Referenced by stasis_app_control_unregister_add_rule(), and stasis_app_control_unregister_remove_rule().
|
static |
Definition at line 875 of file control.c.
References ao2_ref, command_join(), stasis_app_command::data, stasis_app_command::data_destructor, exec_command_on_condition(), stasis_app_control::is_done, and NULL.
Referenced by stasis_app_control_add_channel_to_bridge(), stasis_app_control_remove_channel_from_bridge(), and stasis_app_send_command().
|
static |
Definition at line 1172 of file control.c.
References AST_BRIDGE_AFTER_CB_REASON_DEPART, stasis_app_control::channel, and internal_bridge_after_cb().
Referenced by control_swap_channel_in_bridge().
|
static |
Definition at line 1179 of file control.c.
References ast_bridge_after_cb_reason_string(), ast_debug, stasis_app_control::channel, and internal_bridge_after_cb().
Referenced by control_swap_channel_in_bridge().
|
static |
Definition at line 1094 of file control.c.
References ast_channel_internal_bridge_channel(), ast_channel_lock, ast_channel_uniqueid(), ast_channel_unlock, ast_debug, ast_bridge_channel::chan, and depart_channel().
Referenced by dial_bridge_after_cb(), and internal_bridge_after_cb().
|
static |
Dial timeout.
This is a bridge interval hook callback. The interval hook triggering means that the dial timeout has been reached. If the channel has not been answered by the time this callback is called, then the channel is hung up
bridge_channel | Bridge channel on which interval hook has been called |
ignore | Ignored |
Definition at line 1224 of file control.c.
References ao2_cleanup, ast_channel_datastore_find(), ast_channel_datastore_remove(), ast_channel_lock, ast_channel_unlock, ast_datastore_free(), AST_STATE_UP, ast_bridge_channel::chan, hangup_channel(), NULL, RAII_VAR, stasis_app_control_find_by_channel(), stasis_app_send_command_async(), and timeout_datastore.
Referenced by set_interval_hook().
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().
|
static |
Definition at line 1582 of file control.c.
References args, ast_malloc, control_dial_args::dialstring, NULL, and control_dial_args::timeout.
Referenced by stasis_app_control_dial().
|
static |
Definition at line 1599 of file control.c.
References args, and ast_free.
Referenced by stasis_app_control_dial().
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().
|
static |
Definition at line 107 of file control.c.
References stasis_app_control::add_rules, ao2_cleanup, stasis_app_control::app, ast_bridge_features_destroy(), ast_channel_cleanup, ast_cond_destroy, AST_LIST_HEAD_DESTROY, stasis_app_control::bridge_features, stasis_app_control::channel, stasis_app_control::command_queue, control_move_cleanup(), stasis_app_control::remove_rules, and stasis_app_control::wait_cond.
Referenced by control_create().
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().
|
static |
Depart a channel from a bridge, and potentially add it back to the dial bridge.
control | Take a guess |
chan | Take another guess |
Definition at line 1078 of file control.c.
References add_to_dial_bridge(), ast_bridge_depart(), ast_channel_pbx(), ast_check_hangup(), and AST_STATE_UP.
Referenced by app_control_remove_channel_from_bridge(), and bridge_channel_depart().
|
static |
after bridge callback for the dial bridge
The only purpose of this callback is to ensure that the control structure's bridge pointer is NULLed
Definition at line 1018 of file control.c.
References __ao2_cleanup(), ast_channel_get_bridge_channel(), ast_channel_hangupcause(), ast_channel_lock, ast_channel_name(), ast_channel_unlock, ast_debug, stasis_app_control::bridge, bridge_channel_depart(), ast_bridge_channel::chan, stasis_app_control::channel, NULL, and stasis_app_send_command_async().
Referenced by add_to_dial_bridge(), and dial_bridge_after_cb_failed().
|
static |
Definition at line 1034 of file control.c.
References ast_channel_name(), ast_debug, stasis_app_control::channel, and dial_bridge_after_cb().
Referenced by add_to_dial_bridge().
|
static |
Definition at line 530 of file control.c.
References stasis_app_control_dtmf_data::after, ast_dtmf_stream_external(), stasis_app_control_dtmf_data::before, stasis_app_control_dtmf_data::between, stasis_app_control_dtmf_data::dtmf, and stasis_app_control_dtmf_data::duration.
Referenced by app_control_dtmf().
|
static |
Definition at line 543 of file control.c.
References stasis_app_control_dtmf_data::after, ast_dtmf_stream(), ast_safe_sleep(), stasis_app_control_dtmf_data::before, stasis_app_control_dtmf_data::between, stasis_app_control_dtmf_data::dtmf, stasis_app_control_dtmf_data::duration, and NULL.
Referenced by app_control_dtmf().
|
static |
Definition at line 310 of file control.c.
References stasis_app_command::data, stasis_app_command::data_destructor, exec_command_on_condition(), and NULL.
Referenced by stasis_app_send_command_async().
|
static |
Definition at line 269 of file control.c.
References ao2_link_flags, ao2_lock, ao2_ref, ao2_unlock, ast_cond_signal, ast_null_frame, ast_queue_frame(), stasis_app_control::channel, command_complete(), command_create(), stasis_app_control::command_queue, stasis_app_command::data, stasis_app_command::data_destructor, stasis_app_control::is_done, noop_cb(), NULL, OBJ_NOLOCK, retval, and stasis_app_control::wait_cond.
Referenced by app_send_command_on_condition(), and exec_command().
|
static |
|
static |
Retrieve a reference to the dial bridge.
If the dial bridge has not been created yet, it will be created, otherwise, a reference to the existing bridge will be returned.
The caller will need to unreference the dial bridge once they are finished with it.
NULL | Unable to find/create the dial bridge |
non-NULL | A reference to the dial bridge |
Definition at line 983 of file control.c.
References ao2_bump, ast_mutex_lock, ast_mutex_unlock, dial_bridge, dial_bridge_lock, end, NULL, shutting_down, and stasis_app_bridge_create_invisible().
Referenced by add_to_dial_bridge().
|
static |
Definition at line 1205 of file control.c.
References ast_softhangup(), and AST_SOFTHANGUP_EXPLICIT.
Referenced by bridge_timeout().
|
static |
Definition at line 1117 of file control.c.
References __ao2_cleanup(), ao2_lock, ao2_unlock, stasis_app_control::app, app_unsubscribe_bridge(), ast_assert, AST_BRIDGE_AFTER_CB_REASON_IMPART_FAILED, ast_bridge_after_cb_reason_string(), ast_bridge_setup_after_goto(), ast_channel_get_bridge_channel(), ast_channel_lock, ast_channel_pbx_set(), ast_channel_uniqueid(), ast_channel_unlock, ast_debug, AST_SOFTHANGUP_ASYNCGOTO, AST_SOFTHANGUP_DEV, ast_softhangup_nolock(), stasis_app_control::bridge, bridge_channel_depart(), ast_bridge_channel::chan, stasis_app_control::channel, NULL, stasis_app_control::pbx, stasis_app_channel_is_stasis_end_published(), stasis_app_send_command_async(), and ast_bridge::uniqueid.
Referenced by bridge_after_cb(), and bridge_after_cb_failed().
|
static |
Definition at line 259 of file control.c.
Referenced by exec_command_on_condition().
|
static |
Set a dial timeout interval hook on the channel.
The absolute time that the timeout should occur is stored on a datastore on the channel. This time is converted into a relative number of milliseconds in the future. Then an interval hook is set to trigger in that number of milliseconds.
chan | The channel on which to set the interval hook |
Definition at line 1263 of file control.c.
References ao2_ref, ast_bridge_interval_hook(), ast_channel_datastore_find(), ast_channel_get_bridge_channel(), ast_null_frame, ast_queue_frame(), ast_tvdiff_ms(), ast_tvnow(), bridge_timeout(), ast_bridge_channel::chan, ast_datastore::data, ast_bridge_channel::features, NULL, and timeout_datastore.
Referenced by control_swap_channel_in_bridge(), and set_timeout().
|
static |
Set dial timeout on a channel to be dialed.
chan | The channel on which to set the dial timeout |
timeout | The timeout in seconds |
Definition at line 1612 of file control.c.
References ast_channel_datastore_add(), ast_channel_is_bridged(), ast_channel_lock, ast_channel_unlock, ast_datastore_alloc, ast_malloc, ast_samp2tv(), ast_tvadd(), ast_tvnow(), ast_datastore::data, NULL, set_interval_hook(), and timeout_datastore.
Referenced by app_control_dial().
void stasis_app_control_absorb_dtmf_in_bridge | ( | struct stasis_app_control * | control, |
int | absorb | ||
) |
Set whether DTMF from the channel is absorbed instead of passing through to the bridge.
control | Control whose channel should have its DTMF absorbed when bridged |
absorb | Whether DTMF should be absorbed (1) instead of passed through (0). |
Definition at line 1473 of file control.c.
References stasis_app_control::bridge_features, and ast_bridge_features::dtmf_passthrough.
Referenced by ast_ari_bridges_add_channel().
int stasis_app_control_add_channel_to_bridge | ( | struct stasis_app_control * | control, |
struct ast_bridge * | bridge | ||
) |
Add a channel to the bridge.
control | Control whose channel should be added to the bridge |
bridge | Pointer to the bridge |
Definition at line 1392 of file control.c.
References app_control_can_add_channel_to_bridge(), app_send_command_on_condition(), ast_debug, control_add_channel_to_bridge(), NULL, and stasis_app_control_get_channel_id().
Referenced by ast_ari_bridges_add_channel().
int stasis_app_control_add_role | ( | struct stasis_app_control * | control, |
const char * | role | ||
) |
Apply a bridge role to a channel controlled by a stasis app control.
control | Control for res_stasis |
role | Role to apply |
Definition at line 325 of file control.c.
References app_control_add_role(), ast_free_ptr(), ast_strdup, and stasis_app_send_command_async().
Referenced by ast_ari_bridges_add_channel().
int stasis_app_control_bridge_features_init | ( | struct stasis_app_control * | control | ) |
Initialize bridge features into a channel control.
control | Control in which to store the features |
Definition at line 1460 of file control.c.
References ast_bridge_features_new(), and stasis_app_control::bridge_features.
Referenced by ast_ari_bridges_add_channel().
void stasis_app_control_clear_roles | ( | struct stasis_app_control * | control | ) |
Clear bridge roles currently applied to a channel controlled by a stasis app control.
control | Control for res_stasis |
Definition at line 347 of file control.c.
References app_control_clear_roles(), NULL, and stasis_app_send_command_async().
Referenced by ast_ari_bridges_add_channel().
int stasis_app_control_continue | ( | struct stasis_app_control * | control, |
const char * | context, | ||
const char * | extension, | ||
int | priority | ||
) |
Exit res_stasis
and continue execution in the dialplan.
If the channel is no longer in res_stasis
, this function does nothing.
control | Control for res_stasis |
context | An optional context to continue to |
extension | An optional extension to continue to |
priority | An optional priority to continue to |
Definition at line 398 of file control.c.
References app_control_continue(), ast_calloc, ast_copy_string(), ast_free_ptr(), voicemailpwcheck::context, stasis_app_control_continue_data::context, stasis_app_control_continue_data::extension, priority, stasis_app_control_continue_data::priority, S_OR, and stasis_app_send_command_async().
Referenced by ast_ari_channels_continue_in_dialplan().
int stasis_app_control_dial | ( | struct stasis_app_control * | control, |
const char * | dialstring, | ||
unsigned int | timeout | ||
) |
Dial a channel.
control | Control for res_stasis . |
dialstring | The dialstring to pass to the channel driver |
timeout | Optional timeout in milliseconds |
Definition at line 1675 of file control.c.
References app_control_dial(), args, control_dial_args_alloc(), control_dial_args_destroy(), control_dial_args::dialstring, stasis_app_send_command_async(), and control_dial_args::timeout.
Referenced by ast_ari_channels_dial().
int stasis_app_control_dtmf | ( | struct stasis_app_control * | control, |
const char * | dtmf, | ||
int | before, | ||
int | between, | ||
unsigned int | duration, | ||
int | after | ||
) |
Send DTMF to the channel associated with this control.
control | Control for res_stasis . |
dtmf | DTMF string. |
before | Amount of time to wait before sending DTMF digits. |
between | Amount of time between each DTMF digit. |
duration | Amount of time each DTMF digit lasts for. |
after | Amount of time to wait after sending DTMF digits. |
Definition at line 574 of file control.c.
References stasis_app_control_dtmf_data::after, app_control_dtmf(), ast_calloc, ast_free_ptr(), stasis_app_control_dtmf_data::before, stasis_app_control_dtmf_data::between, stasis_app_control_dtmf_data::dtmf, stasis_app_control_dtmf_data::duration, and stasis_app_send_command_async().
Referenced by ast_ari_channels_send_dtmf().
const char * stasis_app_control_get_channel_id | ( | const struct stasis_app_control * | control | ) |
Returns the uniqueid of the channel associated with this control.
control | Control object. |
NULL | if control is NULL . |
Definition at line 1439 of file control.c.
References ast_channel_uniqueid(), and stasis_app_control::channel.
Referenced by app_control_answer(), app_control_remove_channel_from_bridge(), app_control_silence_start(), check_add_remove_channel(), control_compare(), control_hash(), control_silence_stop_now(), control_swap_channel_in_bridge(), masq_match_cb(), playback_publish(), recording_publish(), stasis_app_control_add_channel_to_bridge(), stasis_app_control_answer(), stasis_app_control_get_snapshot(), stasis_app_control_play_uri(), stasis_app_control_record(), and stasis_app_control_remove_channel_from_bridge().
struct ast_channel_snapshot * stasis_app_control_get_snapshot | ( | const struct stasis_app_control * | control | ) |
Returns the most recent snapshot for the associated channel.
The returned pointer is AO2 managed, so ao2_cleanup() when you're done.
control | Control for res_stasis . |
NULL | if channel isn't in cache. |
Definition at line 869 of file control.c.
References ast_channel_snapshot_get_latest(), and stasis_app_control_get_channel_id().
Referenced by ari_bridges_play_helper(), ari_channels_handle_play(), ast_ari_channels_continue_in_dialplan(), and channel_state_invalid().
void stasis_app_control_hold | ( | struct stasis_app_control * | control | ) |
Place the channel associated with the control on hold.
control | Control for res_stasis . |
Definition at line 757 of file control.c.
References app_control_hold(), NULL, and stasis_app_send_command_async().
Referenced by ast_ari_channels_hold().
void stasis_app_control_inhibit_colp_in_bridge | ( | struct stasis_app_control * | control, |
int | inhibit_colp | ||
) |
Set whether COLP frames should be generated when joining the bridge.
control | Control whose channel should have its COLP frames inhibited when bridged |
inhibit_colp | Whether COLP frames should be generated (0) or not (1). |
Definition at line 1485 of file control.c.
References stasis_app_control::bridge_features, and ast_bridge_features::inhibit_colp.
Referenced by ast_ari_bridges_add_channel().
void stasis_app_control_moh_start | ( | struct stasis_app_control * | control, |
const char * | moh_class | ||
) |
Play music on hold to a channel (does not affect hold status)
control | Control for res_stasis . |
moh_class | class of music on hold to play (NULL allowed) |
Definition at line 789 of file control.c.
References app_control_moh_start(), ast_free_ptr(), ast_strdup, ast_strlen_zero(), NULL, and stasis_app_send_command_async().
Referenced by ast_ari_channels_start_moh().
void stasis_app_control_moh_stop | ( | struct stasis_app_control * | control | ) |
Stop playing music on hold to a channel (does not affect hold status)
control | Control for res_stasis . |
Definition at line 807 of file control.c.
References app_control_moh_stop(), NULL, and stasis_app_send_command_async().
Referenced by ast_ari_channels_stop_moh().
int stasis_app_control_move | ( | struct stasis_app_control * | control, |
const char * | app_name, | ||
const char * | app_args | ||
) |
Exit res_stasis
and move to another Stasis application.
If the channel is no longer in res_stasis
, this function does nothing.
control | Control for res_stasis |
app_name | The name of the application to switch to |
app_args | The list of arguments to pass to the application |
Definition at line 460 of file control.c.
References stasis_app_control_move_data::app_args, app_control_move(), app_name(), stasis_app_control_move_data::app_name, ast_calloc, ast_free_ptr(), NULL, and stasis_app_send_command_async().
Referenced by ast_ari_channels_move().
int stasis_app_control_mute | ( | struct stasis_app_control * | control, |
unsigned int | direction, | ||
enum ast_frame_type | frametype | ||
) |
Mute the channel associated with this control.
control | Control for res_stasis . |
direction | The direction in which the audio should be muted. |
frametype | The type of stream that should be muted. |
Definition at line 640 of file control.c.
References app_control_mute(), ast_calloc, ast_free_ptr(), stasis_app_control_mute_data::direction, stasis_app_control_mute_data::frametype, and stasis_app_send_command_async().
Referenced by ast_ari_channels_mute().
void stasis_app_control_mute_in_bridge | ( | struct stasis_app_control * | control, |
int | mute | ||
) |
Set whether audio from the channel is muted instead of passing through to the bridge.
control | Control whose channel should have its audio muted when bridged |
mute | Whether audio should be muted (1) instead of passed through (0). |
Definition at line 1479 of file control.c.
References stasis_app_control::bridge_features, and ast_bridge_features::mute.
Referenced by ast_ari_bridges_add_channel().
void stasis_app_control_publish | ( | struct stasis_app_control * | control, |
struct stasis_message * | message | ||
) |
Publish a message to the control's channel's topic.
control | Control to publish to |
message | Message to publish |
Definition at line 1445 of file control.c.
References ast_channel_topic(), stasis_app_control::channel, and stasis_publish().
Referenced by playback_publish(), and recording_publish().
int stasis_app_control_queue_control | ( | struct stasis_app_control * | control, |
enum ast_control_frame_type | frame_type | ||
) |
Queue a control frame without payload.
control | Control to publish to. |
frame_type | type of control frame. |
Definition at line 1454 of file control.c.
References ast_queue_control(), and stasis_app_control::channel.
Referenced by playback_forward(), playback_pause(), playback_restart(), playback_reverse(), playback_stop(), playback_unpause(), recording_cancel(), recording_pause(), recording_stop(), recording_unpause(), and toggle_recording_mute().
int stasis_app_control_redirect | ( | struct stasis_app_control * | control, |
const char * | endpoint | ||
) |
Redirect a channel in res_stasis
to a particular endpoint.
control | Control for res_stasis |
endpoint | The endpoint transfer string where the channel should be sent to |
Definition at line 509 of file control.c.
References app_control_redirect(), ast_free_ptr(), ast_strdup, and stasis_app_send_command_async().
Referenced by ast_ari_channels_redirect().
void stasis_app_control_register_add_rule | ( | struct stasis_app_control * | control, |
struct stasis_app_control_rule * | rule | ||
) |
Registers an add channel to bridge rule.
control | Control object |
rule | The rule to register |
Definition at line 219 of file control.c.
References stasis_app_control::add_rules, and app_control_register_rule().
Referenced by stasis_app_control_record().
void stasis_app_control_register_remove_rule | ( | struct stasis_app_control * | control, |
struct stasis_app_control_rule * | rule | ||
) |
Registers a remove channel from bridge rule.
control | Control object |
rule | The rule to register |
Definition at line 233 of file control.c.
References app_control_register_rule(), and stasis_app_control::remove_rules.
int stasis_app_control_remove_channel_from_bridge | ( | struct stasis_app_control * | control, |
struct ast_bridge * | bridge | ||
) |
Remove a channel from the bridge.
control | Control whose channel should be removed from the bridge |
bridge | Pointer to the bridge |
Definition at line 1429 of file control.c.
References app_control_can_remove_channel_from_bridge(), app_control_remove_channel_from_bridge(), app_send_command_on_condition(), ast_debug, NULL, and stasis_app_control_get_channel_id().
Referenced by ast_ari_bridges_remove_channel().
int stasis_app_control_ring | ( | struct stasis_app_control * | control | ) |
Indicate ringing to the channel associated with this control.
control | Control for res_stasis . |
Definition at line 601 of file control.c.
References app_control_ring(), NULL, and stasis_app_send_command_async().
Referenced by ast_ari_channels_ring().
int stasis_app_control_ring_stop | ( | struct stasis_app_control * | control | ) |
Stop locally generated ringing on the channel associated with this control.
control | Control for res_stasis . |
Definition at line 616 of file control.c.
References app_control_ring_stop(), NULL, and stasis_app_send_command_async().
Referenced by ast_ari_channels_ring_stop().
int stasis_app_control_set_channel_var | ( | struct stasis_app_control * | control, |
const char * | variable, | ||
const char * | value | ||
) |
Set a variable on the channel associated with this control to value.
control | Control for res_stasis . |
variable | The name of the variable |
value | The value to set the variable to |
Definition at line 720 of file control.c.
References app_control_set_channel_var(), ast_calloc, ast_strdup, free_chanvar(), stasis_app_send_command_async(), value, and var.
Referenced by ast_ari_channels_set_channel_var().
void stasis_app_control_shutdown | ( | void | ) |
Let Stasis app internals shut down.
This is called when res_stasis is unloaded. It ensures that the Stasis app internals can free any resources they may have allocated during the time that res_stasis was loaded.
Definition at line 1689 of file control.c.
References ast_bridge_destroy(), ast_mutex_lock, ast_mutex_unlock, dial_bridge, dial_bridge_lock, NULL, and shutting_down.
Referenced by unload_module().
void stasis_app_control_silence_start | ( | struct stasis_app_control * | control | ) |
Start playing silence to a channel.
control | Control for res_stasis . |
Definition at line 841 of file control.c.
References app_control_silence_start(), NULL, and stasis_app_send_command_async().
Referenced by ast_ari_channels_start_silence().
void stasis_app_control_silence_stop | ( | struct stasis_app_control * | control | ) |
Stop playing silence to a channel.
control | Control for res_stasis . |
Definition at line 864 of file control.c.
References app_control_silence_stop(), NULL, and stasis_app_send_command_async().
Referenced by ast_ari_channels_stop_silence().
void stasis_app_control_unhold | ( | struct stasis_app_control * | control | ) |
Remove the channel associated with the control from hold.
control | Control for res_stasis . |
Definition at line 770 of file control.c.
References app_control_unhold(), NULL, and stasis_app_send_command_async().
Referenced by ast_ari_channels_unhold().
int stasis_app_control_unmute | ( | struct stasis_app_control * | control, |
unsigned int | direction, | ||
enum ast_frame_type | frametype | ||
) |
Unmute the channel associated with this control.
control | Control for res_stasis . |
direction | The direction in which the audio should be unmuted. |
frametype | The type of stream that should be unmuted. |
Definition at line 668 of file control.c.
References app_control_unmute(), ast_calloc, ast_free_ptr(), stasis_app_control_mute_data::direction, stasis_app_control_mute_data::frametype, and stasis_app_send_command_async().
Referenced by ast_ari_channels_unmute().
void stasis_app_control_unregister_add_rule | ( | struct stasis_app_control * | control, |
struct stasis_app_control_rule * | rule | ||
) |
UnRegister an add channel to bridge rule.
control | Control object |
rule | The rule to unregister |
Definition at line 226 of file control.c.
References stasis_app_control::add_rules, and app_control_unregister_rule().
Referenced by record_file(), and recording_fail().
void stasis_app_control_unregister_remove_rule | ( | struct stasis_app_control * | control, |
struct stasis_app_control_rule * | rule | ||
) |
Unregisters a remove channel from bridge rule.
control | Control object |
rule | The rule to unregister |
Definition at line 240 of file control.c.
References app_control_unregister_rule(), and stasis_app_control::remove_rules.
struct ast_bridge * stasis_app_get_bridge | ( | struct stasis_app_control * | control | ) |
Gets the bridge currently associated with a control object.
control | Control object for the channel to query. |
NULL | if not associated with a bridge. |
Definition at line 940 of file control.c.
References ao2_lock, ao2_unlock, stasis_app_control::bridge, and NULL.
Referenced by app_control_continue(), app_control_dtmf(), app_control_remove_channel_from_bridge(), ast_ari_bridges_remove_channel(), ast_ari_bridges_set_video_source(), control_swap_channel_in_bridge(), play_uri(), record_file(), and stasis_app_exec().
int stasis_app_send_command | ( | struct stasis_app_control * | control, |
stasis_app_command_cb | command, | ||
void * | data, | ||
command_data_destructor_fn | data_destructor | ||
) |
Invokes a command on a control's channel.
This function dispatches the command to be executed in the context of stasis_app_exec(), so this command will block waiting for the results of the command.
control | Control object for the channel to send the command to. |
command | Command function to execute. |
data | Optional data to pass along with the control function. |
data_destructor | Optional function which will be called on the data in either the event of command completion or failure to schedule or complete the command |
Definition at line 907 of file control.c.
References app_send_command_on_condition(), stasis_app_command::data, stasis_app_command::data_destructor, and NULL.
Referenced by ast_ari_bridges_set_video_source(), and stasis_app_control_answer().
int stasis_app_send_command_async | ( | struct stasis_app_control * | control, |
stasis_app_command_cb | command, | ||
void * | data, | ||
command_data_destructor_fn | data_destructor | ||
) |
Asynchronous version of stasis_app_send_command().
This function enqueues a command for execution, but returns immediately without waiting for the response.
control | Control object for the channel to send the command to. |
command | Command function to execute. |
data | Optional data to pass along with the control function. |
data_destructor | Optional function which will be called on the data in either the event of command completion or failure to schedule or complete the command |
Definition at line 913 of file control.c.
References ao2_ref, stasis_app_command::data, stasis_app_command::data_destructor, exec_command(), stasis_app_control::is_done, and NULL.
Referenced by bridge_timeout(), dial_bridge_after_cb(), internal_bridge_after_cb(), stasis_app_control_add_role(), stasis_app_control_clear_roles(), stasis_app_control_continue(), stasis_app_control_dial(), stasis_app_control_dtmf(), stasis_app_control_hold(), stasis_app_control_moh_start(), stasis_app_control_moh_stop(), stasis_app_control_move(), stasis_app_control_mute(), stasis_app_control_play_uri(), stasis_app_control_record(), stasis_app_control_redirect(), stasis_app_control_ring(), stasis_app_control_ring_stop(), stasis_app_control_set_channel_var(), stasis_app_control_silence_start(), stasis_app_control_silence_stop(), stasis_app_control_unhold(), and stasis_app_control_unmute().
|
static |
Singleton dial bridge.
The dial bridge is a holding bridge used to hold all outbound dialed channels that are not in any "real" ARI-created bridge. The dial bridge is invisible, meaning that it does not show up in channel snapshots, AMI or ARI output, and no events get raised for it.
This is used to keep dialed channels confined to the bridging system and unify the threading model used for dialing outbound channels.
Definition at line 967 of file control.c.
Referenced by get_dial_bridge(), and stasis_app_control_shutdown().
|
static |
Definition at line 968 of file control.c.
Referenced by get_dial_bridge(), and stasis_app_control_shutdown().
|
static |
Indicates if the Stasis app internals are being shut down.
Definition at line 51 of file control.c.
Referenced by get_dial_bridge(), and stasis_app_control_shutdown().
struct ast_datastore_info timeout_datastore |
Dial timeout datastore.
A datastore is used because a channel may change bridges during the course of a dial attempt. This may be because the channel changes from the dial bridge to a standard bridge, or it may move between standard bridges. In order to keep the dial timeout, we need to keep the timeout information local to the channel. That is what this datastore is for
Definition at line 1201 of file control.c.
Referenced by bridge_timeout(), set_interval_hook(), and set_timeout().