Asterisk - The Open Source Telephony Project
18.5.0
|
Stasis application support. More...
#include "asterisk.h"
#include "app.h"
#include "control.h"
#include "messaging.h"
#include "asterisk/callerid.h"
#include "asterisk/cli.h"
#include "asterisk/stasis_app.h"
#include "asterisk/stasis_bridges.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/stasis_endpoints.h"
#include "asterisk/stasis_message_router.h"
Go to the source code of this file.
Data Structures | |
struct | app_forwards |
struct | stasis_app |
Macros | |
#define | BRIDGE_ALL "__AST_BRIDGE_ALL_TOPIC" |
#define | CHANNEL_ALL "__AST_CHANNEL_ALL_TOPIC" |
#define | ENDPOINT_ALL "__AST_ENDPOINT_ALL_TOPIC" |
Typedefs | |
typedef struct ast_json *(* | channel_snapshot_monitor) (struct ast_channel_snapshot *old_snapshot, struct ast_channel_snapshot *new_snapshot, const struct timeval *tv) |
Typedef for callbacks that get called on channel snapshot updates. More... | |
Enumerations | |
enum | forward_type { FORWARD_CHANNEL, FORWARD_BRIDGE, FORWARD_ENDPOINT } |
Functions | |
struct stasis_app * | app_create (const char *name, stasis_app_cb handler, void *data, enum stasis_app_subscription_model subscription_model) |
Create a res_stasis application. More... | |
void | app_deactivate (struct stasis_app *app) |
Deactivates an application. More... | |
static void | app_dtor (void *obj) |
static int | app_event_filter_matched (struct ast_json *array, struct ast_json *event, int empty) |
static int | app_event_filter_set (struct stasis_app *app, struct ast_json **member, struct ast_json *filter, const char *filter_type) |
static int | app_events_allowed_set (struct stasis_app *app, struct ast_json *filter) |
static int | app_events_disallowed_set (struct stasis_app *app, struct ast_json *filter) |
int | app_is_active (struct stasis_app *app) |
Checks whether an app is active. More... | |
int | app_is_finished (struct stasis_app *app) |
Checks whether a deactivated app has no channels. More... | |
int | app_is_subscribed_bridge_id (struct stasis_app *app, const char *bridge_id) |
Test if an app is subscribed to a bridge. More... | |
int | app_is_subscribed_channel_id (struct stasis_app *app, const char *channel_id) |
Test if an app is subscribed to a channel. More... | |
int | app_is_subscribed_endpoint_id (struct stasis_app *app, const char *endpoint_id) |
Test if an app is subscribed to a endpoint. More... | |
void | app_send (struct stasis_app *app, struct ast_json *message) |
Send a message to the given application. More... | |
void | app_shutdown (struct stasis_app *app) |
Tears down an application. More... | |
int | app_subscribe_bridge (struct stasis_app *app, struct ast_bridge *bridge) |
Add a bridge subscription to an existing channel subscription. More... | |
int | app_subscribe_channel (struct stasis_app *app, struct ast_channel *chan) |
Subscribes an application to a channel. More... | |
int | app_subscribe_endpoint (struct stasis_app *app, struct ast_endpoint *endpoint) |
Subscribes an application to a endpoint. More... | |
struct ast_json * | app_to_json (const struct stasis_app *app) |
Create a JSON representation of a stasis_app . More... | |
int | app_unsubscribe_bridge (struct stasis_app *app, struct ast_bridge *bridge) |
Cancel the bridge subscription for an application. More... | |
int | app_unsubscribe_bridge_id (struct stasis_app *app, const char *bridge_id) |
Cancel the subscription an app has for a bridge. More... | |
int | app_unsubscribe_channel (struct stasis_app *app, struct ast_channel *chan) |
Cancel the subscription an app has for a channel. More... | |
int | app_unsubscribe_channel_id (struct stasis_app *app, const char *channel_id) |
Cancel the subscription an app has for a channel. More... | |
int | app_unsubscribe_endpoint_id (struct stasis_app *app, const char *endpoint_id) |
Cancel the subscription an app has for a endpoint. More... | |
void | app_update (struct stasis_app *app, stasis_app_cb handler, void *data) |
Update the handler and data for a res_stasis application. More... | |
struct stasis_topic * | ast_app_get_topic (struct stasis_app *app) |
Returns the stasis topic for an app. More... | |
static int | bridge_app_subscribed (struct stasis_app *app, const char *uniqueid) |
Helper function for determining if the application is subscribed to a given entity. More... | |
static int | bridge_app_subscribed_involved (struct stasis_app *app, struct ast_bridge_snapshot *snapshot) |
Callback function for checking if channels in a bridge are subscribed to. More... | |
static void | bridge_attended_transfer_handler (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static void | bridge_blind_transfer_handler (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static void * | bridge_find (const struct stasis_app *app, const char *id) |
static void | bridge_merge_handler (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static void | bridge_subscription_change_handler (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static void | call_forwarded_handler (struct stasis_app *app, struct stasis_message *message) |
static struct ast_json * | channel_callerid (struct ast_channel_snapshot *old_snapshot, struct ast_channel_snapshot *new_snapshot, const struct timeval *tv) |
static struct ast_json * | channel_connected_line (struct ast_channel_snapshot *old_snapshot, struct ast_channel_snapshot *new_snapshot, const struct timeval *tv) |
static struct ast_json * | channel_created_event (struct ast_channel_snapshot *snapshot, const struct timeval *tv) |
static struct ast_json * | channel_destroyed_event (struct ast_channel_snapshot *snapshot, const struct timeval *tv) |
static struct ast_json * | channel_dialplan (struct ast_channel_snapshot *old_snapshot, struct ast_channel_snapshot *new_snapshot, const struct timeval *tv) |
static void * | channel_find (const struct stasis_app *app, const char *id) |
static struct ast_json * | channel_state (struct ast_channel_snapshot *old_snapshot, struct ast_channel_snapshot *new_snapshot, const struct timeval *tv) |
Handle channel state changes. More... | |
static struct ast_json * | channel_state_change_event (struct ast_channel_snapshot *snapshot, const struct timeval *tv) |
static void * | endpoint_find (const struct stasis_app *app, const char *id) |
static void | endpoint_state_cb (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static struct app_forwards * | forwards_create (struct stasis_app *app, const char *id) |
static struct app_forwards * | forwards_create_bridge (struct stasis_app *app, struct ast_bridge *bridge) |
static struct app_forwards * | forwards_create_channel (struct stasis_app *app, struct ast_channel *chan) |
static struct app_forwards * | forwards_create_endpoint (struct stasis_app *app, struct ast_endpoint *endpoint) |
static void | forwards_dtor (void *obj) |
static int | forwards_filter_by_type (void *obj, void *arg, int flags) |
static int | forwards_sort (const void *obj_left, const void *obj_right, int flags) |
static void | forwards_unsubscribe (struct app_forwards *forwards) |
static int | message_received_handler (const char *endpoint_id, struct ast_json *json_msg, void *pvt) |
static struct ast_json * | simple_bridge_event (const char *type, struct ast_bridge_snapshot *snapshot, const struct timeval *tv) |
static struct ast_json * | simple_channel_event (const char *type, struct ast_channel_snapshot *snapshot, const struct timeval *tv) |
static struct ast_json * | simple_endpoint_event (const char *type, struct ast_endpoint_snapshot *snapshot, const struct timeval *tv) |
int | stasis_app_event_allowed (const char *app_name, struct ast_json *event) |
Check if the given event should be filtered. More... | |
int | stasis_app_event_filter_set (struct stasis_app *app, struct ast_json *filter) |
Set the application's event type filter. More... | |
struct ast_json * | stasis_app_event_filter_to_json (struct stasis_app *app, struct ast_json *json) |
Convert and add the app's event type filter(s) to the given json object. More... | |
int | stasis_app_get_debug (struct stasis_app *app) |
Get debug status of an application. More... | |
int | stasis_app_get_debug_by_name (const char *app_name) |
Get debug status of an application. More... | |
const char * | stasis_app_name (const struct stasis_app *app) |
Retrieve an application's name. More... | |
void | stasis_app_register_event_sources (void) |
Register core event sources. More... | |
void | stasis_app_set_debug (struct stasis_app *app, int debug) |
Enable/disable request/response and event logging on an application. More... | |
void | stasis_app_set_debug_by_name (const char *app_name, int debug) |
Enable/disable request/response and event logging on an application. More... | |
void | stasis_app_set_global_debug (int debug) |
Enable/disable request/response and event logging on all applications. More... | |
void | stasis_app_to_cli (const struct stasis_app *app, struct ast_cli_args *a) |
Dump properties of a stasis_app to the CLI. More... | |
void | stasis_app_unregister_event_sources (void) |
Unregister core event sources. More... | |
static void | sub_bridge_update_handler (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static void | sub_channel_update_handler (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static void | sub_default_handler (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static void | sub_endpoint_update_handler (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static void | sub_subscription_change_handler (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static int | subscribe_bridge (struct stasis_app *app, void *obj) |
static int | subscribe_channel (struct stasis_app *app, void *obj) |
static int | subscribe_endpoint (struct stasis_app *app, void *obj) |
static int | unsubscribe (struct stasis_app *app, const char *kind, const char *id, int terminate) |
Variables | |
struct stasis_app_event_source | bridge_event_source |
struct stasis_app_event_source | channel_event_source |
static channel_snapshot_monitor | channel_monitors [] |
struct stasis_app_event_source | endpoint_event_source |
int | global_debug |
Stasis application support.
Definition in file res/stasis/app.c.
#define BRIDGE_ALL "__AST_BRIDGE_ALL_TOPIC" |
Definition at line 40 of file res/stasis/app.c.
Referenced by app_is_subscribed_bridge_id(), app_subscribe_bridge(), app_unsubscribe_bridge(), forwards_create_bridge(), and unsubscribe().
#define CHANNEL_ALL "__AST_CHANNEL_ALL_TOPIC" |
Definition at line 41 of file res/stasis/app.c.
Referenced by app_is_subscribed_channel_id(), app_subscribe_channel(), app_unsubscribe_channel(), forwards_create_channel(), and unsubscribe().
#define ENDPOINT_ALL "__AST_ENDPOINT_ALL_TOPIC" |
Definition at line 42 of file res/stasis/app.c.
Referenced by app_is_subscribed_endpoint_id(), app_subscribe_endpoint(), forwards_create_endpoint(), and unsubscribe().
typedef struct ast_json*(* channel_snapshot_monitor) (struct ast_channel_snapshot *old_snapshot, struct ast_channel_snapshot *new_snapshot, const struct timeval *tv) |
Typedef for callbacks that get called on channel snapshot updates.
Definition at line 371 of file res/stasis/app.c.
enum forward_type |
Enumerator | |
---|---|
FORWARD_CHANNEL | |
FORWARD_BRIDGE | |
FORWARD_ENDPOINT |
Definition at line 76 of file res/stasis/app.c.
struct stasis_app* app_create | ( | const char * | name, |
stasis_app_cb | handler, | ||
void * | data, | ||
enum stasis_app_subscription_model | subscription_model | ||
) |
Create a res_stasis application.
name | Name of the application. |
handler | Callback for messages sent to the application. |
data | Data pointer provided to the callback. |
res_stasis
application. NULL
on error. Definition at line 915 of file res/stasis/app.c.
References AO2_ALLOC_OPT_LOCK_MUTEX, ao2_alloc_options, ao2_bump, ao2_cleanup, AO2_CONTAINER_ALLOC_OPT_DUPS_OBJ_REJECT, ao2_container_alloc_rbtree, ao2_ref, app, app_dtor(), ast_add_extension(), ast_asprintf, ast_assert, ast_attended_transfer_type(), ast_blind_transfer_type(), ast_bridge_merge_message_type(), ast_bridge_snapshot_type(), ast_bridge_topic_all(), ast_channel_snapshot_type(), ast_context_find(), ast_context_find_or_create(), ast_endpoint_snapshot_type(), ast_free, ast_free_ptr(), ast_log, ast_strdup, ast_verb, bridge_attended_transfer_handler(), bridge_blind_transfer_handler(), bridge_merge_handler(), bridge_subscription_change_handler(), context_name, forwards_sort(), stasis_app::handler, LOG_WARNING, NULL, RAII_VAR, stasis_message_router_add(), stasis_message_router_add_cache_update(), stasis_message_router_create, stasis_message_router_set_formatters_default(), stasis_subscription_change_type(), STASIS_SUBSCRIPTION_FORMATTER_JSON, stasis_topic_create(), sub_bridge_update_handler(), sub_channel_update_handler(), sub_default_handler(), sub_endpoint_update_handler(), sub_subscription_change_handler(), and stasis_app::subscription_model.
Referenced by __stasis_app_register().
void app_deactivate | ( | struct stasis_app * | app | ) |
Deactivates an application.
Any channels currently in the application remain active (since the app might come back), but new channels are rejected.
app | Application to deactivate. |
Definition at line 1066 of file res/stasis/app.c.
References ao2_cleanup, ao2_lock, ao2_unlock, ast_verb, stasis_app::data, stasis_app::handler, stasis_app::name, and NULL.
Referenced by stasis_app_unregister().
|
static |
Definition at line 287 of file res/stasis/app.c.
References ao2_cleanup, app, ast_assert, ast_context_destroy_by_name(), ast_json_unref(), ast_verb, stasis_app::bridge_router, context_name, stasis_app::data, stasis_app::endpoint_router, stasis_app::events_allowed, stasis_app::events_disallowed, stasis_app::forwards, stasis_app::name, NULL, stasis_app::router, and stasis_app::topic.
Referenced by app_create().
|
static |
Definition at line 1718 of file res/stasis/app.c.
References ast_json_array_get(), ast_json_array_size(), ast_json_object_string_get, and ast_strings_equal().
Referenced by stasis_app_event_allowed().
|
static |
Definition at line 1655 of file res/stasis/app.c.
References ao2_lock, ao2_unlock, AST_JSON_ARRAY, ast_json_array_get(), ast_json_array_size(), AST_JSON_OBJECT, ast_json_object_get(), ast_json_object_size(), ast_json_object_string_get, ast_json_ref(), ast_json_typeof(), ast_json_unref(), ast_log, ast_strlen_zero, LOG_ERROR, stasis_app::name, and NULL.
Referenced by app_events_allowed_set(), and app_events_disallowed_set().
|
static |
Definition at line 1703 of file res/stasis/app.c.
References app_event_filter_set(), and stasis_app::events_allowed.
Referenced by stasis_app_event_filter_set().
|
static |
Definition at line 1708 of file res/stasis/app.c.
References app_event_filter_set(), and stasis_app::events_disallowed.
Referenced by stasis_app_event_filter_set().
int app_is_active | ( | struct stasis_app * | app | ) |
Checks whether an app is active.
app | Application to check. |
Definition at line 1094 of file res/stasis/app.c.
References ao2_lock, ao2_unlock, stasis_app::handler, and NULL.
Referenced by stasis_app_exec().
int app_is_finished | ( | struct stasis_app * | app | ) |
Checks whether a deactivated app has no channels.
app | Application to check. |
True | (non-zero) if app is deactivated, and has no associated channels. |
False | (zero) otherwise. |
Definition at line 1105 of file res/stasis/app.c.
References ao2_container_count(), ao2_lock, ao2_unlock, stasis_app::forwards, stasis_app::handler, and NULL.
Referenced by app_shutdown(), and cleanup_cb().
int app_is_subscribed_bridge_id | ( | struct stasis_app * | app, |
const char * | bridge_id | ||
) |
Test if an app is subscribed to a bridge.
app | Subscribing application. |
bridge_id | Id of bridge to check. |
Definition at line 1504 of file res/stasis/app.c.
References ao2_cleanup, ao2_find, ast_strlen_zero, BRIDGE_ALL, stasis_app::forwards, NULL, and OBJ_SEARCH_KEY.
int app_is_subscribed_channel_id | ( | struct stasis_app * | app, |
const char * | channel_id | ||
) |
Test if an app is subscribed to a channel.
app | Subscribing application. |
channel_id | Id of channel to check. |
Definition at line 1402 of file res/stasis/app.c.
References ao2_cleanup, ao2_find, ast_strlen_zero, CHANNEL_ALL, stasis_app::forwards, NULL, and OBJ_SEARCH_KEY.
int app_is_subscribed_endpoint_id | ( | struct stasis_app * | app, |
const char * | endpoint_id | ||
) |
Test if an app is subscribed to a endpoint.
app | Subscribing application. |
endpoint_id | Id of endpoint to check. |
Definition at line 1601 of file res/stasis/app.c.
References ao2_cleanup, ao2_find, ast_strlen_zero, ENDPOINT_ALL, stasis_app::forwards, NULL, and OBJ_SEARCH_KEY.
void app_send | ( | struct stasis_app * | app, |
struct ast_json * | message | ||
) |
Send a message to the given application.
Send a message to an application.
app | App to send the message to. |
message | Message to send. |
Definition at line 1038 of file res/stasis/app.c.
References ao2_bump, ao2_cleanup, ao2_lock, ao2_unlock, ast_eid_default, ast_eid_to_str(), ast_json_object_get(), ast_json_object_set(), ast_json_string_create(), ast_json_string_get(), ast_log, AST_LOG_WARNING, ast_verb, stasis_app::data, stasis_app::handler, and stasis_app::name.
Referenced by app_update(), message_received_handler(), stasis_app_exec(), stasis_app_send(), sub_bridge_update_handler(), sub_channel_update_handler(), sub_default_handler(), and sub_endpoint_update_handler().
void app_shutdown | ( | struct stasis_app * | app | ) |
Tears down an application.
It should be finished before calling this.
app | Application to unsubscribe. |
Definition at line 1078 of file res/stasis/app.c.
References ao2_lock, ao2_unlock, app_is_finished(), ast_assert, stasis_app::bridge_router, stasis_app::endpoint_router, NULL, stasis_app::router, and stasis_message_router_unsubscribe().
Referenced by cleanup_cb().
int app_subscribe_bridge | ( | struct stasis_app * | app, |
struct ast_bridge * | bridge | ||
) |
Add a bridge subscription to an existing channel subscription.
app | Application. |
bridge | Bridge to subscribe to. |
Definition at line 1428 of file res/stasis/app.c.
References ao2_find, ao2_link_flags, ao2_lock, ao2_ref, ao2_unlock, ast_debug, BRIDGE_ALL, stasis_app::forwards, forwards_create_bridge(), app_forwards::interested, stasis_app::name, OBJ_NOLOCK, OBJ_SEARCH_KEY, and ast_bridge::uniqueid.
Referenced by control_swap_channel_in_bridge(), stasis_app_exec(), and subscribe_bridge().
int app_subscribe_channel | ( | struct stasis_app * | app, |
struct ast_channel * | chan | ||
) |
Subscribes an application to a channel.
app | Application. |
chan | Channel to subscribe to. |
Definition at line 1281 of file res/stasis/app.c.
References ao2_find, ao2_link_flags, ao2_lock, ao2_ref, ao2_unlock, ast_channel_uniqueid(), ast_debug, CHANNEL_ALL, stasis_app::forwards, forwards_create_channel(), app_forwards::interested, stasis_app::name, OBJ_NOLOCK, and OBJ_SEARCH_KEY.
Referenced by call_forwarded_handler(), send_start_msg_snapshots(), stasis_app_subscribe_channel(), and subscribe_channel().
int app_subscribe_endpoint | ( | struct stasis_app * | app, |
struct ast_endpoint * | endpoint | ||
) |
Subscribes an application to a endpoint.
app | Application. |
chan | Endpoint to subscribe to. |
Definition at line 1531 of file res/stasis/app.c.
References ao2_find, ao2_link_flags, ao2_lock, ao2_ref, ao2_unlock, ast_debug, ast_endpoint_get_id(), ENDPOINT_ALL, stasis_app::forwards, forwards_create_endpoint(), app_forwards::interested, message_received_handler(), messaging_app_subscribe_endpoint(), stasis_app::name, OBJ_NOLOCK, and OBJ_SEARCH_KEY.
Referenced by subscribe_endpoint().
struct ast_json* app_to_json | ( | const struct stasis_app * | app | ) |
Create a JSON representation of a stasis_app
.
app | The application |
JSON
blob on success NULL
on error Definition at line 1228 of file res/stasis/app.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, array(), ast_json_array_append(), ast_json_object_get(), ast_json_pack(), ast_json_string_create(), ast_json_unref(), ast_log, bridges, channels, endpoints, FORWARD_BRIDGE, FORWARD_CHANNEL, FORWARD_ENDPOINT, app_forwards::forward_type, stasis_app::forwards, app_forwards::id, LOG_ERROR, stasis_app::name, and NULL.
Referenced by stasis_app_object_to_json().
int app_unsubscribe_bridge | ( | struct stasis_app * | app, |
struct ast_bridge * | bridge | ||
) |
Cancel the bridge subscription for an application.
forwards | Return from app_subscribe_channel(). |
bridge | Bridge to subscribe to. |
Definition at line 1486 of file res/stasis/app.c.
References app_unsubscribe_bridge_id(), BRIDGE_ALL, and ast_bridge::uniqueid.
Referenced by internal_bridge_after_cb(), and stasis_app_exec().
int app_unsubscribe_bridge_id | ( | struct stasis_app * | app, |
const char * | bridge_id | ||
) |
Cancel the subscription an app has for a bridge.
app | Subscribing application. |
bridge_id | Id of bridge to unsubscribe from. |
Definition at line 1495 of file res/stasis/app.c.
References unsubscribe().
Referenced by app_unsubscribe_bridge().
int app_unsubscribe_channel | ( | struct stasis_app * | app, |
struct ast_channel * | chan | ||
) |
Cancel the subscription an app has for a channel.
app | Subscribing application. |
chan | Channel to unsubscribe from. |
Definition at line 1384 of file res/stasis/app.c.
References app_unsubscribe_channel_id(), ast_channel_uniqueid(), and CHANNEL_ALL.
Referenced by app_send_end_msg().
int app_unsubscribe_channel_id | ( | struct stasis_app * | app, |
const char * | channel_id | ||
) |
Cancel the subscription an app has for a channel.
app | Subscribing application. |
channel_id | Id of channel to unsubscribe from. |
Definition at line 1393 of file res/stasis/app.c.
References unsubscribe().
Referenced by app_unsubscribe_channel(), and send_start_msg_snapshots().
int app_unsubscribe_endpoint_id | ( | struct stasis_app * | app, |
const char * | endpoint_id | ||
) |
Cancel the subscription an app has for a endpoint.
app | Subscribing application. |
endpoint_id | Id of endpoint to unsubscribe from. |
Definition at line 1592 of file res/stasis/app.c.
References unsubscribe().
void app_update | ( | struct stasis_app * | app, |
stasis_app_cb | handler, | ||
void * | data | ||
) |
Update the handler and data for a res_stasis
application.
If app has been deactivated, this will reactivate it.
app | Application to update. |
handler | New application callback. |
data | New data pointer for the callback. |
Definition at line 1116 of file res/stasis/app.c.
References ao2_lock, ao2_replace, ao2_unlock, app_send(), ast_json_pack(), ast_json_timeval(), ast_json_unref(), ast_tvnow(), ast_verb, stasis_app::data, stasis_app::handler, stasis_app::name, and NULL.
Referenced by __stasis_app_register().
struct stasis_topic* ast_app_get_topic | ( | struct stasis_app * | app | ) |
Returns the stasis topic for an app.
app | Stasis app to get topic of |
Definition at line 1028 of file res/stasis/app.c.
References stasis_app::topic.
Referenced by app_send_end_msg(), send_start_msg_snapshots(), and stasis_app_user_event().
|
static |
Helper function for determining if the application is subscribed to a given entity.
Definition at line 720 of file res/stasis/app.c.
References ao2_find, ao2_ref, stasis_app::forwards, NULL, and OBJ_SEARCH_KEY.
Referenced by bridge_app_subscribed_involved(), bridge_attended_transfer_handler(), bridge_blind_transfer_handler(), and bridge_merge_handler().
|
static |
Callback function for checking if channels in a bridge are subscribed to.
Definition at line 750 of file res/stasis/app.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, bridge_app_subscribed(), ast_bridge_snapshot::channels, subscribed, and ast_bridge_snapshot::uniqueid.
Referenced by bridge_attended_transfer_handler(), and bridge_blind_transfer_handler().
|
static |
Definition at line 786 of file res/stasis/app.c.
References app, AST_ATTENDED_TRANSFER_DEST_BRIDGE_MERGE, AST_ATTENDED_TRANSFER_DEST_LINK, AST_ATTENDED_TRANSFER_DEST_THREEWAY, ast_channel_snapshot::base, ast_attended_transfer_message::bridge, bridge_app_subscribed(), bridge_app_subscribed_involved(), ast_bridge_channel_snapshot_pair::bridge_snapshot, ast_bridge_channel_snapshot_pair::channel_snapshot, stasis_app::data, ast_attended_transfer_message::dest, ast_attended_transfer_message::dest_type, ast_attended_transfer_message::links, stasis_message_data(), stasis_publish(), subscribed, ast_attended_transfer_message::threeway, ast_attended_transfer_message::to_transfer_target, ast_attended_transfer_message::to_transferee, stasis_app::topic, and ast_channel_snapshot_base::uniqueid.
Referenced by app_create().
|
static |
Definition at line 773 of file res/stasis/app.c.
References app, ast_channel_snapshot::base, ast_blind_transfer_message::bridge, bridge_app_subscribed(), bridge_app_subscribed_involved(), stasis_app::data, stasis_message_data(), stasis_publish(), stasis_app::topic, ast_blind_transfer_message::transferer, and ast_channel_snapshot_base::uniqueid.
Referenced by app_create().
|
static |
Definition at line 1518 of file res/stasis/app.c.
References stasis_app_bridge_find_by_id().
|
static |
Definition at line 733 of file res/stasis/app.c.
References app, bridge_app_subscribed(), stasis_app::data, ast_bridge_merge_message::from, stasis_message_data(), stasis_publish(), ast_bridge_merge_message::to, stasis_app::topic, and ast_bridge_snapshot::uniqueid.
Referenced by app_create().
|
static |
Definition at line 832 of file res/stasis/app.c.
References ao2_cleanup, app, stasis_app::data, and stasis_subscription_final_message().
Referenced by app_create().
|
static |
Definition at line 318 of file res/stasis/app.c.
References app_subscribe_channel(), ast_channel_get_by_name(), ast_channel_unref, ast_multi_channel_blob_get_channel(), ast_channel_snapshot::base, stasis_message_data(), and ast_channel_snapshot_base::uniqueid.
Referenced by sub_default_handler().
|
static |
Definition at line 479 of file res/stasis/app.c.
References ast_channel_snapshot_caller_id_equal(), ast_channel_snapshot_to_json(), ast_describe_caller_presentation(), ast_json_pack(), ast_json_timeval(), ast_channel_snapshot::caller, NULL, ast_channel_snapshot_caller::pres, and stasis_app_get_sanitizer().
|
static |
Definition at line 509 of file res/stasis/app.c.
References ast_channel_snapshot_connected_line_equal(), ast_channel_snapshot_to_json(), ast_json_pack(), ast_json_timeval(), NULL, and stasis_app_get_sanitizer().
|
static |
Definition at line 393 of file res/stasis/app.c.
References simple_channel_event().
Referenced by channel_state().
|
static |
Definition at line 400 of file res/stasis/app.c.
References ast_cause2str(), ast_channel_snapshot_to_json(), ast_json_pack(), ast_json_timeval(), ast_channel_snapshot_hangup::cause, ast_channel_snapshot::hangup, NULL, and stasis_app_get_sanitizer().
Referenced by channel_state().
|
static |
Definition at line 445 of file res/stasis/app.c.
References ast_channel_snapshot_dialplan::appl, ast_channel_snapshot_cep_equal(), ast_channel_snapshot_to_json(), ast_json_pack(), ast_json_timeval(), AST_JSON_UTF8_VALIDATE, ast_strlen_zero, ast_channel_snapshot_dialplan::data, ast_channel_snapshot::dialplan, NULL, and stasis_app_get_sanitizer().
|
static |
Definition at line 1415 of file res/stasis/app.c.
References ast_channel_get_by_name().
|
static |
Handle channel state changes.
Definition at line 426 of file res/stasis/app.c.
References AST_FLAG_DEAD, ast_test_flag, channel_created_event(), channel_destroyed_event(), channel_state_change_event(), ast_channel_snapshot::flags, NULL, and ast_channel_snapshot::state.
|
static |
Definition at line 418 of file res/stasis/app.c.
References simple_channel_event().
Referenced by channel_state().
|
static |
Definition at line 1614 of file res/stasis/app.c.
References ast_endpoint_find_by_id().
|
static |
Definition at line 190 of file res/stasis/app.c.
References app, stasis_app::data, stasis_publish(), and stasis_app::topic.
Referenced by forwards_create_endpoint().
|
static |
Definition at line 116 of file res/stasis/app.c.
References ao2_t_alloc, ast_strlen_zero, stasis_app::forwards, forwards_dtor(), app_forwards::id, and NULL.
Referenced by forwards_create_bridge(), forwards_create_channel(), and forwards_create_endpoint().
|
static |
Forward a bridge's topics to an app
Definition at line 164 of file res/stasis/app.c.
References ao2_ref, ast_bridge_topic(), BRIDGE_ALL, FORWARD_BRIDGE, app_forwards::forward_type, stasis_app::forwards, forwards_create(), forwards_unsubscribe(), NULL, stasis_forward_all(), stasis_app::topic, app_forwards::topic_forward, and ast_bridge::uniqueid.
Referenced by app_subscribe_bridge().
|
static |
Forward a channel's topics to an app
Definition at line 136 of file res/stasis/app.c.
References ao2_ref, ast_channel_topic(), ast_channel_topic_all(), ast_channel_uniqueid(), CHANNEL_ALL, FORWARD_CHANNEL, app_forwards::forward_type, stasis_app::forwards, forwards_create(), NULL, stasis_forward_all(), stasis_app::topic, and app_forwards::topic_forward.
Referenced by app_subscribe_channel().
|
static |
Forward a endpoint's topics to an app
Definition at line 199 of file res/stasis/app.c.
References ao2_ref, ast_assert, ast_endpoint_contact_state_type(), ast_endpoint_get_id(), ast_endpoint_state_type(), ast_endpoint_topic(), ast_endpoint_topic_all_cached(), ast_endpoint_topic_cached(), ENDPOINT_ALL, stasis_app::endpoint_router, endpoint_state_cb(), FORWARD_ENDPOINT, app_forwards::forward_type, stasis_app::forwards, forwards_create(), forwards_unsubscribe(), NULL, stasis_forward_all(), stasis_message_router_add(), stasis_message_router_create, stasis_app::topic, app_forwards::topic_cached_forward, and app_forwards::topic_forward.
Referenced by app_subscribe_endpoint().
|
static |
Definition at line 98 of file res/stasis/app.c.
References ast_assert, stasis_app::forwards, NULL, app_forwards::topic_cached_forward, and app_forwards::topic_forward.
Referenced by forwards_create().
|
static |
Definition at line 1161 of file res/stasis/app.c.
References CMP_MATCH, and app_forwards::forward_type.
Referenced by stasis_app_to_cli().
|
static |
Definition at line 257 of file res/stasis/app.c.
References ast_assert, app_forwards::id, OBJ_KEY, OBJ_PARTIAL_KEY, and OBJ_POINTER.
Referenced by app_create().
|
static |
Definition at line 108 of file res/stasis/app.c.
References NULL, stasis_forward_cancel(), app_forwards::topic_cached_forward, and app_forwards::topic_forward.
Referenced by forwards_create_bridge(), forwards_create_endpoint(), and unsubscribe().
|
static |
Definition at line 584 of file res/stasis/app.c.
References ao2_ref, app, app_send(), ast_endpoint_latest_snapshot(), ast_endpoint_snapshot_to_json(), ast_json_pack(), ast_json_ref(), ast_json_timeval(), ast_json_unref(), ast_strdupa, ast_strlen_zero, ast_tvnow(), NULL, and stasis_app_get_sanitizer().
Referenced by app_subscribe_endpoint().
|
static |
Definition at line 666 of file res/stasis/app.c.
References ast_bridge_snapshot_to_json(), ast_json_pack(), ast_json_timeval(), NULL, and stasis_app_get_sanitizer().
Referenced by sub_bridge_update_handler().
|
static |
Definition at line 376 of file res/stasis/app.c.
References ast_channel_snapshot_to_json(), ast_json_pack(), ast_json_timeval(), NULL, and stasis_app_get_sanitizer().
Referenced by channel_created_event(), and channel_state_change_event().
|
static |
Definition at line 567 of file res/stasis/app.c.
References ast_endpoint_snapshot_to_json(), ast_json_pack(), ast_json_timeval(), NULL, and stasis_app_get_sanitizer().
Referenced by sub_endpoint_update_handler().
int stasis_app_event_allowed | ( | const char * | app_name, |
struct ast_json * | event | ||
) |
Check if the given event should be filtered.
Attempts first to find the event in the application's disallowed events list. If found then the event won't be sent to the remote. If not found in the disallowed list then a search is done to see if it can be found in the allowed list. If found the event message is sent, otherwise it is not sent.
app_name | The application name |
event | The event to check |
Definition at line 1739 of file res/stasis/app.c.
References ao2_lock, ao2_ref, ao2_unlock, app, app_event_filter_matched(), stasis_app::events_allowed, stasis_app::events_disallowed, and stasis_app_get_by_name().
Referenced by stasis_app_message_handler().
int stasis_app_event_filter_set | ( | struct stasis_app * | app, |
struct ast_json * | filter | ||
) |
Set the application's event type filter.
app | The application |
filter | The allowed and/or disallowed event filter |
Definition at line 1713 of file res/stasis/app.c.
References app_events_allowed_set(), and app_events_disallowed_set().
Referenced by ast_ari_applications_filter().
struct ast_json* stasis_app_event_filter_to_json | ( | struct stasis_app * | app, |
struct ast_json * | json | ||
) |
Convert and add the app's event type filter(s) to the given json object.
app | The application |
json | The json object to add the filter data to |
Definition at line 1641 of file res/stasis/app.c.
References ast_json_array_create(), ast_json_object_set(), ast_json_ref(), stasis_app::events_allowed, and stasis_app::events_disallowed.
Referenced by stasis_app_object_to_json().
int stasis_app_get_debug | ( | struct stasis_app * | app | ) |
Get debug status of an application.
app | The app to check |
Definition at line 863 of file res/stasis/app.c.
References stasis_app::debug, and global_debug.
int stasis_app_get_debug_by_name | ( | const char * | app_name | ) |
Get debug status of an application.
app_name | The app_name to check |
Definition at line 868 of file res/stasis/app.c.
References ao2_ref, app, stasis_app::debug, global_debug, and stasis_app_get_by_name().
Referenced by ast_ari_callback(), and stasis_app_message_handler().
const char* stasis_app_name | ( | const struct stasis_app * | app | ) |
Retrieve an application's name.
app | An application |
Definition at line 1156 of file res/stasis/app.c.
References stasis_app::name.
Referenced by app_compare(), app_hash(), app_send_end_msg(), app_subscribe(), app_unsubscribe(), append_name(), ari_set_debug(), bridge_stasis_push_peek(), cleanup_cb(), device_state_subscription_create(), devices_to_json(), find_device_state_subscription(), send_start_msg_snapshots(), stasis_app_exec(), and subscribe_device_state().
void stasis_app_register_event_sources | ( | void | ) |
Register core event sources.
Definition at line 1627 of file res/stasis/app.c.
References stasis_app_register_event_source().
Referenced by load_module().
void stasis_app_set_debug | ( | struct stasis_app * | app, |
int | debug | ||
) |
Enable/disable request/response and event logging on an application.
app | The app to debug |
debug | If non-zero, enable debugging. If zero, disable. |
Definition at line 842 of file res/stasis/app.c.
References stasis_app::debug.
Referenced by ari_set_debug(), and stasis_app_set_global_debug().
void stasis_app_set_debug_by_name | ( | const char * | app_name, |
int | debug | ||
) |
Enable/disable request/response and event logging on an application.
app_name | The app name to debug |
debug | If non-zero, enable debugging. If zero, disable. |
Definition at line 851 of file res/stasis/app.c.
References ao2_cleanup, app, stasis_app::debug, and stasis_app_get_by_name().
void stasis_app_set_global_debug | ( | int | debug | ) |
Enable/disable request/response and event logging on all applications.
debug | If non-zero, enable debugging. If zero, disable. |
Definition at line 887 of file res/stasis/app.c.
References ao2_cleanup, ao2_container_count(), ao2_iterator_cleanup(), ao2_iterator_init(), ao2_iterator_next, app, app_name(), stasis_app::debug, global_debug, stasis_app_get_all(), stasis_app_get_by_name(), and stasis_app_set_debug().
Referenced by ari_set_debug().
void stasis_app_to_cli | ( | const struct stasis_app * | app, |
struct ast_cli_args * | a | ||
) |
Dump properties of a stasis_app
to the CLI.
app | The application |
a | The CLI arguments |
Definition at line 1173 of file res/stasis/app.c.
References ao2_callback, ao2_container_count(), ao2_iterator_destroy(), ao2_iterator_next, ao2_ref, ast_cli(), bridges, channels, stasis_app::debug, endpoints, ast_cli_args::fd, FORWARD_BRIDGE, FORWARD_CHANNEL, FORWARD_ENDPOINT, stasis_app::forwards, forwards_filter_by_type(), app_forwards::id, app_forwards::interested, stasis_app::name, OBJ_MULTIPLE, STASIS_APP_SUBSCRIBE_ALL, and stasis_app::subscription_model.
Referenced by ari_show_app().
void stasis_app_unregister_event_sources | ( | void | ) |
Unregister core event sources.
Definition at line 1634 of file res/stasis/app.c.
References stasis_app_unregister_event_source().
Referenced by unload_module().
|
static |
Definition at line 682 of file res/stasis/app.c.
References app, app_send(), ast_json_object_set(), ast_json_string_create(), ast_json_unref(), ast_strlen_zero, stasis_app::data, ast_bridge_snapshot_update::new_snapshot, NULL, ast_bridge_snapshot_update::old_snapshot, simple_bridge_event(), stasis_message_data(), stasis_message_timestamp(), ast_bridge_snapshot::uniqueid, unsubscribe(), update(), and ast_bridge_snapshot::video_source_id.
Referenced by app_create().
|
static |
Definition at line 543 of file res/stasis/app.c.
References app, app_send(), ARRAY_LEN, AST_FLAG_DEAD, ast_json_unref(), ast_test_flag, ast_channel_snapshot::base, channel_monitors, stasis_app::data, ast_channel_snapshot::flags, ast_channel_snapshot_update::new_snapshot, ast_channel_snapshot_update::old_snapshot, stasis_message_data(), stasis_message_timestamp(), ast_channel_snapshot_base::uniqueid, unsubscribe(), and update().
Referenced by app_create().
|
static |
Definition at line 347 of file res/stasis/app.c.
References app, app_send(), ast_channel_dial_type(), ast_json_unref(), call_forwarded_handler(), stasis_app::data, stasis_app_get_sanitizer(), stasis_message_to_json(), and stasis_message_type().
Referenced by app_create().
|
static |
Definition at line 628 of file res/stasis/app.c.
References app, app_send(), ast_assert, ast_endpoint_snapshot_type(), ast_json_unref(), stasis_app::data, ast_endpoint_snapshot::id, stasis_cache_update::new_snapshot, stasis_cache_update::old_snapshot, simple_endpoint_event(), stasis_cache_update_type(), stasis_message_data(), stasis_message_timestamp(), stasis_message_type(), stasis_cache_update::type, unsubscribe(), and update().
Referenced by app_create().
|
static |
Definition at line 337 of file res/stasis/app.c.
References ao2_cleanup, app, stasis_app::data, and stasis_subscription_final_message().
Referenced by app_create().
|
static |
Definition at line 1481 of file res/stasis/app.c.
References app_subscribe_bridge().
|
static |
Definition at line 1334 of file res/stasis/app.c.
References app_subscribe_channel().
|
static |
Definition at line 1587 of file res/stasis/app.c.
References app_subscribe_endpoint().
|
static |
Definition at line 1339 of file res/stasis/app.c.
References ao2_find, ao2_lock, ao2_ref, ao2_unlock, ast_debug, ast_log, BRIDGE_ALL, CHANNEL_ALL, ENDPOINT_ALL, stasis_app::forwards, forwards_unsubscribe(), app_forwards::interested, LOG_WARNING, messaging_app_unsubscribe_endpoint(), stasis_app::name, OBJ_NODATA, OBJ_NOLOCK, OBJ_POINTER, OBJ_SEARCH_KEY, and OBJ_UNLINK.
Referenced by app_unsubscribe_bridge_id(), app_unsubscribe_channel_id(), app_unsubscribe_endpoint_id(), sub_bridge_update_handler(), sub_channel_update_handler(), and sub_endpoint_update_handler().
struct stasis_app_event_source bridge_event_source |
Definition at line 1523 of file res/stasis/app.c.
struct stasis_app_event_source channel_event_source |
Definition at line 1420 of file res/stasis/app.c.
|
static |
Definition at line 536 of file res/stasis/app.c.
Referenced by sub_channel_update_handler().
struct stasis_app_event_source endpoint_event_source |
Definition at line 1619 of file res/stasis/app.c.
int global_debug |
Global debug flag. No need for locking
Definition at line 45 of file res/stasis/app.c.
Referenced by stasis_app_get_debug(), stasis_app_get_debug_by_name(), and stasis_app_set_global_debug().