Asterisk - The Open Source Telephony Project GIT-master-2070bb5
|
The Asterisk Management Interface - AMI (bridge event handling) More...
#include "asterisk.h"
#include "asterisk/stasis_bridges.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/manager.h"
#include "asterisk/stasis_message_router.h"
Go to the source code of this file.
Data Structures | |
struct | bridge_list_data |
Typedefs | |
typedef struct ast_manager_event_blob *(* | bridge_snapshot_monitor) (struct ast_bridge_snapshot *old_snapshot, struct ast_bridge_snapshot *new_snapshot) |
Typedef for callbacks that get called on channel snapshot updates. More... | |
Functions | |
struct ast_str * | ast_manager_build_bridge_state_string (const struct ast_bridge_snapshot *snapshot) |
Generate the AMI message body from a bridge snapshot. More... | |
struct ast_str * | ast_manager_build_bridge_state_string_prefix (const struct ast_bridge_snapshot *snapshot, const char *prefix) |
Generate the AMI message body from a bridge snapshot. More... | |
static struct ast_manager_event_blob * | bridge_create (struct ast_bridge_snapshot *old_snapshot, struct ast_bridge_snapshot *new_snapshot) |
Handle bridge creation. More... | |
static struct ast_manager_event_blob * | bridge_destroy (struct ast_bridge_snapshot *old_snapshot, struct ast_bridge_snapshot *new_snapshot) |
Handle bridge destruction. More... | |
static void | bridge_merge_cb (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static void | bridge_snapshot_update (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static struct ast_manager_event_blob * | bridge_video_update (struct ast_bridge_snapshot *old_snapshot, struct ast_bridge_snapshot *new_snapshot) |
Handle video source updates. More... | |
static void | channel_enter_cb (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static void | channel_leave_cb (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static int | manager_bridge_destroy (struct mansession *s, const struct message *m) |
static int | manager_bridge_info (struct mansession *s, const struct message *m) |
static int | manager_bridge_kick (struct mansession *s, const struct message *m) |
static int | manager_bridges_list (struct mansession *s, const struct message *m) |
static void | manager_bridging_cleanup (void) |
int | manager_bridging_init (void) |
Initialize support for AMI channel events. More... | |
static int | send_bridge_info_item_cb (void *obj, void *arg, void *data, int flags) |
static int | send_bridge_list_item_cb (void *obj, void *arg, void *data, int flags) |
Variables | |
bridge_snapshot_monitor | bridge_monitors [] |
static struct stasis_message_router * | bridge_state_router |
Message router for cached bridge state snapshot updates. More... | |
static struct stasis_forward * | topic_forwarder |
The Stasis Message Bus API subscription returned by the forwarding of the channel topic to the manager topic. More... | |
The Asterisk Management Interface - AMI (bridge event handling)
Definition in file manager_bridges.c.
typedef struct ast_manager_event_blob *(* bridge_snapshot_monitor) (struct ast_bridge_snapshot *old_snapshot, struct ast_bridge_snapshot *new_snapshot) |
Typedef for callbacks that get called on channel snapshot updates.
Definition at line 267 of file manager_bridges.c.
struct ast_str * ast_manager_build_bridge_state_string | ( | const struct ast_bridge_snapshot * | snapshot | ) |
Generate the AMI message body from a bridge snapshot.
snapshot | the bridge snapshot for which to generate an AMI message body |
NULL | on error |
Definition at line 267 of file manager_bridges.c.
References ast_manager_build_bridge_state_string_prefix().
Referenced by blind_transfer_to_ami(), bridge_snapshot_update(), channel_enter_cb(), channel_leave_cb(), confbridge_publish_manager_event(), manager_bridge_info(), and send_bridge_list_item_cb().
struct ast_str * ast_manager_build_bridge_state_string_prefix | ( | const struct ast_bridge_snapshot * | snapshot, |
const char * | prefix | ||
) |
Generate the AMI message body from a bridge snapshot.
snapshot | the bridge snapshot for which to generate an AMI message body |
prefix | What to prepend to the bridge fields |
NULL | on error |
Definition at line 223 of file manager_bridges.c.
References AST_BRIDGE_VIDEO_MODE_NONE, ast_bridge_video_mode_to_string(), ast_free, ast_str_append(), ast_str_create, ast_str_set(), ast_strlen_zero(), ast_bridge_snapshot::creator, ast_bridge_snapshot::name, NULL, ast_bridge_snapshot::num_channels, out, prefix, 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 ast_manager_build_bridge_state_string(), attended_transfer_to_ami(), bridge_merge_cb(), and multi_object_blob_to_ami().
|
static |
Handle bridge creation.
Definition at line 279 of file manager_bridges.c.
References ast_manager_event_blob_create(), EVENT_FLAG_CALL, NO_EXTRA_FIELDS, and NULL.
|
static |
Handle bridge destruction.
Definition at line 311 of file manager_bridges.c.
References ast_manager_event_blob_create(), EVENT_FLAG_CALL, NO_EXTRA_FIELDS, and NULL.
|
static |
Definition at line 362 of file manager_bridges.c.
References ast_assert, ast_free, ast_manager_build_bridge_state_string_prefix(), ast_str_buffer(), EVENT_FLAG_CALL, ast_bridge_merge_message::from, manager_event, NULL, RAII_VAR, stasis_message_data(), and ast_bridge_merge_message::to.
Referenced by manager_bridging_init().
|
static |
Definition at line 329 of file manager_bridges.c.
References ao2_cleanup, ARRAY_LEN, ast_free, ast_manager_build_bridge_state_string(), ast_str_buffer(), bridge_monitors, manager_event, NULL, RAII_VAR, stasis_message_data(), and update().
Referenced by manager_bridging_init().
|
static |
Handle video source updates.
Definition at line 292 of file manager_bridges.c.
References ast_manager_event_blob_create(), EVENT_FLAG_CALL, NULL, and ast_bridge_snapshot::video_source_id.
|
static |
Definition at line 396 of file manager_bridges.c.
References ast_free, ast_json_object_get(), ast_json_string_get(), ast_manager_build_bridge_state_string(), ast_manager_build_channel_state_string(), ast_str_buffer(), ast_bridge_blob::blob, EVENT_FLAG_CALL, manager_event, NULL, RAII_VAR, S_OR, and stasis_message_data().
Referenced by manager_bridging_init().
|
static |
Definition at line 424 of file manager_bridges.c.
References ast_free, ast_manager_build_bridge_state_string(), ast_manager_build_channel_state_string(), ast_str_buffer(), ast_bridge_blob::blob, EVENT_FLAG_CALL, manager_event, NULL, RAII_VAR, and stasis_message_data().
Referenced by manager_bridging_init().
|
static |
Definition at line 606 of file manager_bridges.c.
References ast_bridge_destroy(), ast_bridge_find_by_id(), ast_strlen_zero(), astman_get_header(), astman_send_ack(), and astman_send_error().
Referenced by manager_bridging_init().
|
static |
Definition at line 557 of file manager_bridges.c.
References ao2_callback_data, ao2_cleanup, ast_bridge_get_snapshot_by_uniqueid(), ast_free, ast_manager_build_bridge_state_string(), ast_str_buffer(), ast_str_create, ast_str_set(), ast_strlen_zero(), astman_append(), astman_get_header(), astman_send_error(), astman_send_list_complete_end(), astman_send_list_complete_start(), astman_send_listack(), bridge_list_data::count, bridge_list_data::id_text, NULL, OBJ_NODATA, RAII_VAR, and send_bridge_info_item_cb().
Referenced by manager_bridging_init().
|
static |
Definition at line 628 of file manager_bridges.c.
References ao2_cleanup, ast_bridge_find_by_id(), AST_BRIDGE_FLAG_INVISIBLE, ast_bridge_kick(), ast_channel_get_bridge(), ast_channel_get_by_name(), ast_channel_lock, ast_channel_unlock, ast_strlen_zero(), ast_test_flag, astman_get_header(), astman_send_ack(), astman_send_error(), NULL, and RAII_VAR.
Referenced by manager_bridging_init().
|
static |
Definition at line 486 of file manager_bridges.c.
References ao2_callback_data, ao2_ref, ast_bridges(), ast_free, ast_str_create, ast_str_set(), ast_strlen_zero(), astman_get_header(), astman_send_error(), astman_send_list_complete_end(), astman_send_list_complete_start(), astman_send_listack(), bridges, bridge_list_data::count, bridge_list_data::id_text, OBJ_NODATA, send_bridge_list_item_cb(), and bridge_list_data::type_filter.
Referenced by manager_bridging_init().
|
static |
Definition at line 672 of file manager_bridges.c.
References ast_manager_unregister(), NULL, stasis_forward_cancel(), and topic_forwarder.
Referenced by manager_bridging_init().
int manager_bridging_init | ( | void | ) |
Initialize support for AMI channel events.
0 | on success. |
non-zero | on error. |
Definition at line 683 of file manager_bridges.c.
References ast_bridge_merge_message_type(), ast_bridge_snapshot_type(), ast_bridge_topic_all(), ast_channel_entered_bridge_type(), ast_channel_left_bridge_type(), ast_manager_get_message_router(), ast_manager_get_topic(), ast_manager_register_xml_core, ast_register_cleanup(), bridge_merge_cb(), bridge_snapshot_update(), bridge_state_router, channel_enter_cb(), channel_leave_cb(), manager_bridge_destroy(), manager_bridge_info(), manager_bridge_kick(), manager_bridges_list(), manager_bridging_cleanup(), manager_topic, NULL, stasis_forward_all(), stasis_message_router_add(), and topic_forwarder.
Referenced by subscribe_all().
|
static |
Definition at line 524 of file manager_bridges.c.
References ao2_cleanup, AST_CHAN_TP_INTERNAL, ast_channel_snapshot_get_latest(), ast_free, ast_manager_build_channel_state_string(), ast_str_buffer(), astman_append(), bridge_list_data::count, bridge_list_data::id_text, NULL, and RAII_VAR.
Referenced by manager_bridge_info().
|
static |
Definition at line 450 of file manager_bridges.c.
References ao2_cleanup, ast_bridge_get_snapshot(), ast_free, ast_manager_build_bridge_state_string(), ast_str_buffer(), ast_strlen_zero(), astman_append(), bridge_list_data::count, bridge_list_data::id_text, RAII_VAR, and bridge_list_data::type_filter.
Referenced by manager_bridges_list().
bridge_snapshot_monitor bridge_monitors[] |
Definition at line 323 of file manager_bridges.c.
Referenced by bridge_snapshot_update().
|
static |
Message router for cached bridge state snapshot updates.
Definition at line 34 of file manager_bridges.c.
Referenced by manager_bridging_init().
|
static |
The Stasis Message Bus API subscription returned by the forwarding of the channel topic to the manager topic.
Definition at line 221 of file manager_bridges.c.
Referenced by manager_bridging_cleanup(), and manager_bridging_init().