Asterisk - The Open Source Telephony Project GIT-master-d856a3e
|
Stasis application support. More...
#include "asterisk.h"
#include "asterisk/astobj2.h"
#include "asterisk/callerid.h"
#include "asterisk/module.h"
#include "asterisk/stasis_app_impl.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/stasis_bridges.h"
#include "asterisk/stasis_endpoints.h"
#include "asterisk/stasis_message_router.h"
#include "asterisk/strings.h"
#include "stasis/app.h"
#include "stasis/control.h"
#include "stasis/messaging.h"
#include "stasis/stasis_bridge.h"
#include "asterisk/core_unreal.h"
#include "asterisk/musiconhold.h"
#include "asterisk/causes.h"
#include "asterisk/stringfields.h"
#include "asterisk/bridge_after.h"
#include "asterisk/format_cache.h"
Go to the source code of this file.
Data Structures | |
struct | event_sources |
struct | replace_channel_store |
struct | start_message_blob |
struct | stasis_app_bridge_channel_wrapper |
Macros | |
#define | APPS_NUM_BUCKETS 127 |
Number of buckets for the Stasis application hash table. Remember to keep it a prime number! More... | |
#define | BRIDGES_NUM_BUCKETS 127 |
Number of buckets for the Stasis bridges hash table. Remember to keep it a prime number! More... | |
#define | CONTROLS_NUM_BUCKETS 127 |
Number of buckets for the Stasis application hash table. Remember to keep it a prime number! More... | |
#define | MAX_WAIT_MS 200 |
Typedefs | |
typedef enum stasis_app_subscribe_res(* | app_subscription_handler) (struct stasis_app *app, const char *uri, struct stasis_app_event_source *event_source) |
Functions | |
static void | __reg_module (void) |
static int | __stasis_app_register (const char *app_name, stasis_app_cb handler, void *data, int all_events) |
static void | __unreg_module (void) |
static int | add_masquerade_store (struct ast_channel *chan) |
static int | app_compare (void *obj, void *arg, int flags) |
static struct stasis_app_event_source * | app_event_source_find (const char *uri) |
static struct ast_json * | app_event_sources_to_json (const struct stasis_app *app, struct ast_json *json) |
char * | app_get_replace_channel_app (struct ast_channel *chan) |
Get the app that the replacement channel will be controlled by. More... | |
static enum stasis_app_subscribe_res | app_handle_subscriptions (const char *app_name, const char **event_source_uris, int event_sources_count, struct ast_json **json, app_subscription_handler handler) |
static int | app_hash (const void *obj, const int flags) |
int | app_send_end_msg (struct stasis_app *app, struct ast_channel *chan) |
Send StasisEnd message to the listening app. More... | |
int | app_set_replace_channel_app (struct ast_channel *chan, const char *replace_app) |
Set the app that the replacement channel will be controlled by. More... | |
int | app_set_replace_channel_snapshot (struct ast_channel *chan, struct ast_channel_snapshot *replace_snapshot) |
Set the snapshot of the channel that this channel will replace. More... | |
static enum stasis_app_subscribe_res | app_subscribe (struct stasis_app *app, const char *uri, struct stasis_app_event_source *event_source) |
static enum stasis_app_subscribe_res | app_unsubscribe (struct stasis_app *app, const char *uri, struct stasis_app_event_source *event_source) |
static int | append_name (void *obj, void *arg, int flags) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static struct ast_bridge * | bridge_create_common (const char *type, const char *name, const char *id, int invisible) |
static struct ast_channel * | bridge_moh_create (struct ast_bridge *bridge) |
static int | bridges_channel_compare (void *obj, void *arg, int flags) |
static int | bridges_channel_hash_fn (const void *obj, const int flags) |
static int | bridges_channel_sort_fn (const void *obj_left, const void *obj_right, const int flags) |
static int | bridges_compare (void *obj, void *arg, int flags) |
static int | bridges_hash (const void *obj, const int flags) |
static int | channel_id_sanitizer (const char *id) |
Sanitization callback for channel unique IDs. More... | |
static void | channel_replaced_cb (void *data, struct ast_channel *old_chan, struct ast_channel *new_chan) |
static int | channel_sanitizer (const struct ast_channel *chan) |
Sanitization callback for channels. More... | |
static int | channel_snapshot_sanitizer (const struct ast_channel_snapshot *snapshot) |
Sanitization callback for channel snapshots. More... | |
static void | channel_stolen_cb (void *data, struct ast_channel *old_chan, struct ast_channel *new_chan) |
static void | cleanup (void) |
Clean up any old apps that we don't need any more. More... | |
static int | cleanup_cb (void *obj, void *arg, int flags) |
static int | control_compare (void *obj, void *arg, int flags) |
static int | control_hash (const void *obj, const int flags) |
static void | control_unlink (struct stasis_app_control *control) |
In addition to running ao2_cleanup(), this function also removes the object from the app_controls container. More... | |
static struct stasis_app * | find_app_by_name (const char *app_name) |
static struct ast_channel_snapshot * | get_replace_channel_snapshot (struct ast_channel *chan) |
static struct replace_channel_store * | get_replace_channel_store (struct ast_channel *chan, int no_create) |
static int | has_masquerade_store (struct ast_channel *chan) |
static int | load_module (void) |
static int | masq_match_cb (void *obj, void *data, int flags) |
static void * | moh_channel_thread (void *data) |
static void | playback_after_bridge_cb (struct ast_channel *chan, void *data) |
static void | playback_after_bridge_cb_failed (enum ast_bridge_after_cb_reason reason, void *data) |
static struct ast_channel * | prepare_bridge_moh_channel (void) |
static void | remove_bridge_playback (char *bridge_id) |
static void | remove_masquerade_store (struct ast_channel *chan) |
static void | remove_stasis_end_published (struct ast_channel *chan) |
static void | replace_channel_destroy (void *obj) |
static int | send_start_msg (struct stasis_app *app, struct ast_channel *chan, int argc, char *argv[]) |
static int | send_start_msg_snapshots (struct ast_channel *chan, struct stasis_app *app, int argc, char *argv[], struct ast_channel_snapshot *snapshot, struct ast_channel_snapshot *replace_channel_snapshot) |
static int | set_internal_datastore (struct ast_channel *chan) |
static void | start_message_blob_dtor (void *obj) |
static void | stasis_app_bridge_channel_wrapper_destructor (void *obj) |
struct ast_bridge * | stasis_app_bridge_create (const char *type, const char *name, const char *id) |
Create a bridge of the specified type. More... | |
struct ast_bridge * | stasis_app_bridge_create_invisible (const char *type, const char *name, const char *id) |
Create an invisible bridge of the specified type. More... | |
void | stasis_app_bridge_destroy (const char *bridge_id) |
Destroy the bridge. More... | |
struct ast_bridge * | stasis_app_bridge_find_by_id (const char *bridge_id) |
Returns the bridge with the given id. More... | |
struct ast_channel * | stasis_app_bridge_moh_channel (struct ast_bridge *bridge) |
Finds or creates an announcer channel in a bridge that can play music on hold. More... | |
int | stasis_app_bridge_moh_stop (struct ast_bridge *bridge) |
Breaks down MOH channels playing on the bridge created by stasis_app_bridge_moh_channel. More... | |
int | stasis_app_bridge_playback_channel_add (struct ast_bridge *bridge, struct ast_channel *chan, struct stasis_app_control *control) |
Adds a channel to the list of ARI playback channels for bridges. More... | |
struct ast_channel * | stasis_app_bridge_playback_channel_find (struct ast_bridge *bridge) |
Finds an existing ARI playback channel in a bridge. More... | |
void | stasis_app_bridge_playback_channel_remove (char *bridge_id, struct stasis_app_control *control) |
remove channel from list of ARI playback channels for bridges. More... | |
int | stasis_app_channel_is_internal (struct ast_channel *chan) |
Is this channel internal to Stasis? More... | |
int | stasis_app_channel_is_stasis_end_published (struct ast_channel *chan) |
Has this channel had a StasisEnd published on it? More... | |
int | stasis_app_channel_set_internal (struct ast_channel *chan) |
Mark this channel as being internal to Stasis. More... | |
void | stasis_app_channel_set_stasis_end_published (struct ast_channel *chan) |
Indicate that this channel has had a StasisEnd published for it. More... | |
int | stasis_app_channel_unreal_set_internal (struct ast_channel *chan) |
Mark this unreal channel and it's other half as being internal to Stasis. More... | |
struct stasis_app_control * | stasis_app_control_create (struct ast_channel *chan) |
Creates a control handler for a channel that isn't in a stasis app. More... | |
void | stasis_app_control_execute_until_exhausted (struct ast_channel *chan, struct stasis_app_control *control) |
Act on a stasis app control queue until it is empty. More... | |
struct stasis_app_control * | stasis_app_control_find_by_channel (const struct ast_channel *chan) |
Returns the handler for the given channel. More... | |
struct stasis_app_control * | stasis_app_control_find_by_channel_id (const char *channel_id) |
Returns the handler for the channel with the given id. More... | |
void | stasis_app_control_flush_queue (struct stasis_app_control *control) |
Flush the control command queue. More... | |
int | stasis_app_control_is_done (struct stasis_app_control *control) |
Check if a control is marked as done. More... | |
int | stasis_app_exec (struct ast_channel *chan, const char *app_name, int argc, char *argv[]) |
Stasis dialplan application callback. More... | |
struct ao2_container * | stasis_app_get_all (void) |
Gets the names of all registered Stasis applications. More... | |
struct stasis_app * | stasis_app_get_by_name (const char *name) |
Retrieve a handle to a Stasis application by its name. More... | |
struct stasis_message_sanitizer * | stasis_app_get_sanitizer (void) |
Get the Stasis message sanitizer for app_stasis applications. More... | |
struct ast_json * | stasis_app_object_to_json (struct stasis_app *app) |
Return the JSON representation of a Stasis application. More... | |
int | stasis_app_register (const char *app_name, stasis_app_cb handler, void *data) |
Register a new Stasis application. More... | |
int | stasis_app_register_all (const char *app_name, stasis_app_cb handler, void *data) |
Register a new Stasis application that receives all Asterisk events. More... | |
void | stasis_app_register_event_source (struct stasis_app_event_source *obj) |
Register an application event source. More... | |
int | stasis_app_send (const char *app_name, struct ast_json *message) |
Send a message to the given Stasis application. More... | |
enum stasis_app_subscribe_res | stasis_app_subscribe (const char *app_name, const char **event_source_uris, int event_sources_count, struct ast_json **json) |
Subscribes an application to a list of event sources. More... | |
enum stasis_app_subscribe_res | stasis_app_subscribe_channel (const char *app_name, struct ast_channel *chan) |
Directly subscribe an application to a channel. More... | |
struct ast_json * | stasis_app_to_json (const char *app_name) |
Return the JSON representation of a Stasis application. More... | |
void | stasis_app_unregister (const char *app_name) |
Unregister a Stasis application. More... | |
void | stasis_app_unregister_event_source (struct stasis_app_event_source *obj) |
Unregister an application event source. More... | |
enum stasis_app_subscribe_res | stasis_app_unsubscribe (const char *app_name, const char **event_source_uris, int event_sources_count, struct ast_json **json) |
Unsubscribes an application from a list of event sources. More... | |
enum stasis_app_user_event_res | stasis_app_user_event (const char *app_name, const char *event_name, const char **source_uris, int sources_count, struct ast_json *json_variables) |
Generate a Userevent for stasis app (echo to AMI) More... | |
static struct ast_json * | stasis_end_to_json (struct stasis_message *message, const struct stasis_message_sanitizer *sanitize) |
STASIS_MESSAGE_TYPE_DEFN_LOCAL (end_message_type,.to_json=stasis_end_to_json) | |
STASIS_MESSAGE_TYPE_DEFN_LOCAL (start_message_type,.to_json=stasis_start_to_json) | |
static struct ast_json * | stasis_start_to_json (struct stasis_message *message, const struct stasis_message_sanitizer *sanitize) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER , .description = "Stasis application support" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load_pri = AST_MODPRI_APP_DEPEND - 1, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, } |
struct ao2_container * | app_bridges |
struct ao2_container * | app_bridges_moh |
struct ao2_container * | app_bridges_playback |
struct ao2_container * | app_controls |
struct stasis_message_sanitizer | app_sanitizer |
Sanitization callbacks for communication to Stasis applications. More... | |
struct ao2_container * | apps_registry |
Stasis application container. More... | |
static const struct ast_module_info * | ast_module_info = &__mod_info |
struct event_sources | event_sources = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
static const struct ast_datastore_info | masquerade_store_info |
static const struct ast_datastore_info | replace_channel_store_info |
struct ast_datastore_info | set_end_published_info |
static const struct ast_datastore_info | stasis_internal_channel_info |
Stasis application support.
res_stasis.so
brings together the various components of the Stasis application infrastructure.
First, there's the Stasis application handler, stasis_app_exec(). This is called by app_stasis.so
to give control of a channel to the Stasis application code from the dialplan.
While a channel is in stasis_app_exec(), it has a stasis_app_control object, which may be used to control the channel.
To control the channel, commands may be sent to channel using stasis_app_send_command() and stasis_app_send_async_command().
Alongside this, applications may be registered/unregistered using stasis_app_register()/stasis_app_unregister(). While a channel is in Stasis, events received on the channel's topic are converted to JSON and forwarded to the stasis_app_cb. The application may also subscribe to the channel to continue to receive messages even after the channel has left Stasis, but it will not be able to control it.
Given all the stuff that comes together in this module, it's been broken up into several pieces that are in res/stasis/
and compiled into res_stasis.so
.
Definition in file res_stasis.c.
#define APPS_NUM_BUCKETS 127 |
Number of buckets for the Stasis application hash table. Remember to keep it a prime number!
Definition at line 83 of file res_stasis.c.
#define BRIDGES_NUM_BUCKETS 127 |
Number of buckets for the Stasis bridges hash table. Remember to keep it a prime number!
Definition at line 95 of file res_stasis.c.
#define CONTROLS_NUM_BUCKETS 127 |
Number of buckets for the Stasis application hash table. Remember to keep it a prime number!
Definition at line 89 of file res_stasis.c.
#define MAX_WAIT_MS 200 |
Time to wait for a frame in the application
Definition at line 77 of file res_stasis.c.
typedef enum stasis_app_subscribe_res(* app_subscription_handler) (struct stasis_app *app, const char *uri, struct stasis_app_event_source *event_source) |
Definition at line 1900 of file res_stasis.c.
|
static |
Definition at line 2382 of file res_stasis.c.
|
static |
Definition at line 1729 of file res_stasis.c.
References ao2_cleanup, ao2_find, ao2_link_flags, ao2_lock, ao2_unlock, app, app_create(), app_name(), app_update(), apps_registry, AST_LIST_TRAVERSE, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, cleanup(), handler(), stasis_app_event_source::next, NULL, OBJ_NOLOCK, OBJ_SEARCH_KEY, RAII_VAR, STASIS_APP_SUBSCRIBE_ALL, STASIS_APP_SUBSCRIBE_MANUAL, and stasis_app_event_source::subscribe.
Referenced by stasis_app_register(), and stasis_app_register_all().
|
static |
Definition at line 2382 of file res_stasis.c.
|
static |
Definition at line 1220 of file res_stasis.c.
References ast_channel_datastore_add(), ast_channel_datastore_find(), ast_datastore_alloc, lock, masquerade_store_info, NULL, and SCOPED_CHANNELLOCK.
Referenced by stasis_app_exec().
|
static |
AO2 comparison function for app
Definition at line 208 of file res_stasis.c.
References CMP_MATCH, OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, OBJ_SEARCH_OBJECT, OBJ_SEARCH_PARTIAL_KEY, and stasis_app_name().
Referenced by load_module().
|
static |
Definition at line 1900 of file res_stasis.c.
References ast_begins_with(), AST_LIST_TRAVERSE, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, stasis_app_event_source::next, and stasis_app_event_source::scheme.
Referenced by app_handle_subscriptions().
|
static |
Definition at line 1853 of file res_stasis.c.
References app, AST_LIST_TRAVERSE, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, stasis_app_event_source::next, and stasis_app_event_source::to_json.
Referenced by stasis_app_object_to_json().
char * app_get_replace_channel_app | ( | struct ast_channel * | chan | ) |
Get the app that the replacement channel will be controlled by.
chan | The channel on which this will be set |
NULL | on error |
Definition at line 970 of file res_stasis.c.
References get_replace_channel_store(), NULL, and replace().
Referenced by bridge_stasis_run_cb().
|
static |
Definition at line 1942 of file res_stasis.c.
References ao2_ref, app, app_event_source_find(), app_name(), ast_assert, ast_debug, ast_log, find_app_by_name(), handler(), LOG_WARNING, NULL, stasis_app_object_to_json(), STASIS_ASR_APP_NOT_FOUND, STASIS_ASR_EVENT_SOURCE_BAD_SCHEME, and STASIS_ASR_OK.
Referenced by stasis_app_subscribe(), and stasis_app_unsubscribe().
|
static |
AO2 hash function for app
Definition at line 186 of file res_stasis.c.
References app, ast_assert, ast_str_hash(), OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, OBJ_SEARCH_OBJECT, and stasis_app_name().
Referenced by load_module().
int app_send_end_msg | ( | struct stasis_app * | app, |
struct ast_channel * | chan | ||
) |
Send StasisEnd message to the listening app.
app | The app that owns the channel |
chan | The channel for which the message is being sent |
zero | on success |
Definition at line 1086 of file res_stasis.c.
References ao2_cleanup, app, app_unsubscribe_channel(), ast_app_get_topic(), ast_channel_blob_create(), ast_json_pack(), ast_json_timeval(), ast_json_unref(), ast_log, ast_tvnow(), stasis_message_sanitizer::channel, LOG_ERROR, NULL, remove_masquerade_store(), stasis_app_get_sanitizer(), stasis_app_name(), and stasis_publish().
Referenced by bridge_stasis_moving(), channel_replaced_cb(), channel_stolen_cb(), and stasis_app_exec().
int app_set_replace_channel_app | ( | struct ast_channel * | chan, |
const char * | replace_app | ||
) |
Set the app that the replacement channel will be controlled by.
chan | The channel on which this will be set |
replace_app | The app that will be controlling this channel |
zero | success |
non-zero | failure |
Definition at line 934 of file res_stasis.c.
References ast_free, ast_strdup, get_replace_channel_store(), NULL, and replace().
Referenced by bridge_stasis_push_peek().
int app_set_replace_channel_snapshot | ( | struct ast_channel * | chan, |
struct ast_channel_snapshot * | replace_snapshot | ||
) |
Set the snapshot of the channel that this channel will replace.
chan | The channel on which this will be set |
replace_snapshot | The snapshot of the channel that is being replaced |
zero | success |
non-zero | failure |
Definition at line 922 of file res_stasis.c.
References ao2_replace, get_replace_channel_store(), and replace().
Referenced by bridge_stasis_push_peek().
|
static |
Definition at line 2022 of file res_stasis.c.
References ao2_cleanup, app, app_name(), ast_debug, ast_log, ast_strlen_zero(), stasis_app_event_source::find, LOG_WARNING, NULL, RAII_VAR, stasis_app_event_source::scheme, stasis_app_name(), STASIS_ASR_EVENT_SOURCE_NOT_FOUND, STASIS_ASR_INTERNAL_ERROR, STASIS_ASR_OK, and stasis_app_event_source::subscribe.
Referenced by stasis_app_subscribe().
|
static |
Definition at line 2067 of file res_stasis.c.
References app, app_name(), ast_debug, ast_log, stasis_app_event_source::is_subscribed, LOG_WARNING, stasis_app_event_source::scheme, stasis_app_name(), STASIS_ASR_EVENT_SOURCE_NOT_FOUND, and stasis_app_event_source::unsubscribe.
Referenced by stasis_app_unsubscribe().
|
static |
Definition at line 1702 of file res_stasis.c.
References app, ast_str_container_add(), and stasis_app_name().
Referenced by stasis_app_get_all().
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 2382 of file res_stasis.c.
|
static |
Definition at line 795 of file res_stasis.c.
References ao2_link, app_bridges, AST_BRIDGE_CAPABILITY_HOLDING, AST_BRIDGE_CAPABILITY_MULTIMIX, ast_bridge_destroy(), AST_BRIDGE_FLAG_INVISIBLE, AST_BRIDGE_FLAG_MERGE_INHIBIT_FROM, AST_BRIDGE_FLAG_MERGE_INHIBIT_TO, AST_BRIDGE_FLAG_SMART, AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM, AST_BRIDGE_FLAG_SWAP_INHIBIT_TO, AST_BRIDGE_FLAG_TRANSFER_BRIDGE_ONLY, AST_BRIDGE_VIDEO_MODE_SFU, AST_BRIDGE_VIDEO_MODE_SINGLE_SRC, AST_BRIDGE_VIDEO_MODE_TALKER_SRC, ast_strdupa, ast_strip(), bridge_stasis_new(), name, NULL, S_OR, STASIS_BRIDGE_MIXING_CAPABILITIES, strsep(), and type.
Referenced by stasis_app_bridge_create(), and stasis_app_bridge_create_invisible().
|
static |
Definition at line 574 of file res_stasis.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_link_flags, ao2_ref, ao2_unlink_flags, app_bridges_moh, AST_BRIDGE_CHANNEL_FLAG_IMMOVABLE, AST_BRIDGE_CHANNEL_FLAG_LONELY, AST_CHANNEL_NAME, ast_channel_uniqueid(), ast_hangup(), ast_log, ast_pthread_create_detached, ast_string_field_init, ast_string_field_set, ast_unreal_channel_push_to_bridge(), AST_UUID_STR_LEN, ast_channel::bridge, LOG_ERROR, moh_channel_thread(), NULL, OBJ_NOLOCK, prepare_bridge_moh_channel(), stasis_app_bridge_channel_wrapper_destructor(), stasis_app_channel_unreal_set_internal(), and ast_bridge::uniqueid.
Referenced by stasis_app_bridge_moh_channel().
|
static |
AO2 comparison function for bridges moh container
Definition at line 429 of file res_stasis.c.
References stasis_app_bridge_channel_wrapper::bridge_id, CMP_MATCH, OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, OBJ_SEARCH_OBJECT, and OBJ_SEARCH_PARTIAL_KEY.
Referenced by load_module().
|
static |
AO2 hash function for the bridges moh container
Definition at line 462 of file res_stasis.c.
References ast_assert, ast_str_hash(), stasis_app_bridge_channel_wrapper::bridge_id, OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, and OBJ_SEARCH_OBJECT.
Referenced by load_module().
|
static |
Definition at line 483 of file res_stasis.c.
References ast_assert, stasis_app_bridge_channel_wrapper::bridge_id, OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, OBJ_SEARCH_OBJECT, and OBJ_SEARCH_PARTIAL_KEY.
Referenced by load_module().
|
static |
AO2 comparison function for bridges container
Definition at line 378 of file res_stasis.c.
References CMP_MATCH, OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, OBJ_SEARCH_OBJECT, OBJ_SEARCH_PARTIAL_KEY, and ast_bridge::uniqueid.
Referenced by load_module().
|
static |
AO2 hash function for bridges container
Definition at line 356 of file res_stasis.c.
References ast_assert, ast_str_hash(), OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, OBJ_SEARCH_OBJECT, and ast_bridge::uniqueid.
Referenced by load_module().
|
static |
Sanitization callback for channel unique IDs.
Definition at line 2248 of file res_stasis.c.
References ao2_cleanup, ast_channel_snapshot_get_latest(), and channel_snapshot_sanitizer().
|
static |
Definition at line 1162 of file res_stasis.c.
References ao2_callback, ao2_cleanup, ao2_link, app_controls, app_send_end_msg(), ast_channel_snapshot_get_latest(), ast_channel_uniqueid(), ast_log, control_app(), LOG_ERROR, masq_match_cb(), NULL, OBJ_UNLINK, RAII_VAR, and send_start_msg_snapshots().
|
static |
Sanitization callback for channels.
Definition at line 2239 of file res_stasis.c.
References AST_CHAN_TP_INTERNAL, and ast_channel_tech().
|
static |
Sanitization callback for channel snapshots.
Definition at line 2230 of file res_stasis.c.
References AST_CHAN_TP_INTERNAL, ast_channel_snapshot::base, and ast_channel_snapshot_base::tech_properties.
Referenced by channel_id_sanitizer().
|
static |
Definition at line 1131 of file res_stasis.c.
References ao2_callback, ao2_cleanup, app_controls, app_send_end_msg(), ast_log, control_app(), LOG_ERROR, masq_match_cb(), OBJ_UNLINK, remove_masquerade_store(), and stasis_app_channel_set_stasis_end_published().
|
static |
Clean up any old apps that we don't need any more.
Definition at line 327 of file res_stasis.c.
References ao2_callback, apps_registry, cleanup_cb(), NULL, OBJ_MULTIPLE, OBJ_NODATA, and OBJ_UNLINK.
Referenced by __stasis_app_register(), stasis_app_exec(), stasis_app_unregister(), and unload_module().
|
static |
Definition at line 309 of file res_stasis.c.
References app, app_is_finished(), app_shutdown(), ast_verb, CMP_MATCH, and stasis_app_name().
Referenced by ast_sched_clean_by_callback(), and cleanup().
|
static |
AO2 comparison function for stasis_app_control
Definition at line 270 of file res_stasis.c.
References CMP_MATCH, OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, OBJ_SEARCH_OBJECT, OBJ_SEARCH_PARTIAL_KEY, and stasis_app_control_get_channel_id().
Referenced by load_module().
|
static |
AO2 hash function for stasis_app_control
Definition at line 248 of file res_stasis.c.
References ast_assert, ast_str_hash(), OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, OBJ_SEARCH_OBJECT, and stasis_app_control_get_channel_id().
Referenced by load_module().
|
static |
In addition to running ao2_cleanup(), this function also removes the object from the app_controls container.
Definition at line 785 of file res_stasis.c.
References ao2_cleanup, ao2_unlink, and app_controls.
Referenced by stasis_app_exec().
|
static |
Definition at line 1682 of file res_stasis.c.
References ao2_find, app_name(), apps_registry, ast_strlen_zero(), NULL, and OBJ_SEARCH_KEY.
Referenced by app_handle_subscriptions(), stasis_app_get_by_name(), stasis_app_subscribe_channel(), stasis_app_to_json(), and stasis_app_user_event().
|
static |
Definition at line 955 of file res_stasis.c.
References get_replace_channel_store(), NULL, and replace().
Referenced by send_start_msg().
|
static |
Definition at line 893 of file res_stasis.c.
References ast_calloc, ast_channel_datastore_add(), ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, ast_datastore_alloc, ast_datastore::data, NULL, and replace_channel_store_info.
Referenced by app_get_replace_channel_app(), app_set_replace_channel_app(), app_set_replace_channel_snapshot(), and get_replace_channel_snapshot().
|
static |
Definition at line 1214 of file res_stasis.c.
References ast_channel_datastore_find(), lock, masquerade_store_info, NULL, and SCOPED_CHANNELLOCK.
Referenced by stasis_app_exec().
|
static |
Definition at line 2340 of file res_stasis.c.
References AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_hash, AO2_CONTAINER_ALLOC_OPT_DUPS_REJECT, app_bridges, app_bridges_moh, app_bridges_playback, app_compare(), app_controls, app_hash(), APPS_NUM_BUCKETS, apps_registry, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, bridge_stasis_init(), bridges_channel_compare(), bridges_channel_hash_fn(), bridges_channel_sort_fn(), bridges_compare(), bridges_hash(), BRIDGES_NUM_BUCKETS, control_compare(), control_hash(), CONTROLS_NUM_BUCKETS, messaging_init(), NULL, stasis_app_register_event_sources(), STASIS_MESSAGE_TYPE_INIT, and unload_module().
|
static |
Definition at line 1118 of file res_stasis.c.
References ast_channel_uniqueid(), CMP_MATCH, ast_channel::data, and stasis_app_control_get_channel_id().
Referenced by channel_replaced_cb(), and channel_stolen_cb().
|
static |
Provides the moh channel with a thread so it can actually play its music
Definition at line 529 of file res_stasis.c.
References ao2_ref, ao2_unlink, app_bridges_moh, ast_channel_get_by_name(), ast_frfree, ast_hangup(), ast_moh_stop(), ast_read(), ast_waitfor(), stasis_app_bridge_channel_wrapper::channel_id, and NULL.
Referenced by bridge_moh_create().
|
static |
Definition at line 698 of file res_stasis.c.
References remove_bridge_playback().
Referenced by stasis_app_bridge_playback_channel_add().
|
static |
Definition at line 691 of file res_stasis.c.
References remove_bridge_playback().
Referenced by stasis_app_bridge_playback_channel_add().
|
static |
Request a bridge MOH channel
Definition at line 510 of file res_stasis.c.
References ao2_ref, ast_format_cap_alloc, ast_format_cap_append, AST_FORMAT_CAP_FLAG_DEFAULT, ast_format_slin, ast_request(), and NULL.
Referenced by bridge_moh_create().
|
static |
Removes the bridge to playback channel link
Definition at line 673 of file res_stasis.c.
References ao2_find, ao2_ref, ao2_unlink, app_bridges_playback, app_controls, ast_free, stasis_app_bridge_channel_wrapper::channel_id, OBJ_SEARCH_KEY, OBJ_UNLINK, and stasis_app_control_find_by_channel_id().
Referenced by playback_after_bridge_cb(), and playback_after_bridge_cb_failed().
|
static |
Definition at line 1239 of file res_stasis.c.
References ast_channel_datastore_find(), ast_channel_datastore_remove(), ast_datastore_free(), lock, masquerade_store_info, NULL, and SCOPED_CHANNELLOCK.
Referenced by app_send_end_msg(), channel_stolen_cb(), and stasis_app_exec().
|
static |
Definition at line 1313 of file res_stasis.c.
References ast_channel_datastore_find(), ast_channel_datastore_remove(), ast_channel_lock, ast_channel_unlock, ast_datastore_free(), NULL, and set_end_published_info.
Referenced by stasis_app_exec().
|
static |
Definition at line 879 of file res_stasis.c.
References ao2_cleanup, ast_free, and replace().
|
static |
Definition at line 1060 of file res_stasis.c.
References ao2_cleanup, ao2_ref, app, ast_assert, ast_channel_lock, ast_channel_snapshot_create(), ast_channel_unlock, get_replace_channel_snapshot(), NULL, and send_start_msg_snapshots().
Referenced by stasis_app_exec().
|
static |
Definition at line 994 of file res_stasis.c.
References ao2_alloc, ao2_bump, ao2_ref, app, app_subscribe_channel(), app_unsubscribe_channel_id(), ast_app_get_topic(), ast_assert, ast_channel_name(), ast_json_array_append(), ast_json_object_get(), ast_json_pack(), ast_json_string_create(), ast_json_timeval(), ast_log, ast_tvnow(), ast_channel_snapshot::base, start_message_blob::blob, start_message_blob::channel, LOG_ERROR, NULL, start_message_blob::replace_channel, start_message_blob_dtor(), stasis_app_name(), stasis_message_create(), stasis_publish(), and ast_channel_snapshot_base::uniqueid.
Referenced by channel_replaced_cb(), and send_start_msg().
|
static |
Definition at line 2276 of file res_stasis.c.
References ast_channel_datastore_add(), ast_channel_datastore_find(), ast_datastore_alloc, NULL, and stasis_internal_channel_info.
Referenced by stasis_app_channel_set_internal(), and stasis_app_channel_unreal_set_internal().
|
static |
Definition at line 985 of file res_stasis.c.
References ao2_cleanup, ast_json_unref(), start_message_blob::blob, start_message_blob::channel, and start_message_blob::replace_channel.
Referenced by send_start_msg_snapshots().
|
static |
Definition at line 455 of file res_stasis.c.
References ast_string_field_free_memory.
Referenced by bridge_moh_create(), and stasis_app_bridge_playback_channel_add().
struct ast_bridge * stasis_app_bridge_create | ( | const char * | type, |
const char * | name, | ||
const char * | id | ||
) |
Create a bridge of the specified type.
type | The type of bridge to be created |
name | Optional name to give to the bridge |
id | Optional Unique ID to give to the bridge |
NULL | on error. |
Definition at line 854 of file res_stasis.c.
References bridge_create_common(), name, and type.
Referenced by ast_ari_bridges_create(), and ast_ari_bridges_create_with_id().
struct ast_bridge * stasis_app_bridge_create_invisible | ( | const char * | type, |
const char * | name, | ||
const char * | id | ||
) |
Create an invisible bridge of the specified type.
type | The type of bridge to be created |
name | Optional name to give to the bridge |
id | Optional Unique ID to give to the bridge |
NULL | on error. |
Definition at line 859 of file res_stasis.c.
References bridge_create_common(), name, and type.
Referenced by get_dial_bridge().
void stasis_app_bridge_destroy | ( | const char * | bridge_id | ) |
Destroy the bridge.
bridge_id | Uniqueid of bridge to be destroyed |
Definition at line 864 of file res_stasis.c.
References ao2_unlink, app_bridges, ast_bridge_destroy(), and stasis_app_bridge_find_by_id().
Referenced by ast_ari_bridges_destroy().
struct ast_bridge * stasis_app_bridge_find_by_id | ( | const char * | bridge_id | ) |
Returns the bridge with the given id.
bridge_id | Uniqueid of the bridge. |
Definition at line 774 of file res_stasis.c.
References ao2_find, app_bridges, and OBJ_SEARCH_KEY.
Referenced by bridge_find(), find_bridge(), and stasis_app_bridge_destroy().
struct ast_channel * stasis_app_bridge_moh_channel | ( | struct ast_bridge * | bridge | ) |
Finds or creates an announcer channel in a bridge that can play music on hold.
bridge | Bridge we want an MOH channel for |
Definition at line 629 of file res_stasis.c.
References ao2_find, ao2_lock, ao2_ref, ao2_unlock, app_bridges_moh, ast_channel_get_by_name(), bridge_moh_create(), stasis_app_bridge_channel_wrapper::channel_id, OBJ_NOLOCK, OBJ_SEARCH_KEY, and ast_bridge::uniqueid.
Referenced by ast_ari_bridges_start_moh().
int stasis_app_bridge_moh_stop | ( | struct ast_bridge * | bridge | ) |
Breaks down MOH channels playing on the bridge created by stasis_app_bridge_moh_channel.
bridge | Bridge we want to stop the MOH on |
Definition at line 649 of file res_stasis.c.
References ao2_cleanup, ao2_find, ao2_ref, app_bridges_moh, AST_CAUSE_NORMAL_CLEARING, ast_channel_get_by_name(), ast_moh_stop(), ast_softhangup(), ast_channel::bridge, stasis_app_bridge_channel_wrapper::channel_id, OBJ_SEARCH_KEY, OBJ_UNLINK, and ast_bridge::uniqueid.
Referenced by ast_ari_bridges_stop_moh().
int stasis_app_bridge_playback_channel_add | ( | struct ast_bridge * | bridge, |
struct ast_channel * | chan, | ||
struct stasis_app_control * | control | ||
) |
Adds a channel to the list of ARI playback channels for bridges.
bridge | Bridge we are adding the playback channel for |
chan | Channel being added as a playback channel (must be ;1) |
control | The app control structure for the playback channel |
-1 | failed to add channel for any reason |
0 | on success |
Definition at line 705 of file res_stasis.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_cleanup, ao2_link, app_bridges_playback, app_controls, ast_bridge_set_after_callback(), ast_channel_uniqueid(), ast_free, ast_strdup, ast_string_field_init, ast_string_field_set, stasis_app_control::bridge, NULL, playback_after_bridge_cb(), playback_after_bridge_cb_failed(), RAII_VAR, stasis_app_bridge_channel_wrapper_destructor(), and ast_bridge::uniqueid.
Referenced by ari_bridges_play_new().
struct ast_channel * stasis_app_bridge_playback_channel_find | ( | struct ast_bridge * | bridge | ) |
Finds an existing ARI playback channel in a bridge.
bridge | Bridge we want to find the playback channel for |
Definition at line 759 of file res_stasis.c.
References ao2_find, ao2_ref, app_bridges_playback, ast_channel_get_by_name(), ast_channel::bridge, stasis_app_bridge_channel_wrapper::channel_id, NULL, OBJ_SEARCH_KEY, and ast_bridge::uniqueid.
Referenced by ari_bridges_handle_play().
void stasis_app_bridge_playback_channel_remove | ( | char * | bridge_id, |
struct stasis_app_control * | control | ||
) |
remove channel from list of ARI playback channels for bridges.
bridge_id | The unique ID of the bridge the playback channel is in. |
control | The app control structure for the playback channel |
Definition at line 743 of file res_stasis.c.
References ao2_find, ao2_ref, ao2_unlink, app_bridges_playback, app_controls, stasis_app_bridge_channel_wrapper::bridge_id, OBJ_SEARCH_KEY, and OBJ_UNLINK.
Referenced by ari_bridges_play_new(), and bridge_channel_control_thread().
int stasis_app_channel_is_internal | ( | struct ast_channel * | chan | ) |
Is this channel internal to Stasis?
chan | The channel to check. |
0 | No |
1 | Yes |
Definition at line 2325 of file res_stasis.c.
References ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, NULL, and stasis_internal_channel_info.
Referenced by bridge_stasis_push().
int stasis_app_channel_is_stasis_end_published | ( | struct ast_channel * | chan | ) |
Has this channel had a StasisEnd published on it?
chan | The channel upon which the query rests. |
0 | No |
1 | Yes |
Definition at line 1302 of file res_stasis.c.
References ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, NULL, and set_end_published_info.
Referenced by internal_bridge_after_cb(), and stasis_app_exec().
int stasis_app_channel_set_internal | ( | struct ast_channel * | chan | ) |
Mark this channel as being internal to Stasis.
chan | The channel to mark. |
zero | Success |
non-zero | Failure |
Definition at line 2314 of file res_stasis.c.
References ast_channel_lock, ast_channel_unlock, ast_unreal_pvt::chan, and set_internal_datastore().
void stasis_app_channel_set_stasis_end_published | ( | struct ast_channel * | chan | ) |
Indicate that this channel has had a StasisEnd published for it.
chan | The channel that is exiting Stasis. |
Definition at line 1290 of file res_stasis.c.
References ast_channel_datastore_add(), ast_channel_lock, ast_channel_unlock, ast_datastore_alloc, NULL, and set_end_published_info.
Referenced by bridge_stasis_moving(), and channel_stolen_cb().
int stasis_app_channel_unreal_set_internal | ( | struct ast_channel * | chan | ) |
Mark this unreal channel and it's other half as being internal to Stasis.
chan | The channel to mark. |
zero | Success |
non-zero | Failure |
Definition at line 2291 of file res_stasis.c.
References ao2_ref, ao2_unlock, ast_channel_tech_pvt(), ast_channel_unlock, ast_channel_unref, ast_unreal_lock_all(), ast_unreal_pvt::chan, NULL, and set_internal_datastore().
Referenced by bridge_moh_create(), and prepare_bridge_media_channel().
struct stasis_app_control * stasis_app_control_create | ( | struct ast_channel * | chan | ) |
Creates a control handler for a channel that isn't in a stasis app.
chan | Channel to create controller handle for |
res_stasis
handler. Definition at line 333 of file res_stasis.c.
References control_create(), and NULL.
Referenced by ari_bridges_play_new(), and ast_ari_bridges_record().
void stasis_app_control_execute_until_exhausted | ( | struct ast_channel * | chan, |
struct stasis_app_control * | control | ||
) |
Act on a stasis app control queue until it is empty.
chan | Channel to handle |
control | Control object to execute |
Definition at line 1253 of file res_stasis.c.
References ao2_lock, ao2_unlock, ast_channel_fdno(), control_command_count(), control_dispatch_all(), control_is_done(), and control_mark_done().
Referenced by bridge_channel_control_thread().
struct stasis_app_control * stasis_app_control_find_by_channel | ( | const struct ast_channel * | chan | ) |
Returns the handler for the given channel.
chan | Channel to handle. |
res_stasis
handler. Definition at line 338 of file res_stasis.c.
References ast_channel_uniqueid(), NULL, and stasis_app_control_find_by_channel_id().
Referenced by ari_bridges_play_found(), bridge_stasis_moving(), bridge_stasis_push(), bridge_stasis_push_peek(), and bridge_timeout().
struct stasis_app_control * stasis_app_control_find_by_channel_id | ( | const char * | channel_id | ) |
Returns the handler for the channel with the given id.
channel_id | Uniqueid of the channel. |
res_stasis
handler. Definition at line 349 of file res_stasis.c.
References ao2_find, app_controls, and OBJ_SEARCH_KEY.
Referenced by find_channel_control(), find_control(), remove_bridge_playback(), and stasis_app_control_find_by_channel().
void stasis_app_control_flush_queue | ( | struct stasis_app_control * | control | ) |
Flush the control command queue.
control | Control object to flush command queue. |
Definition at line 1281 of file res_stasis.c.
References control_flush_queue().
Referenced by bridge_channel_control_thread().
int stasis_app_control_is_done | ( | struct stasis_app_control * | control | ) |
Check if a control is marked as done.
control | Which control object is being evaluated |
Definition at line 1276 of file res_stasis.c.
References control_is_done().
Referenced by ari_bridges_play_found().
int stasis_app_exec | ( | struct ast_channel * | chan, |
const char * | app_name, | ||
int | argc, | ||
char * | argv[] | ||
) |
Stasis dialplan application callback.
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().
struct ao2_container * stasis_app_get_all | ( | void | ) |
Gets the names of all registered Stasis applications.
ast_str_container
of container names. NULL | on error. |
Definition at line 1711 of file res_stasis.c.
References ao2_callback, append_name(), apps, apps_registry, ast_str_container_alloc, NULL, and OBJ_NODATA.
Referenced by ari_show_apps(), ast_ari_applications_list(), complete_ari_app(), and stasis_app_set_global_debug().
struct stasis_app * stasis_app_get_by_name | ( | const char * | name | ) |
Retrieve a handle to a Stasis application by its name.
name | The name of the registered Stasis application |
stasis_app
on success. NULL | on error. |
Definition at line 1697 of file res_stasis.c.
References find_app_by_name(), and name.
Referenced by ari_set_debug(), ari_show_app(), ast_ari_applications_filter(), stasis_app_event_allowed(), stasis_app_get_debug_by_name(), stasis_app_set_debug_by_name(), and stasis_app_set_global_debug().
struct stasis_message_sanitizer * stasis_app_get_sanitizer | ( | void | ) |
Get the Stasis message sanitizer for app_stasis applications.
The | stasis message sanitizer |
Definition at line 2267 of file res_stasis.c.
References app_sanitizer.
Referenced by app_send_end_msg(), ast_ari_bridges_create(), ast_ari_bridges_create_with_id(), ast_ari_bridges_get(), ast_ari_bridges_list(), ast_ari_channels_list(), ast_ari_endpoints_get(), ast_ari_endpoints_list(), ast_ari_endpoints_list_by_tech(), channel_callerid(), channel_connected_line(), channel_destroyed_event(), channel_dialplan(), message_received_handler(), simple_bridge_event(), simple_channel_event(), and simple_endpoint_event().
struct ast_json * stasis_app_object_to_json | ( | struct stasis_app * | app | ) |
Return the JSON representation of a Stasis application.
app | The application. |
NULL | on error. |
Definition at line 1869 of file res_stasis.c.
References app, app_event_sources_to_json(), app_to_json(), NULL, and stasis_app_event_filter_to_json().
Referenced by app_handle_subscriptions(), ast_ari_applications_filter(), and stasis_app_to_json().
int stasis_app_register | ( | const char * | app_name, |
stasis_app_cb | handler, | ||
void * | data | ||
) |
Register a new Stasis application.
If an application is already registered with the given name, the old application is sent a 'replaced' message and unregistered.
app_name | Name of this application. |
handler | Callback for application messages. |
data | Data blob to pass to the callback. Must be AO2 managed. |
Definition at line 1780 of file res_stasis.c.
References __stasis_app_register(), app_name(), and handler().
Referenced by AST_TEST_DEFINE(), and event_session_alloc().
int stasis_app_register_all | ( | const char * | app_name, |
stasis_app_cb | handler, | ||
void * | data | ||
) |
Register a new Stasis application that receives all Asterisk events.
If an application is already registered with the given name, the old application is sent a 'replaced' message and unregistered.
app_name | Name of this application. |
handler | Callback for application messages. |
data | Data blob to pass to the callback. Must be AO2 managed. |
Definition at line 1785 of file res_stasis.c.
References __stasis_app_register(), app_name(), and handler().
Referenced by event_session_alloc().
void stasis_app_register_event_source | ( | struct stasis_app_event_source * | obj | ) |
Register an application event source.
obj | the event source to register |
Definition at line 1819 of file res_stasis.c.
References AST_LIST_INSERT_TAIL, AST_RWLIST_UNLOCK, and AST_RWLIST_WRLOCK.
Referenced by load_module(), and stasis_app_register_event_sources().
int stasis_app_send | ( | const char * | app_name, |
struct ast_json * | message | ||
) |
Send a message to the given Stasis application.
The message given to the handler is a borrowed copy. If you want to keep a reference to it, you should use ao2_ref()
to keep it around.
app_name | Name of the application to invoke. |
message | Message to send (borrowed reference) |
Definition at line 1659 of file res_stasis.c.
References ao2_find, ao2_ref, app, app_name(), app_send(), apps_registry, ast_log, LOG_WARNING, and OBJ_SEARCH_KEY.
Referenced by AST_TEST_DEFINE(), and send_device_state().
enum stasis_app_subscribe_res stasis_app_subscribe | ( | const char * | app_name, |
const char ** | event_source_uris, | ||
int | event_sources_count, | ||
struct ast_json ** | json | ||
) |
Subscribes an application to a list of event sources.
app_name | Name of the application to subscribe. |
event_source_uris | URIs for the event sources to subscribe to. |
event_sources_count | Array size of event_source_uris. |
json | Optional output pointer for JSON representation of the app after adding the subscription. |
Definition at line 2048 of file res_stasis.c.
References app_handle_subscriptions(), app_name(), and app_subscribe().
Referenced by ast_ari_applications_subscribe().
enum stasis_app_subscribe_res stasis_app_subscribe_channel | ( | const char * | app_name, |
struct ast_channel * | chan | ||
) |
Directly subscribe an application to a channel.
app_name | Name of the application to subscribe. |
chan | The channel to subscribe to |
Definition at line 1987 of file res_stasis.c.
References ao2_ref, app, app_name(), app_subscribe_channel(), ast_channel_uniqueid(), ast_debug, ast_log, find_app_by_name(), LOG_ERROR, STASIS_ASR_APP_NOT_FOUND, STASIS_ASR_INTERNAL_ERROR, and STASIS_ASR_OK.
Referenced by ari_channels_handle_originate_with_id(), and ast_ari_channels_create().
struct ast_json * stasis_app_to_json | ( | const char * | app_name | ) |
Return the JSON representation of a Stasis application.
app_name | Name of the application. |
NULL | on error. |
Definition at line 1879 of file res_stasis.c.
References ao2_cleanup, app, app_name(), find_app_by_name(), and stasis_app_object_to_json().
Referenced by append_json(), and ast_ari_applications_get().
void stasis_app_unregister | ( | const char * | app_name | ) |
Unregister a Stasis application.
app_name | Name of the application to unregister. |
Definition at line 1790 of file res_stasis.c.
References ao2_find, ao2_ref, app, app_deactivate(), app_name(), apps_registry, ast_log, cleanup(), LOG_ERROR, and OBJ_SEARCH_KEY.
Referenced by AST_TEST_DEFINE(), and event_session_shutdown().
void stasis_app_unregister_event_source | ( | struct stasis_app_event_source * | obj | ) |
Unregister an application event source.
obj | the event source to unregister |
Definition at line 1826 of file res_stasis.c.
References AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, and stasis_app_event_source::next.
Referenced by stasis_app_unregister_event_sources(), and unload_module().
enum stasis_app_subscribe_res stasis_app_unsubscribe | ( | const char * | app_name, |
const char ** | event_source_uris, | ||
int | event_sources_count, | ||
struct ast_json ** | json | ||
) |
Unsubscribes an application from a list of event sources.
app_name | Name of the application to subscribe. |
event_source_uris | URIs for the event sources to subscribe to. |
event_sources_count | Array size of event_source_uris. |
json | Optional output pointer for JSON representation of the app after adding the subscription. |
Definition at line 2089 of file res_stasis.c.
References app_handle_subscriptions(), app_name(), and app_unsubscribe().
Referenced by ast_ari_applications_unsubscribe().
enum stasis_app_user_event_res stasis_app_user_event | ( | const char * | app_name, |
const char * | event_name, | ||
const char ** | source_uris, | ||
int | sources_count, | ||
struct ast_json * | json_variables | ||
) |
Generate a Userevent for stasis app (echo to AMI)
app_name | Name of the application to generate event for/to. |
event_name | Name of the Userevent. |
source_uris | URIs for the source objects to attach to event. |
sources_count | Array size of source_uris. |
json_variables | event blob variables. |
Definition at line 2098 of file res_stasis.c.
References ao2_cleanup, ao2_ref, app, app_name(), ast_app_get_topic(), ast_begins_with(), ast_bridge_get_snapshot_by_uniqueid(), ast_channel_snapshot_get_latest(), ast_endpoint_latest_snapshot(), ast_json_object_set(), ast_json_pack(), ast_json_ref(), ast_json_string_create(), ast_json_unref(), ast_log, ast_manager_get_topic(), ast_multi_object_blob_add(), ast_multi_object_blob_create(), ast_multi_user_event_type(), find_app_by_name(), LOG_ERROR, LOG_WARNING, NULL, RAII_VAR, STASIS_APP_USER_APP_NOT_FOUND, STASIS_APP_USER_EVENT_SOURCE_BAD_SCHEME, STASIS_APP_USER_EVENT_SOURCE_NOT_FOUND, STASIS_APP_USER_INTERNAL_ERROR, STASIS_APP_USER_OK, stasis_message_create(), stasis_publish(), STASIS_UMOS_BRIDGE, STASIS_UMOS_CHANNEL, STASIS_UMOS_ENDPOINT, and type.
Referenced by ast_ari_events_user_event().
|
static |
Definition at line 115 of file res_stasis.c.
References ast_channel_snapshot_to_json(), ast_json_object_get(), ast_json_pack(), ast_log, ast_channel_blob::blob, stasis_message_sanitizer::channel_snapshot, LOG_ERROR, NULL, ast_channel_blob::snapshot, and stasis_message_data().
STASIS_MESSAGE_TYPE_DEFN_LOCAL | ( | end_message_type | , |
. | to_json = stasis_end_to_json |
||
) |
STASIS_MESSAGE_TYPE_DEFN_LOCAL | ( | start_message_type | , |
. | to_json = stasis_start_to_json |
||
) |
|
static |
Definition at line 147 of file res_stasis.c.
References ast_channel_snapshot_to_json(), ast_json_object_get(), ast_json_object_set(), ast_json_pack(), ast_json_unref(), ast_log, start_message_blob::blob, start_message_blob::channel, stasis_message_sanitizer::channel_snapshot, LOG_ERROR, NULL, start_message_blob::replace_channel, and stasis_message_data().
|
static |
Definition at line 2198 of file res_stasis.c.
References ao2_cleanup, app_bridges, app_bridges_moh, app_bridges_playback, app_controls, apps_registry, cleanup(), messaging_cleanup(), NULL, stasis_app_control_shutdown(), stasis_app_unregister_event_sources(), and STASIS_MESSAGE_TYPE_CLEANUP.
Referenced by load_module().
|
static |
Definition at line 2382 of file res_stasis.c.
struct ao2_container* app_bridges |
Definition at line 104 of file res_stasis.c.
Referenced by bridge_create_common(), load_module(), stasis_app_bridge_destroy(), stasis_app_bridge_find_by_id(), and unload_module().
struct ao2_container* app_bridges_moh |
Definition at line 106 of file res_stasis.c.
Referenced by bridge_moh_create(), load_module(), moh_channel_thread(), stasis_app_bridge_moh_channel(), stasis_app_bridge_moh_stop(), and unload_module().
struct ao2_container* app_bridges_playback |
Definition at line 108 of file res_stasis.c.
Referenced by load_module(), remove_bridge_playback(), stasis_app_bridge_playback_channel_add(), stasis_app_bridge_playback_channel_find(), stasis_app_bridge_playback_channel_remove(), and unload_module().
struct ao2_container* app_controls |
Definition at line 102 of file res_stasis.c.
Referenced by channel_replaced_cb(), channel_stolen_cb(), control_unlink(), load_module(), remove_bridge_playback(), stasis_app_bridge_playback_channel_add(), stasis_app_bridge_playback_channel_remove(), stasis_app_control_find_by_channel_id(), stasis_app_exec(), and unload_module().
struct stasis_message_sanitizer app_sanitizer |
Sanitization callbacks for communication to Stasis applications.
Definition at line 2261 of file res_stasis.c.
Referenced by stasis_app_get_sanitizer().
struct ao2_container* apps_registry |
Stasis application container.
Definition at line 100 of file res_stasis.c.
Referenced by __stasis_app_register(), cleanup(), find_app_by_name(), load_module(), stasis_app_exec(), stasis_app_get_all(), stasis_app_send(), stasis_app_unregister(), and unload_module().
|
static |
Definition at line 2382 of file res_stasis.c.
struct event_sources event_sources = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
|
static |
Definition at line 1208 of file res_stasis.c.
Referenced by add_masquerade_store(), has_masquerade_store(), and remove_masquerade_store().
|
static |
Definition at line 888 of file res_stasis.c.
Referenced by get_replace_channel_store().
struct ast_datastore_info set_end_published_info |
Definition at line 1286 of file res_stasis.c.
Referenced by remove_stasis_end_published(), stasis_app_channel_is_stasis_end_published(), and stasis_app_channel_set_stasis_end_published().
|
static |
Definition at line 2272 of file res_stasis.c.
Referenced by set_internal_datastore(), and stasis_app_channel_is_internal().