Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Backend API for implementing components of res_stasis. More...
#include "asterisk/stasis_app.h"
Go to the source code of this file.
Typedefs | |
typedef void(* | command_data_destructor_fn) (void *data) |
Typedef for data destructor for stasis app commands. More... | |
typedef int(* | stasis_app_command_cb) (struct stasis_app_control *control, struct ast_channel *chan, void *data) |
Functions | |
int | stasis_app_exec (struct ast_channel *chan, const char *app_name, int argc, char *argv[]) |
Control a channel using stasis_app . More... | |
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. More... | |
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(). More... | |
Backend API for implementing components of res_stasis.
This file defines functions useful for defining new commands to execute on channels while they are in Stasis.
Definition in file stasis_app_impl.h.
typedef void(* command_data_destructor_fn) (void *data) |
Typedef for data destructor for stasis app commands.
This is called during destruction of the command or if we fail to schedule a command. It is passed a pointer to the user-defined data of the command.
data | Data to destroy. |
Definition at line 59 of file stasis_app_impl.h.
typedef int(* stasis_app_command_cb) (struct stasis_app_control *control, struct ast_channel *chan, void *data) |
Callback type for stasis app commands
Definition at line 62 of file stasis_app_impl.h.
int stasis_app_exec | ( | struct ast_channel * | chan, |
const char * | app_name, | ||
int | argc, | ||
char * | argv[] | ||
) |
Control a channel using stasis_app
.
This function blocks until the channel hangs up, or stasis_app_control_continue() is called on the channel's stasis_app_control struct.
chan | Channel to control with Stasis. |
app_name | Application controlling the channel. |
argc | Number of arguments for the application. |
argv | Arguments for the application. |
Control a channel using stasis_app
.
Definition at line 1327 of file res_stasis.c.
References add_masquerade_store(), ao2_bump, ao2_cleanup, ao2_find, ao2_link, ao2_ref, app, app_controls, app_is_active(), app_name(), app_send(), app_send_end_msg(), app_subscribe_bridge(), app_unsubscribe_bridge(), apps_registry, ast_assert, ast_bridge_depart(), ast_channel_clear_softhangup(), ast_channel_fdno(), ast_channel_internal_bridge_channel(), ast_channel_lock, ast_channel_name(), ast_channel_pbx(), ast_channel_snapshot_get_latest(), ast_channel_snapshot_to_json(), ast_channel_uniqueid(), ast_channel_unlock, ast_check_hangup(), ast_check_hangup_locked(), AST_CONTROL_HANGUP, ast_debug, AST_FRAME_CONTROL, ast_frame_dtor(), ast_free, ast_json_array_append(), ast_json_object_get(), ast_json_pack(), ast_json_string_create(), ast_json_timeval(), ast_json_unref(), ast_log, ast_pbx_run_args(), ast_read(), AST_SOFTHANGUP_ASYNCGOTO, ast_tvnow(), ast_waitfor(), cleanup(), control_app(), control_create(), control_dispatch_all(), control_flush_queue(), control_is_done(), control_mark_done(), control_move_cleanup(), control_next_app(), control_next_app_args(), control_next_app_args_size(), control_prestart_dispatch_all(), control_set_app(), control_silence_stop_now(), control_unlink(), control_wait(), has_masquerade_store(), LOG_ERROR, MAX_WAIT_MS, ast_pbx_args::no_hangup_chan, NULL, OBJ_SEARCH_KEY, RAII_VAR, remove_masquerade_store(), remove_stasis_end_published(), send_start_msg(), stasis_app_channel_is_stasis_end_published(), stasis_app_get_bridge(), and stasis_app_name().
Referenced by 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().