Asterisk - The Open Source Telephony Project GIT-master-8f1982c
|
Stasis Messages and Data Types for Bridge Objects. More...
#include "asterisk.h"
#include "asterisk/astobj2.h"
#include "asterisk/stasis.h"
#include "asterisk/stasis_cache_pattern.h"
#include "asterisk/channel.h"
#include "asterisk/stasis_bridges.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/bridge.h"
#include "asterisk/bridge_technology.h"
Go to the source code of this file.
Macros | |
#define | SNAPSHOT_CHANNELS_BUCKETS 1 |
Functions | |
int | ast_attended_transfer_message_add_app (struct ast_attended_transfer_message *transfer_msg, const char *app, struct ast_channel *replace_channel) |
Add details for an attended transfer to an application. More... | |
int | ast_attended_transfer_message_add_link (struct ast_attended_transfer_message *transfer_msg, struct ast_channel *locals[2]) |
Add details for an attended transfer that has a link between bridges. More... | |
int | ast_attended_transfer_message_add_merge (struct ast_attended_transfer_message *transfer_msg, struct ast_bridge *final_bridge) |
Add details for a bridge merge to an attended transfer message. More... | |
int | ast_attended_transfer_message_add_threeway (struct ast_attended_transfer_message *transfer_msg, struct ast_channel *survivor_channel, struct ast_bridge *survivor_bridge) |
Add details for an attended transfer that was resolved as a three-way call. More... | |
struct ast_attended_transfer_message * | ast_attended_transfer_message_create (int is_external, struct ast_channel *to_transferee, struct ast_bridge *transferee_bridge, struct ast_channel *to_transfer_target, struct ast_bridge *target_bridge, struct ast_channel *transferee, struct ast_channel *transfer_target) |
Create an Attended transfer message to be published. More... | |
struct ast_blind_transfer_message * | ast_blind_transfer_message_create (int is_external, struct ast_channel *transferer, const char *exten, const char *context) |
Create a blind transfer message to be published. More... | |
struct stasis_message * | ast_bridge_blob_create (struct stasis_message_type *message_type, struct ast_bridge *bridge, struct ast_channel *chan, struct ast_json *blob) |
Creates a ast_bridge_blob message. More... | |
struct stasis_message * | ast_bridge_blob_create_from_snapshots (struct stasis_message_type *message_type, struct ast_bridge_snapshot *bridge_snapshot, struct ast_channel_snapshot *chan_snapshot, struct ast_json *blob) |
Creates a ast_bridge_blob message from snapshots. More... | |
struct ast_bridge_snapshot * | ast_bridge_get_snapshot (struct ast_bridge *bridge) |
Returns the current snapshot for the bridge. More... | |
struct ast_bridge_snapshot * | ast_bridge_get_snapshot_by_uniqueid (const char *uniqueid) |
Returns the current snapshot for the bridge. More... | |
static struct ast_json * | ast_bridge_merge_message_to_json (struct stasis_message *msg, const struct stasis_message_sanitizer *sanitize) |
void | ast_bridge_publish_attended_transfer (struct ast_attended_transfer_message *transfer_msg) |
Publish an attended transfer. More... | |
void | ast_bridge_publish_blind_transfer (struct ast_blind_transfer_message *transfer_message) |
Publish a blind transfer event. More... | |
void | ast_bridge_publish_enter (struct ast_bridge *bridge, struct ast_channel *chan, struct ast_channel *swap) |
Publish a bridge channel enter event. More... | |
void | ast_bridge_publish_leave (struct ast_bridge *bridge, struct ast_channel *chan) |
Publish a bridge channel leave event. More... | |
void | ast_bridge_publish_merge (struct ast_bridge *to, struct ast_bridge *from) |
Publish a bridge merge. More... | |
void | ast_bridge_publish_state (struct ast_bridge *bridge) |
Publish the state of a bridge. More... | |
struct ast_bridge_snapshot * | ast_bridge_snapshot_create (struct ast_bridge *bridge) |
Generate a snapshot of the bridge state. This is an ao2 object, so ao2_cleanup() to deallocate. More... | |
struct ast_json * | ast_bridge_snapshot_to_json (const struct ast_bridge_snapshot *snapshot, const struct stasis_message_sanitizer *sanitize) |
Build a JSON object from a ast_bridge_snapshot. More... | |
struct stasis_topic * | ast_bridge_topic (struct ast_bridge *bridge) |
A topic which publishes the events for a particular bridge. More... | |
struct stasis_topic * | ast_bridge_topic_all (void) |
A topic which publishes the events for all bridges. More... | |
int | ast_bridge_topic_exists (const char *uniqueid) |
Check if a stasis topic exists for a bridge uniqueid. More... | |
static struct ast_json * | ast_channel_entered_bridge_to_json (struct stasis_message *msg, const struct stasis_message_sanitizer *sanitize) |
static struct ast_json * | ast_channel_left_bridge_to_json (struct stasis_message *msg, const struct stasis_message_sanitizer *sanitize) |
int | ast_stasis_bridging_init (void) |
static void | attended_transfer_dtor (void *obj) |
static struct ast_manager_event_blob * | attended_transfer_to_ami (struct stasis_message *message) |
static struct ast_json * | attended_transfer_to_json (struct stasis_message *msg, const struct stasis_message_sanitizer *sanitize) |
static void | blind_transfer_dtor (void *obj) |
static struct ast_manager_event_blob * | blind_transfer_to_ami (struct stasis_message *message) |
static struct ast_json * | blind_transfer_to_json (struct stasis_message *msg, const struct stasis_message_sanitizer *sanitize) |
static void | bridge_blob_dtor (void *obj) |
static void | bridge_channel_snapshot_pair_cleanup (struct ast_bridge_channel_snapshot_pair *pair) |
static int | bridge_channel_snapshot_pair_init (struct ast_channel *channel, struct ast_bridge *bridge, struct ast_bridge_channel_snapshot_pair *snapshot_pair) |
static struct ast_bridge_merge_message * | bridge_merge_message_create (struct ast_bridge *to, struct ast_bridge *from) |
Bridge merge message creation helper. More... | |
static void | bridge_merge_message_dtor (void *obj) |
Destructor for bridge merge messages. More... | |
static void | bridge_publish_state_from_blob (struct ast_bridge *bridge, struct ast_bridge_blob *obj) |
static void | bridge_snapshot_dtor (void *obj) |
Destructor for bridge snapshots. More... | |
static struct ast_bridge_snapshot_update * | bridge_snapshot_update_create (struct ast_bridge_snapshot *old, struct ast_bridge_snapshot *new) |
static void | bridge_snapshot_update_dtor (void *obj) |
void | bridge_topics_destroy (struct ast_bridge *bridge) |
int | bridge_topics_init (struct ast_bridge *bridge) |
static const char * | capability2str (uint32_t capabilities) |
static struct ast_json * | container_to_json_array (struct ao2_container *items, const struct stasis_message_sanitizer *sanitize) |
static struct ast_json * | simple_bridge_channel_event (const char *type, struct ast_bridge_snapshot *bridge_snapshot, struct ast_channel_snapshot *channel_snapshot, const struct timeval *tv, const struct stasis_message_sanitizer *sanitize) |
static void | stasis_bridging_cleanup (void) |
STASIS_MESSAGE_TYPE_DEFN (ast_attended_transfer_type,.to_json=attended_transfer_to_json,.to_ami=attended_transfer_to_ami) | |
STASIS_MESSAGE_TYPE_DEFN (ast_blind_transfer_type,.to_json=blind_transfer_to_json,.to_ami=blind_transfer_to_ami) | |
STASIS_MESSAGE_TYPE_DEFN (ast_bridge_merge_message_type,.to_json=ast_bridge_merge_message_to_json) | |
STASIS_MESSAGE_TYPE_DEFN (ast_bridge_snapshot_type) | |
Define bridge message types. More... | |
STASIS_MESSAGE_TYPE_DEFN (ast_channel_entered_bridge_type,.to_json=ast_channel_entered_bridge_to_json) | |
STASIS_MESSAGE_TYPE_DEFN (ast_channel_left_bridge_type,.to_json=ast_channel_left_bridge_to_json) | |
Variables | |
static struct stasis_topic * | bridge_topic_all |
static struct stasis_topic_pool * | bridge_topic_pool |
static const char * | result_strs [] |
Stasis Messages and Data Types for Bridge Objects.
Definition in file stasis_bridges.c.
#define SNAPSHOT_CHANNELS_BUCKETS 1 |
Definition at line 44 of file stasis_bridges.c.
int ast_attended_transfer_message_add_app | ( | struct ast_attended_transfer_message * | transfer_msg, |
const char * | app, | ||
struct ast_channel * | replace_channel | ||
) |
Add details for an attended transfer to an application.
If the transfer is sending one or more parties into an application, then this should be called to add appropriate details to the transfer message being published.
transfer_msg | The message to add details to |
app | The name of the application that the parties are being transferred to |
replace_channel | The local channel that is in the bridge and running the application |
0 | Success |
-1 | Failure |
Definition at line 1351 of file stasis_bridges.c.
References app, ast_attended_transfer_message::app, AST_ATTENDED_TRANSFER_DEST_APP, AST_ATTENDED_TRANSFER_DEST_LOCAL_APP, ast_channel_snapshot_get_latest(), ast_channel_uniqueid(), ast_copy_string(), ast_attended_transfer_message::dest, ast_attended_transfer_message::dest_type, and ast_attended_transfer_message::replace_channel.
Referenced by ast_bridge_transfer_attended(), and attended_transfer_bridge().
int ast_attended_transfer_message_add_link | ( | struct ast_attended_transfer_message * | transfer_msg, |
struct ast_channel * | locals[2] | ||
) |
Add details for an attended transfer that has a link between bridges.
An attended transfer may be accomplished by linking two bridges together with local channels. If this is how the transfer is to be completed, call this function in order to fill in details about the transfer.
transfer_msg | The message to add details to. |
locals | An array of local channel halves that each are in one of the involved bridges. |
0 | Success |
-1 | Failure |
Definition at line 1368 of file stasis_bridges.c.
References AST_ATTENDED_TRANSFER_DEST_LINK, ast_channel_snapshot_get_latest(), ast_channel_uniqueid(), ast_attended_transfer_message::dest, ast_attended_transfer_message::dest_type, ast_attended_transfer_message::links, and locals.
Referenced by attended_transfer_bridge().
int ast_attended_transfer_message_add_merge | ( | struct ast_attended_transfer_message * | transfer_msg, |
struct ast_bridge * | final_bridge | ||
) |
Add details for a bridge merge to an attended transfer message.
If the transfer is accomplished by a bridge merge (or swap optimization), then this should be called on the created attended transfer message to have the appropriate details added on.
transfer_msg | The transfer message to add details to |
final_bridge | The bridge where the surviving parties reside |
0 | Success |
-1 | Failure |
Definition at line 1321 of file stasis_bridges.c.
References AST_ATTENDED_TRANSFER_DEST_BRIDGE_MERGE, ast_copy_string(), ast_attended_transfer_message::bridge, ast_attended_transfer_message::dest, ast_attended_transfer_message::dest_type, and ast_bridge::uniqueid.
Referenced by publish_transfer_success(), and two_bridge_attended_transfer().
int ast_attended_transfer_message_add_threeway | ( | struct ast_attended_transfer_message * | transfer_msg, |
struct ast_channel * | survivor_channel, | ||
struct ast_bridge * | survivor_bridge | ||
) |
Add details for an attended transfer that was resolved as a three-way call.
If the transfer results in a three-way call between the transferer, the transferee, and the transfer target, then this should be called in order to add appropriate details to the transfer message to be published.
transfer_msg | The message to add details to |
survivor_channel | The transferer channel that exists in the three-way call |
survivor_bridge | The bridge where the three-way call takes place. |
0 | Success |
-1 | Failure |
Definition at line 1331 of file stasis_bridges.c.
References AST_ATTENDED_TRANSFER_DEST_THREEWAY, ast_channel_uniqueid(), ast_channel_snapshot::base, ast_bridge_channel_snapshot_pair::bridge_snapshot, ast_bridge_channel_snapshot_pair::channel_snapshot, ast_attended_transfer_message::dest, ast_attended_transfer_message::dest_type, ast_attended_transfer_message::threeway, ast_attended_transfer_message::to_transfer_target, ast_attended_transfer_message::to_transferee, ast_bridge_snapshot::uniqueid, ast_bridge::uniqueid, and ast_channel_snapshot_base::uniqueid.
Referenced by publish_transfer_threeway().
struct ast_attended_transfer_message * ast_attended_transfer_message_create | ( | int | is_external, |
struct ast_channel * | to_transferee, | ||
struct ast_bridge * | transferee_bridge, | ||
struct ast_channel * | to_transfer_target, | ||
struct ast_bridge * | target_bridge, | ||
struct ast_channel * | transferee, | ||
struct ast_channel * | transfer_target | ||
) |
Create an Attended transfer message to be published.
The parameters to this function are the basic necessities in order to create the initial attended transfer message.
The transferee and transfer_target parameters are optional. If not provided, then this function will attempt to determine who the transferee and transfer target are based on the input transferer channels and bridges. You typically will not need to provide an explicit transferee and transfer target channel unless your attended transfer is implemented in a strange way.
is_external | Non-zero if the transfer was initiated by a native channel driver protocol. |
to_transferee | The transferer channel that is bridged to the transferee channel. |
transferee_bridge | The bridge between the transferer and transferee. May be NULL. |
to_transfer_target | The transferer channel that is bridged to the transfer target. |
target_bridge | The bridge between the transferer and transfer target. May be NULL. |
transferee | The channel that is being transferred. Optional. |
transfer_target | The channel that is being transferred to. Optional. |
NULL | Failure to allocate or create snapshots |
non-NULL | The created attended transfer message |
Definition at line 1264 of file stasis_bridges.c.
References ao2_alloc, ao2_cleanup, ast_bridge_peer(), ast_channel_snapshot_get_latest(), ast_channel_uniqueid(), attended_transfer_dtor(), bridge_channel_snapshot_pair_init(), NULL, ast_attended_transfer_message::target, ast_attended_transfer_message::to_transfer_target, ast_attended_transfer_message::to_transferee, and ast_attended_transfer_message::transferee.
Referenced by ast_bridge_transfer_attended(), publish_transfer_fail(), publish_transfer_success(), and publish_transfer_threeway().
struct ast_blind_transfer_message * ast_blind_transfer_message_create | ( | int | is_external, |
struct ast_channel * | transferer, | ||
const char * | exten, | ||
const char * | context | ||
) |
Create a blind transfer message to be published.
is_external | Whether the blind transfer was initiated externally (e.g. via AMI or native protocol) |
transferer | The transferer's channel that is bridged to the transferee |
exten | The destination extension for the blind transfer |
context | The destination context for the blind transfer |
NULL | Failure to allocate or create snapshots |
non-NULL | The created blind transfer message |
Definition at line 967 of file stasis_bridges.c.
References ao2_alloc, ao2_cleanup, ast_channel_snapshot_get_latest(), ast_channel_uniqueid(), ast_copy_string(), blind_transfer_dtor(), voicemailpwcheck::context, ast_blind_transfer_message::context, ast_blind_transfer_message::exten, ast_blind_transfer_message::is_external, NULL, and ast_blind_transfer_message::transferer.
Referenced by ast_bridge_transfer_blind(), and AST_TEST_DEFINE().
struct stasis_message * ast_bridge_blob_create | ( | struct stasis_message_type * | type, |
struct ast_bridge * | bridge, | ||
struct ast_channel * | chan, | ||
struct ast_json * | blob | ||
) |
Creates a ast_bridge_blob message.
The blob JSON object requires a "type"
field describing the blob. It should also be treated as immutable and not modified after it is put into the message.
type | |
bridge | Channel blob is associated with, or NULL for global/all bridges. |
chan | The channel that started the bridge |
blob | JSON object representing the data. |
NULL | on error |
Definition at line 538 of file stasis_bridges.c.
References ao2_alloc, ao2_ref, ast_bridge_snapshot_create(), ast_channel_snapshot_get_latest(), ast_channel_uniqueid(), ast_json_ref(), ast_bridge_blob::blob, ast_bridge_blob::bridge, bridge_blob_dtor(), ast_bridge_blob::channel, NULL, and stasis_message_create().
Referenced by ast_bridge_publish_enter(), ast_bridge_publish_leave(), and send_conf_stasis().
struct stasis_message * ast_bridge_blob_create_from_snapshots | ( | struct stasis_message_type * | type, |
struct ast_bridge_snapshot * | bridge_snapshot, | ||
struct ast_channel_snapshot * | chan_snapshot, | ||
struct ast_json * | blob | ||
) |
Creates a ast_bridge_blob message from snapshots.
The blob JSON object requires a "type"
field describing the blob. It should also be treated as immutable and not modified after it is put into the message.
type | |
bridge_snapshot | Bridge snapshot |
chan_snapshot | Channel snapshot |
blob | JSON object representing the data. |
NULL | on error |
Definition at line 584 of file stasis_bridges.c.
References ao2_alloc, ao2_bump, ao2_ref, ast_json_ref(), ast_bridge_blob::blob, ast_bridge_blob::bridge, bridge_blob_dtor(), ast_bridge_blob::channel, NULL, and stasis_message_create().
Referenced by send_conf_stasis_snapshots().
struct ast_bridge_snapshot * ast_bridge_get_snapshot | ( | struct ast_bridge * | bridge | ) |
Returns the current snapshot for the bridge.
The returned pointer is AO2 managed, so ao2_cleanup() when you're done.
bridge | The bridge from which to get the snapshot. |
NULL | if there isn't a snapshot. |
Definition at line 1416 of file stasis_bridges.c.
References ao2_bump, ast_bridge_lock, ast_bridge_unlock, ast_bridge::current_snapshot, and NULL.
Referenced by ast_ari_bridges_list(), ast_refer_notify_transfer_request(), bridges_scrape_cb(), handle_bridge_show_all(), send_bridge_list_item_cb(), and test_cel_generate_peer_str_snapshot().
struct ast_bridge_snapshot * ast_bridge_get_snapshot_by_uniqueid | ( | const char * | bridge_id | ) |
Returns the current snapshot for the bridge.
The returned pointer is AO2 managed, so ao2_cleanup() when you're done.
bridge_id | Uniqueid of the bridge from which to get the snapshot. |
NULL | if bridge or snapshot doesn't exist. |
Definition at line 1397 of file stasis_bridges.c.
References ao2_bump, ao2_ref, ast_assert, ast_bridge_find_by_id(), ast_bridge_lock, ast_bridge_unlock, ast_strlen_zero(), ast_bridge::current_snapshot, NULL, and ast_bridge_snapshot::uniqueid.
Referenced by action_coreshowchannelmap(), ast_ari_bridges_get(), coreshowchannelmap_add_connected_channels(), find_bridge(), handle_bridge_show_specific(), manager_bridge_info(), and stasis_app_user_event().
|
static |
Definition at line 476 of file stasis_bridges.c.
References ast_bridge_snapshot_to_json(), ast_json_pack(), ast_json_timeval(), ast_json_unref(), ast_bridge_merge_message::from, NULL, stasis_message_data(), stasis_message_timestamp(), and ast_bridge_merge_message::to.
void ast_bridge_publish_attended_transfer | ( | struct ast_attended_transfer_message * | transfer_msg | ) |
Publish an attended transfer.
transfer_msg | The transfer message to publish |
Definition at line 1384 of file stasis_bridges.c.
References ao2_ref, ast_attended_transfer_type(), ast_bridge_topic_all(), stasis_message_create(), and stasis_publish().
Referenced by ast_bridge_transfer_attended(), publish_transfer_fail(), publish_transfer_success(), and publish_transfer_threeway().
void ast_bridge_publish_blind_transfer | ( | struct ast_blind_transfer_message * | transfer_message | ) |
Publish a blind transfer event.
transfer_message |
Definition at line 991 of file stasis_bridges.c.
References ao2_cleanup, ast_blind_transfer_type(), ast_bridge_topic_all(), stasis, stasis_message_create(), and stasis_publish().
Referenced by ast_bridge_transfer_blind(), and AST_TEST_DEFINE().
void ast_bridge_publish_enter | ( | struct ast_bridge * | bridge, |
struct ast_channel * | chan, | ||
struct ast_channel * | swap | ||
) |
Publish a bridge channel enter event.
bridge | The bridge a channel entered |
chan | The channel that entered the bridge |
swap | The channel being swapped out of the bridge |
Definition at line 620 of file stasis_bridges.c.
References ao2_ref, ast_bridge_blob_create(), AST_BRIDGE_FLAG_INVISIBLE, ast_bridge_topic(), ast_channel_entered_bridge_type(), ast_channel_uniqueid(), ast_json_pack(), ast_json_unref(), ast_test_flag, bridge_publish_state_from_blob(), ast_bridge::feature_flags, NULL, stasis_message_data(), and stasis_publish().
Referenced by bridge_channel_internal_push_full().
void ast_bridge_publish_leave | ( | struct ast_bridge * | bridge, |
struct ast_channel * | chan | ||
) |
Publish a bridge channel leave event.
bridge | The bridge a channel left |
chan | The channel that left the bridge |
Definition at line 649 of file stasis_bridges.c.
References ao2_ref, ast_bridge_blob_create(), AST_BRIDGE_FLAG_INVISIBLE, ast_bridge_topic(), ast_channel_left_bridge_type(), ast_test_flag, bridge_publish_state_from_blob(), ast_bridge::feature_flags, NULL, stasis_message_data(), and stasis_publish().
Referenced by bridge_channel_internal_pull().
void ast_bridge_publish_merge | ( | struct ast_bridge * | to, |
struct ast_bridge * | from | ||
) |
Publish a bridge merge.
to | The bridge to which channels are being added |
from | The bridge from which channels are being removed |
Definition at line 498 of file stasis_bridges.c.
References ao2_ref, ast_assert, AST_BRIDGE_FLAG_INVISIBLE, ast_bridge_merge_message_type(), ast_bridge_topic_all(), ast_test_flag, bridge_merge_message_create(), ast_bridge::feature_flags, NULL, stasis_message_create(), and stasis_publish().
Referenced by bridge_do_merge().
void ast_bridge_publish_state | ( | struct ast_bridge * | bridge | ) |
Publish the state of a bridge.
bridge | The bridge for which to publish state |
Definition at line 388 of file stasis_bridges.c.
References ao2_cleanup, ao2_ref, ast_assert, ast_bridge_snapshot_create(), ast_bridge_snapshot_type(), ast_bridge_topic(), bridge_snapshot_update_create(), ast_bridge::current_snapshot, NULL, stasis_message_create(), stasis_publish(), and update().
Referenced by ast_bridge_set_single_src_video_mode(), ast_bridge_update_talker_src_video_mode(), bridge_reconfigured(), and bridge_register().
struct ast_bridge_snapshot * ast_bridge_snapshot_create | ( | struct ast_bridge * | bridge | ) |
Generate a snapshot of the bridge state. This is an ao2 object, so ao2_cleanup() to deallocate.
bridge | The bridge from which to generate a snapshot |
NULL | on error |
Definition at line 229 of file stasis_bridges.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_ref, AST_BRIDGE_FLAG_INVISIBLE, AST_BRIDGE_VIDEO_MODE_SINGLE_SRC, AST_BRIDGE_VIDEO_MODE_TALKER_SRC, ast_channel_uniqueid(), AST_LIST_TRAVERSE, ast_str_container_add(), ast_str_container_alloc, ast_string_field_init, ast_string_field_set, ast_test_flag, ast_bridge_channel::bridge, bridge_snapshot_dtor(), ast_bridge_snapshot::capabilities, ast_bridge_technology::capabilities, ast_bridge_channel::chan, ast_bridge_video_single_src_data::chan_vsrc, ast_bridge_video_talker_src_data::chan_vsrc, ast_bridge_snapshot::channels, ast_bridge::channels, ast_bridge_snapshot::creationtime, ast_bridge::creationtime, ast_bridge::creator, ast_bridge_channel::entry, ast_bridge_snapshot::feature_flags, ast_bridge::feature_flags, ast_bridge_video_mode::mode, ast_bridge_video_mode::mode_data, name, ast_bridge_methods::name, ast_bridge::name, ast_bridge_technology::name, NULL, ast_bridge_snapshot::num_active, ast_bridge::num_active, ast_bridge_snapshot::num_channels, ast_bridge::num_channels, ast_bridge_video_mode::single_src_data, SNAPSHOT_CHANNELS_BUCKETS, ast_bridge::softmix, ast_bridge_video_mode::talker_src_data, ast_bridge::technology, ast_bridge::uniqueid, ast_bridge::v_table, ast_bridge_softmix::video_mode, and ast_bridge_snapshot::video_mode.
Referenced by ast_ari_bridges_create(), ast_ari_bridges_create_with_id(), ast_bridge_blob_create(), ast_bridge_publish_state(), ast_bridge_transfer_blind(), AST_TEST_DEFINE(), bridge_channel_snapshot_pair_init(), bridge_merge_message_create(), bridge_topics_destroy(), and send_conf_stasis_snapshots().
struct ast_json * ast_bridge_snapshot_to_json | ( | const struct ast_bridge_snapshot * | snapshot, |
const struct stasis_message_sanitizer * | sanitize | ||
) |
Build a JSON object from a ast_bridge_snapshot.
snapshot | The bridge snapshot to convert to JSON |
sanitize | The message sanitizer to use on the snapshot |
NULL | on error |
Definition at line 750 of file stasis_bridges.c.
References AST_BRIDGE_VIDEO_MODE_NONE, ast_bridge_video_mode_to_string(), ast_json_object_set(), ast_json_pack(), ast_json_string_create(), ast_json_timeval(), ast_strlen_zero(), ast_bridge_snapshot::capabilities, capability2str(), ast_bridge_snapshot::channels, container_to_json_array(), ast_bridge_snapshot::creationtime, ast_bridge_snapshot::creator, ast_bridge_snapshot::name, NULL, ast_bridge_snapshot::subclass, ast_bridge_snapshot::technology, ast_bridge_snapshot::uniqueid, ast_bridge_snapshot::video_mode, and ast_bridge_snapshot::video_source_id.
Referenced by ari_transfer_to_json(), ast_ari_bridges_create(), ast_ari_bridges_create_with_id(), ast_ari_bridges_get(), ast_ari_bridges_list(), ast_bridge_merge_message_to_json(), attended_transfer_to_json(), blind_transfer_to_json(), bridge_to_json(), multi_user_event_to_json(), simple_bridge_channel_event(), and simple_bridge_event().
struct stasis_topic * ast_bridge_topic | ( | struct ast_bridge * | bridge | ) |
A topic which publishes the events for a particular bridge.
If the given bridge is NULL
, ast_bridge_topic_all() is returned.
bridge | Bridge for which to get a topic or NULL . |
ast_bridge_topic_all() | if bridge is NULL . |
Definition at line 191 of file stasis_bridges.c.
References ast_bridge_topic_all(), and ast_bridge::topic.
Referenced by ari_bridges_play_new(), ast_ari_bridges_record(), ast_bridge_publish_enter(), ast_bridge_publish_leave(), ast_bridge_publish_state(), bridge_base_init(), bridge_publish_state_from_blob(), bridge_topics_destroy(), forwards_create_bridge(), send_conf_stasis(), and send_conf_stasis_snapshots().
struct stasis_topic * ast_bridge_topic_all | ( | void | ) |
A topic which publishes the events for all bridges.
Definition at line 186 of file stasis_bridges.c.
References bridge_topic_all.
Referenced by app_create(), ast_bridge_publish_attended_transfer(), ast_bridge_publish_blind_transfer(), ast_bridge_publish_merge(), ast_bridge_topic(), create_subscriptions(), manager_bridging_init(), manager_confbridge_init(), refer_blind_callback(), and setup_stasis_subs().
int ast_bridge_topic_exists | ( | const char * | uniqueid | ) |
Check if a stasis topic exists for a bridge uniqueid.
uniqueid | The uniqueid to test |
1 | if the topic exists |
0 | if the topic does not exist |
Definition at line 200 of file stasis_bridges.c.
References ast_asprintf, ast_free, ast_strlen_zero(), bridge_topic_pool, and stasis_topic_pool_topic_exists().
Referenced by ast_ari_bridges_create(), ast_ari_bridges_create_with_id(), and bridge_base_init().
|
static |
Definition at line 691 of file stasis_bridges.c.
References ast_bridge_blob::bridge, ast_bridge_blob::channel, simple_bridge_channel_event(), stasis_message_data(), and stasis_message_timestamp().
|
static |
Definition at line 701 of file stasis_bridges.c.
References ast_bridge_blob::bridge, ast_bridge_blob::channel, simple_bridge_channel_event(), stasis_message_data(), and stasis_message_timestamp().
int ast_stasis_bridging_init | ( | void | ) |
Definition at line 1445 of file stasis_bridges.c.
References ast_attended_transfer_type(), ast_blind_transfer_type(), ast_bridge_merge_message_type(), ast_bridge_snapshot_type(), ast_channel_entered_bridge_type(), ast_channel_left_bridge_type(), ast_register_cleanup(), bridge_topic_all, bridge_topic_pool, stasis_bridging_cleanup(), STASIS_MESSAGE_TYPE_INIT, stasis_topic_create(), and stasis_topic_pool_create().
Referenced by ast_bridging_init().
|
static |
Definition at line 1244 of file stasis_bridges.c.
References ao2_cleanup, ARRAY_LEN, AST_ATTENDED_TRANSFER_DEST_LINK, bridge_channel_snapshot_pair_cleanup(), ast_attended_transfer_message::dest, ast_attended_transfer_message::dest_type, ast_attended_transfer_message::links, ast_attended_transfer_message::replace_channel, ast_attended_transfer_message::target, ast_attended_transfer_message::to_transfer_target, ast_attended_transfer_message::to_transferee, and ast_attended_transfer_message::transferee.
Referenced by ast_attended_transfer_message_create().
|
static |
Definition at line 1141 of file stasis_bridges.c.
References ast_attended_transfer_message::app, AST_ATTENDED_TRANSFER_DEST_APP, AST_ATTENDED_TRANSFER_DEST_BRIDGE_MERGE, AST_ATTENDED_TRANSFER_DEST_FAIL, AST_ATTENDED_TRANSFER_DEST_LINK, AST_ATTENDED_TRANSFER_DEST_LOCAL_APP, AST_ATTENDED_TRANSFER_DEST_THREEWAY, ast_free_ptr(), ast_manager_build_bridge_state_string_prefix(), ast_manager_build_channel_state_string_prefix(), ast_manager_event_blob_create(), ast_str_append(), ast_str_buffer(), ast_str_create, ast_channel_snapshot::base, ast_attended_transfer_message::bridge, ast_bridge_channel_snapshot_pair::bridge_snapshot, ast_bridge_channel_snapshot_pair::channel_snapshot, ast_attended_transfer_message::dest, ast_attended_transfer_message::dest_type, EVENT_FLAG_CALL, ast_attended_transfer_message::is_external, ast_attended_transfer_message::links, ast_channel_snapshot_base::name, NULL, RAII_VAR, ast_attended_transfer_message::result, result_strs, stasis_message_data(), ast_attended_transfer_message::target, ast_attended_transfer_message::threeway, ast_attended_transfer_message::to_transfer_target, ast_attended_transfer_message::to_transferee, ast_attended_transfer_message::transferee, and ast_bridge_snapshot::uniqueid.
|
static |
Definition at line 1005 of file stasis_bridges.c.
References ast_attended_transfer_message::app, AST_ATTENDED_TRANSFER_DEST_APP, AST_ATTENDED_TRANSFER_DEST_BRIDGE_MERGE, AST_ATTENDED_TRANSFER_DEST_FAIL, AST_ATTENDED_TRANSFER_DEST_LINK, AST_ATTENDED_TRANSFER_DEST_LOCAL_APP, AST_ATTENDED_TRANSFER_DEST_THREEWAY, ast_bridge_snapshot_to_json(), ast_channel_snapshot_to_json(), ast_json_boolean(), ast_json_object_set(), ast_json_pack(), ast_json_ref(), ast_json_string_create(), ast_json_timeval(), ast_json_unref(), ast_attended_transfer_message::bridge, ast_bridge_channel_snapshot_pair::bridge_snapshot, ast_bridge_channel_snapshot_pair::channel_snapshot, ast_attended_transfer_message::dest, ast_attended_transfer_message::dest_type, ast_attended_transfer_message::is_external, ast_attended_transfer_message::links, NULL, out, RAII_VAR, ast_attended_transfer_message::replace_channel, ast_attended_transfer_message::result, result_strs, stasis_message_data(), stasis_message_timestamp(), ast_attended_transfer_message::target, ast_attended_transfer_message::threeway, ast_attended_transfer_message::to_transfer_target, ast_attended_transfer_message::to_transferee, and ast_attended_transfer_message::transferee.
|
static |
Definition at line 957 of file stasis_bridges.c.
References ao2_cleanup, ast_blind_transfer_message::bridge, ast_blind_transfer_message::replace_channel, ast_blind_transfer_message::transferee, and ast_blind_transfer_message::transferer.
Referenced by ast_blind_transfer_message_create().
|
static |
Definition at line 908 of file stasis_bridges.c.
References ast_free_ptr(), ast_manager_build_bridge_state_string(), ast_manager_build_channel_state_string_prefix(), ast_manager_event_blob_create(), ast_str_buffer(), ast_blind_transfer_message::bridge, ast_blind_transfer_message::context, EVENT_FLAG_CALL, ast_blind_transfer_message::exten, ast_blind_transfer_message::is_external, NULL, RAII_VAR, ast_blind_transfer_message::result, result_strs, stasis_message_data(), ast_blind_transfer_message::transferee, and ast_blind_transfer_message::transferer.
|
static |
Definition at line 837 of file stasis_bridges.c.
References ast_bridge_snapshot_to_json(), ast_channel_snapshot_to_json(), ast_json_boolean(), ast_json_object_set(), ast_json_pack(), ast_json_timeval(), ast_json_unref(), ast_blind_transfer_message::bridge, ast_blind_transfer_message::context, ast_blind_transfer_message::exten, ast_blind_transfer_message::is_external, NULL, out, ast_blind_transfer_message::replace_channel, ast_blind_transfer_message::result, result_strs, stasis_message_data(), stasis_message_timestamp(), ast_blind_transfer_message::transferee, and ast_blind_transfer_message::transferer.
|
static |
Definition at line 527 of file stasis_bridges.c.
References ao2_cleanup, ast_json_unref(), and NULL.
Referenced by ast_bridge_blob_create(), and ast_bridge_blob_create_from_snapshots().
|
static |
Definition at line 824 of file stasis_bridges.c.
References ao2_cleanup.
Referenced by attended_transfer_dtor().
|
static |
Definition at line 798 of file stasis_bridges.c.
References ast_bridge_lock, ast_bridge_snapshot_create(), ast_bridge_unlock, ast_channel_snapshot_get_latest(), ast_channel_uniqueid(), ast_bridge_channel_snapshot_pair::bridge_snapshot, and ast_bridge_channel_snapshot_pair::channel_snapshot.
Referenced by ast_attended_transfer_message_create().
|
static |
Bridge merge message creation helper.
Definition at line 456 of file stasis_bridges.c.
References ao2_alloc, ao2_ref, ast_bridge_snapshot_create(), bridge_merge_message_dtor(), ast_bridge_merge_message::from, NULL, and ast_bridge_merge_message::to.
Referenced by ast_bridge_publish_merge().
|
static |
Destructor for bridge merge messages.
Definition at line 445 of file stasis_bridges.c.
References ao2_cleanup, ast_bridge_merge_message::from, NULL, and ast_bridge_merge_message::to.
Referenced by bridge_merge_message_create().
|
static |
Definition at line 419 of file stasis_bridges.c.
References ao2_bump, ao2_cleanup, ao2_ref, ast_assert, ast_bridge_snapshot_type(), ast_bridge_topic(), ast_bridge_blob::bridge, bridge_snapshot_update_create(), ast_bridge::current_snapshot, NULL, stasis_message_create(), stasis_publish(), and update().
Referenced by ast_bridge_publish_enter(), and ast_bridge_publish_leave().
|
static |
Destructor for bridge snapshots.
Definition at line 221 of file stasis_bridges.c.
References ao2_cleanup, ast_string_field_free_memory, ast_bridge_snapshot::channels, and NULL.
Referenced by ast_bridge_snapshot_create().
|
static |
Definition at line 302 of file stasis_bridges.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_bump, ast_debug, bridge_snapshot_update_dtor(), NULL, and update().
Referenced by ast_bridge_publish_state(), bridge_publish_state_from_blob(), and bridge_topics_destroy().
|
static |
Definition at line 291 of file stasis_bridges.c.
References ao2_cleanup, ast_debug, and update().
Referenced by bridge_snapshot_update_create().
void bridge_topics_destroy | ( | struct ast_bridge * | bridge | ) |
Definition at line 347 of file stasis_bridges.c.
References ao2_cleanup, ao2_ref, ast_assert, ast_bridge_snapshot_create(), ast_bridge_snapshot_type(), ast_bridge_topic(), ast_debug, ast_log, BRIDGE_PRINTF_SPEC, BRIDGE_PRINTF_VARS, bridge_snapshot_update_create(), bridge_topic_pool, ast_bridge::current_snapshot, LOG_WARNING, NULL, stasis_message_create(), stasis_publish(), stasis_topic_name(), stasis_topic_pool_delete_topic(), ast_bridge::topic, and update().
Referenced by destroy_bridge().
int bridge_topics_init | ( | struct ast_bridge * | bridge | ) |
Definition at line 322 of file stasis_bridges.c.
References ao2_bump, ast_asprintf, ast_free, ast_log, ast_strlen_zero(), bridge_topic_pool, LOG_ERROR, stasis_topic_pool_get_topic(), ast_bridge::topic, and ast_bridge::uniqueid.
Referenced by bridge_base_init().
|
static |
Definition at line 741 of file stasis_bridges.c.
References AST_BRIDGE_CAPABILITY_HOLDING.
Referenced by ast_bridge_snapshot_to_json().
|
static |
Definition at line 711 of file stasis_bridges.c.
References ao2_cleanup, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ast_json_array_append(), ast_json_array_create(), ast_json_string_create(), ast_json_unref(), stasis_message_sanitizer::channel_id, item, and NULL.
Referenced by ast_bridge_snapshot_to_json().
|
static |
Definition at line 667 of file stasis_bridges.c.
References ast_bridge_snapshot_to_json(), ast_channel_snapshot_to_json(), ast_json_pack(), ast_json_timeval(), ast_json_unref(), NULL, and type.
Referenced by ast_channel_entered_bridge_to_json(), and ast_channel_left_bridge_to_json().
|
static |
Definition at line 1430 of file stasis_bridges.c.
References ao2_cleanup, ast_attended_transfer_type(), ast_blind_transfer_type(), ast_bridge_merge_message_type(), ast_bridge_snapshot_type(), ast_channel_entered_bridge_type(), ast_channel_left_bridge_type(), bridge_topic_all, bridge_topic_pool, NULL, and STASIS_MESSAGE_TYPE_CLEANUP.
Referenced by ast_stasis_bridging_init().
STASIS_MESSAGE_TYPE_DEFN | ( | ast_attended_transfer_type | , |
. | to_json = attended_transfer_to_json , |
||
. | to_ami = attended_transfer_to_ami |
||
) |
STASIS_MESSAGE_TYPE_DEFN | ( | ast_blind_transfer_type | , |
. | to_json = blind_transfer_to_json , |
||
. | to_ami = blind_transfer_to_ami |
||
) |
STASIS_MESSAGE_TYPE_DEFN | ( | ast_bridge_merge_message_type | , |
. | to_json = ast_bridge_merge_message_to_json |
||
) |
STASIS_MESSAGE_TYPE_DEFN | ( | ast_bridge_snapshot_type | ) |
Define bridge message types.
STASIS_MESSAGE_TYPE_DEFN | ( | ast_channel_entered_bridge_type | , |
. | to_json = ast_channel_entered_bridge_to_json |
||
) |
STASIS_MESSAGE_TYPE_DEFN | ( | ast_channel_left_bridge_type | , |
. | to_json = ast_channel_left_bridge_to_json |
||
) |
|
static |
Definition at line 165 of file stasis_bridges.c.
Referenced by ast_bridge_topic_all(), ast_stasis_bridging_init(), and stasis_bridging_cleanup().
|
static |
Definition at line 166 of file stasis_bridges.c.
Referenced by ast_bridge_topic_exists(), ast_stasis_bridging_init(), bridge_topics_destroy(), bridge_topics_init(), and stasis_bridging_cleanup().
|
static |
Definition at line 830 of file stasis_bridges.c.
Referenced by attended_transfer_to_ami(), attended_transfer_to_json(), blind_transfer_to_ami(), and blind_transfer_to_json().