235 "%sBridgeUniqueid: %s\r\n" 236 "%sBridgeType: %s\r\n" 237 "%sBridgeTechnology: %s\r\n" 238 "%sBridgeCreator: %s\r\n" 239 "%sBridgeName: %s\r\n" 240 "%sBridgeNumChannels: %u\r\n" 241 "%sBridgeVideoSourceMode: %s\r\n",
283 if (!new_snapshot || old_snapshot) {
296 if (!new_snapshot || !old_snapshot) {
306 "BridgePreviousVideoSource: %s\r\n",
315 if (new_snapshot || !old_snapshot) {
347 if (!bridge_event_string) {
348 bridge_event_string =
351 if (!bridge_event_string) {
358 event->extra_fields);
374 if (!to_text || !from_text) {
397 static const char *swap_name =
"SwapUniqueid: ";
405 if (!bridge_text || !channel_text) {
417 swap_id ? swap_name :
"",
419 swap_id ?
"\r\n" :
"");
431 if (!bridge_text || !channel_text) {
461 && strcmp(list_data->
type_filter, snapshot->technology)) {
471 "Event: BridgeListItem\r\n" 524 char *uniqueid = obj;
545 "Event: BridgeInfoChannel\r\n" 673 topic_forwarder =
NULL;
687 if (bridge_state_router) {
695 if (!manager_topic) {
705 if (!topic_forwarder) {
710 if (!bridge_state_router) {
struct stasis_message_type * ast_bridge_snapshot_type(void)
Message type for ast_bridge_snapshot.
Struct containing info for an AMI event to send out.
#define ast_channel_lock(chan)
Main Channel structure associated with a channel.
struct ao2_container * ast_bridges(void)
Returns the global bridges container.
void astman_append(struct mansession *s, const char *fmt,...)
Asterisk main include file. File version handling, generic pbx functions.
struct stasis_message_type * ast_channel_entered_bridge_type(void)
Message type for channel enter bridge blob messages.
struct ast_channel_snapshot * channel
struct ast_bridge * ast_bridge_find_by_id(const char *bridge_id)
Find bridge by id.
#define ast_test_flag(p, flag)
static void channel_enter_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
static void update(int code_size, int y, int wi, int fi, int dq, int sr, int dqsez, struct g726_state *state_ptr)
int stasis_message_router_add(struct stasis_message_router *router, struct stasis_message_type *message_type, stasis_subscription_cb callback, void *data)
Add a route to a message router.
struct stasis_message_type * ast_channel_left_bridge_type(void)
Message type for channel leave bridge blob messages.
void astman_send_list_complete_start(struct mansession *s, const struct message *m, const char *event_name, int count)
Start the list complete event.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
Structure that contains a snapshot of information about a bridge.
const ast_string_field video_source_id
int manager_bridging_init(void)
Initialize support for AMI channel events.
Structure representing a snapshot of channel state.
int ast_bridge_destroy(struct ast_bridge *bridge, int cause)
Destroy a bridge.
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
void astman_send_ack(struct mansession *s, const struct message *m, char *msg)
Send ack in manager transaction.
static struct stasis_topic * manager_topic
A stasis_topic that all topics AMI cares about will be forwarded to.
#define ast_manager_register_xml_core(action, authority, func)
Register a manager callback using XML documentation to describe the manager.
struct ast_manager_event_blob * ast_manager_event_blob_create(int event_flags, const char *manager_event, const char *extra_fields_fmt,...)
Construct a ast_manager_event_blob.
const ast_string_field creator
const char * astman_get_header(const struct message *m, char *var)
Get header from mananger transaction.
#define ast_strlen_zero(foo)
static int manager_bridge_destroy(struct mansession *s, const struct message *m)
static struct ast_manager_event_blob * bridge_create(struct ast_bridge_snapshot *old_snapshot, struct ast_bridge_snapshot *new_snapshot)
Handle bridge creation.
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
static int manager_bridge_info(struct mansession *s, const struct message *m)
struct ast_bridge_snapshot * bridge
struct stasis_message_type * ast_bridge_merge_message_type(void)
Message type for ast_bridge_merge_message.
struct ast_bridge * ast_channel_get_bridge(const struct ast_channel *chan)
Get the bridge associated with a channel.
const ast_string_field technology
static void bridge_snapshot_update(void *data, struct stasis_subscription *sub, struct stasis_message *message)
struct ast_bridge_snapshot * ast_bridge_get_snapshot(struct ast_bridge *bridge)
Returns the current snapshot for the bridge.
int ast_register_cleanup(void(*func)(void))
Register a function to be executed before Asterisk gracefully exits.
void astman_send_list_complete_end(struct mansession *s)
End the list complete event.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
static void manager_bridging_cleanup(void)
const char * ast_bridge_video_mode_to_string(enum ast_bridge_video_mode_type video_mode)
Converts an enum representation of a bridge video mode to string.
struct ast_str * ast_manager_build_bridge_state_string(const struct ast_bridge_snapshot *snapshot)
Generate the AMI message body from a bridge snapshot.
#define ao2_ref(o, delta)
In case you didn't read that giant block of text above the mansession_session struct, the struct mansession is named this solely to keep the API the same in Asterisk. This structure really represents data that is different from Manager action to Manager action. The mansession_session pointer contained within points to session-specific data.
static int send_bridge_list_item_cb(void *obj, void *arg, void *data, int flags)
const char * ast_json_string_get(const struct ast_json *string)
Get the value of a JSON string.
struct ast_bridge_snapshot * old_snapshot
Blob of data associated with a bridge.
Channels with this particular technology are an implementation detail of Asterisk and should generall...
struct ast_str * ast_manager_build_channel_state_string(const struct ast_channel_snapshot *snapshot)
Generate the AMI message body from a channel snapshot.
bridge_snapshot_monitor bridge_monitors[]
static int manager_bridge_kick(struct mansession *s, const struct message *m)
int ast_manager_unregister(const char *action)
Unregister a registered manager command.
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
Structure that contains information about a bridge.
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
const ast_string_field name
void * stasis_message_data(const struct stasis_message *msg)
Get the data contained in a message.
enum ast_bridge_video_mode_type video_mode
#define ao2_callback_data(container, flags, cb_fn, arg, data)
struct stasis_message_router * ast_manager_get_message_router(void)
Get the stasis_message_router for AMI.
static void bridge_merge_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
static int send_bridge_info_item_cb(void *obj, void *arg, void *data, int flags)
static struct ao2_container * bridges
#define ast_channel_unlock(chan)
int ast_bridge_kick(struct ast_bridge *bridge, struct ast_channel *chan)
Kick a channel from a bridge.
struct stasis_forward * stasis_forward_cancel(struct stasis_forward *forward)
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.
const ast_string_field uniqueid
struct ast_bridge_snapshot * new_snapshot
unsigned int num_channels
struct stasis_topic * ast_manager_get_topic(void)
Get the Stasis Message Bus API topic for AMI.
struct ast_bridge_snapshot * from
struct stasis_topic * ast_bridge_topic_all(void)
A topic which publishes the events for all bridges.
Message representing the merge of two bridges.
static struct ast_manager_event_blob * bridge_video_update(struct ast_bridge_snapshot *old_snapshot, struct ast_bridge_snapshot *new_snapshot)
static int manager_bridges_list(struct mansession *s, const struct message *m)
struct ast_channel_snapshot * ast_channel_snapshot_get_latest(const char *uniqueid)
Obtain the latest ast_channel_snapshot from the Stasis Message Bus API cache. This is an ao2 object...
static struct ast_manager_event_blob * bridge_destroy(struct ast_bridge_snapshot *old_snapshot, struct ast_bridge_snapshot *new_snapshot)
Handle bridge destruction.
struct ast_json * ast_json_object_get(struct ast_json *object, const char *key)
Get a field from a JSON object.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one...
static struct stasis_message_router * bridge_state_router
Message router for cached bridge state snapshot updates.
struct stasis_forward * sub
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.
static struct stasis_forward * topic_forwarder
The Stasis Message Bus API subscription returned by the forwarding of the channel topic to the manage...
struct stasis_forward * stasis_forward_all(struct stasis_topic *from_topic, struct stasis_topic *to_topic)
Create a subscription which forwards all messages from one topic to another.
#define manager_event(category, event, contents,...)
External routines may send asterisk manager events this way.
struct ast_channel * ast_channel_get_by_name(const char *name)
Find a channel by name.
void astman_send_error(struct mansession *s, const struct message *m, char *error)
Send error in manager transaction.
const ast_string_field subclass
struct ast_bridge_snapshot * ast_bridge_get_snapshot_by_uniqueid(const char *bridge_id)
Returns the current snapshot for the bridge.
struct ast_bridge_snapshot * to
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
static void channel_leave_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
static char prefix[MAX_PREFIX]
void astman_send_listack(struct mansession *s, const struct message *m, char *msg, char *listflag)
Send ack in manager transaction to begin a list.