Asterisk - The Open Source Telephony Project GIT-master-3dae2cf
|
The Asterisk Management Interface - AMI (channel event handling) More...
#include "asterisk.h"
#include "asterisk/callerid.h"
#include "asterisk/channel.h"
#include "asterisk/manager.h"
#include "asterisk/stasis_message_router.h"
#include "asterisk/pbx.h"
#include "asterisk/stasis_channels.h"
Go to the source code of this file.
Typedefs | |
typedef struct ast_manager_event_blob *(* | channel_snapshot_monitor) (struct ast_channel_snapshot *old_snapshot, struct ast_channel_snapshot *new_snapshot) |
Typedef for callbacks that get called on channel snapshot updates. More... | |
Variables | |
channel_snapshot_monitor | channel_monitors [] |
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 (channel event handling)
AMI generated many per-channel and global-channel events by converting Stasis messages to AMI events. It makes sense to simply put them into a single file.
Definition in file manager_channels.c.
typedef struct ast_manager_event_blob *(* channel_snapshot_monitor) (struct ast_channel_snapshot *old_snapshot, struct ast_channel_snapshot *new_snapshot) |
Typedef for callbacks that get called on channel snapshot updates.
Definition at line 539 of file manager_channels.c.
struct ast_str * ast_manager_build_channel_state_string | ( | const struct ast_channel_snapshot * | snapshot | ) |
Generate the AMI message body from a channel snapshot.
snapshot | the channel snapshot for which to generate an AMI message body |
NULL | on error |
Definition at line 539 of file manager_channels.c.
References ast_manager_build_channel_state_string_prefix().
Referenced by action_agents(), action_confbridgelist_item(), agent_login_to_ami(), agent_logoff_to_ami(), agi_channel_to_ami(), aoc_to_ami(), call_pickup_to_ami(), channel_dial_cb(), channel_dtmf_begin_cb(), channel_dtmf_end_cb(), channel_enter_cb(), channel_fax_cb(), channel_flash_cb(), channel_hangup_handler_cb(), channel_hangup_request_cb(), channel_hold_cb(), channel_leave_cb(), channel_mixmonitor_mute_cb(), channel_moh_start_cb(), channel_snapshot_update(), channel_unhold_cb(), channel_wink_cb(), confbridge_publish_manager_event(), dahdichannel_to_ami(), generate_status(), meetme_stasis_cb(), mwi_app_event_cb(), mwi_update_cb(), publish_basic_channel_event(), queue_channel_to_ami(), queue_multi_channel_to_ami(), rtcp_report_to_ami(), send_bridge_info_item_cb(), talking_start_to_ami(), talking_stop_to_ami(), and varset_to_ami().
struct ast_str * ast_manager_build_channel_state_string_prefix | ( | const struct ast_channel_snapshot * | snapshot, |
const char * | prefix | ||
) |
Generate the AMI message body from a channel snapshot.
snapshot | the channel snapshot for which to generate an AMI message body |
prefix | What to prepend to the channel fields |
NULL | on error |
Definition at line 461 of file manager_channels.c.
References ast_channel_snapshot_base::accountcode, AST_CHAN_TP_INTERNAL, ast_escape_c_alloc(), ast_free, AST_LIST_TRAVERSE, ast_state2str(), ast_str_append(), ast_str_create, ast_str_set(), ast_strlen_zero(), ast_channel_snapshot::base, ast_channel_snapshot::caller, ast_channel_snapshot::connected, ast_channel_snapshot_dialplan::context, ast_channel_snapshot::dialplan, ast_var_t::entries, ast_channel_snapshot_dialplan::exten, ast_channel_snapshot_base::language, ast_channel_snapshot_peer::linkedid, ast_channel_snapshot::manager_vars, ast_channel_snapshot_caller::name, ast_channel_snapshot_connected::name, ast_channel_snapshot_base::name, NULL, ast_channel_snapshot_caller::number, ast_channel_snapshot_connected::number, out, ast_channel_snapshot::peer, prefix, ast_channel_snapshot_dialplan::priority, S_OR, ast_channel_snapshot::state, ast_channel_snapshot_base::tech_properties, ast_channel_snapshot_base::tenantid, ast_channel_snapshot_base::uniqueid, and var.
Referenced by action_coreshowchannels(), ast_manager_build_channel_state_string(), attended_transfer_to_ami(), blind_transfer_to_ami(), call_pickup_to_ami(), channel_chanspy_start_cb(), channel_chanspy_stop_cb(), channel_dial_cb(), local_message_to_ami(), manager_build_parked_call_string(), multi_object_blob_to_ami(), and queue_multi_channel_to_ami().
|
static |
Definition at line 820 of file manager_channels.c.
References ast_free, ast_log, AST_LOG_WARNING, ast_manager_build_channel_state_string_prefix(), ast_multi_channel_blob_get_channel(), ast_str_buffer(), EVENT_FLAG_CALL, manager_event, NULL, RAII_VAR, and stasis_message_data().
Referenced by manager_channels_init().
|
static |
Definition at line 785 of file manager_channels.c.
References ast_free, ast_log, AST_LOG_WARNING, ast_manager_build_channel_state_string_prefix(), ast_multi_channel_blob_get_channel(), ast_str_buffer(), EVENT_FLAG_CALL, manager_event, NULL, RAII_VAR, and stasis_message_data().
Referenced by manager_channels_init().
|
static |
Callback processing messages for channel dialing.
Definition at line 1198 of file manager_channels.c.
References ast_assert, ast_free, ast_json_object_get(), ast_json_string_get(), ast_manager_build_channel_state_string(), ast_manager_build_channel_state_string_prefix(), ast_multi_channel_blob_get_channel(), ast_multi_channel_blob_get_json(), ast_str_buffer(), ast_strlen_zero(), ast_channel_snapshot::caller, dial_status_end(), EVENT_FLAG_CALL, manager_event, NULL, ast_channel_snapshot::peer, RAII_VAR, S_OR, and stasis_message_data().
Referenced by manager_channels_init().
|
static |
Definition at line 855 of file manager_channels.c.
References ast_free, ast_json_object_get(), ast_json_string_get(), ast_manager_build_channel_state_string(), ast_str_buffer(), ast_channel_blob::blob, digit, EVENT_FLAG_DTMF, manager_event, NULL, RAII_VAR, ast_channel_blob::snapshot, and stasis_message_data().
Referenced by manager_channels_init().
|
static |
Definition at line 901 of file manager_channels.c.
References ast_free, ast_json_integer_get(), ast_json_object_get(), ast_json_string_get(), ast_manager_build_channel_state_string(), ast_str_buffer(), ast_channel_blob::blob, digit, EVENT_FLAG_DTMF, manager_event, NULL, RAII_VAR, ast_channel_blob::snapshot, and stasis_message_data().
Referenced by manager_channels_init().
|
static |
Definition at line 1040 of file manager_channels.c.
References ast_free, ast_json_array_get(), ast_json_array_size(), ast_json_object_get(), ast_json_string_get(), ast_manager_build_channel_state_string(), ast_str_append(), ast_str_buffer(), ast_str_create, ast_channel_blob::blob, EVENT_FLAG_CALL, manager_event, NULL, RAII_VAR, ast_channel_blob::snapshot, stasis_message_data(), status, and type.
Referenced by manager_channels_init().
|
static |
Definition at line 953 of file manager_channels.c.
References ast_free, ast_manager_build_channel_state_string(), ast_str_buffer(), EVENT_FLAG_CALL, manager_event, ast_channel_blob::snapshot, and stasis_message_data().
Referenced by manager_channels_init().
|
static |
Definition at line 1009 of file manager_channels.c.
References ast_free, ast_json_object_get(), ast_json_string_get(), ast_manager_build_channel_state_string(), ast_str_buffer(), ast_channel_blob::blob, EVENT_FLAG_DIALPLAN, handler(), manager_event, NULL, RAII_VAR, ast_channel_blob::snapshot, and stasis_message_data().
Referenced by manager_channels_init().
|
static |
Definition at line 737 of file manager_channels.c.
References ast_free, ast_json_integer_get(), ast_json_is_true(), ast_json_object_get(), ast_manager_build_channel_state_string(), ast_str_append(), ast_str_buffer(), ast_str_create, ast_channel_blob::blob, EVENT_FLAG_CALL, manager_event, ast_channel_blob::snapshot, and stasis_message_data().
Referenced by manager_channels_init().
|
static |
Definition at line 1251 of file manager_channels.c.
References ast_free, ast_json_object_get(), ast_json_string_get(), ast_manager_build_channel_state_string(), ast_str_buffer(), ast_str_create, ast_str_set(), ast_strlen_zero(), ast_channel_blob::blob, EVENT_FLAG_CALL, manager_event, ast_channel_blob::snapshot, and stasis_message_data().
Referenced by manager_channels_init().
|
static |
Definition at line 1157 of file manager_channels.c.
References ast_free, ast_json_is_true(), ast_json_object_get(), ast_json_string_get(), ast_manager_build_channel_state_string(), ast_str_append(), ast_str_buffer(), ast_str_create, ast_channel_blob::blob, EVENT_FLAG_CALL, manager_event, NULL, RAII_VAR, ast_channel_blob::snapshot, and stasis_message_data().
Referenced by manager_channels_init().
|
static |
Definition at line 1141 of file manager_channels.c.
References EVENT_FLAG_CALL, publish_basic_channel_event(), ast_channel_blob::snapshot, and stasis_message_data().
Referenced by manager_channels_init().
|
static |
Definition at line 1149 of file manager_channels.c.
References EVENT_FLAG_CALL, publish_basic_channel_event(), ast_channel_blob::snapshot, and stasis_message_data().
Referenced by manager_channels_init().
|
static |
Definition at line 1113 of file manager_channels.c.
References ast_free, ast_json_object_get(), ast_json_string_get(), ast_manager_build_channel_state_string(), ast_str_buffer(), ast_channel_blob::blob, EVENT_FLAG_CALL, manager_event, NULL, RAII_VAR, ast_channel_blob::snapshot, and stasis_message_data().
Referenced by manager_channels_init().
|
static |
Definition at line 1133 of file manager_channels.c.
References EVENT_FLAG_CALL, publish_basic_channel_event(), ast_channel_blob::snapshot, and stasis_message_data().
Referenced by manager_channels_init().
|
static |
Definition at line 666 of file manager_channels.c.
References ast_channel_snapshot_base::accountcode, ast_manager_event_blob_create(), ast_channel_snapshot::base, EVENT_FLAG_CALL, and NULL.
|
static |
Definition at line 618 of file manager_channels.c.
References ast_channel_snapshot_caller_id_equal(), ast_describe_caller_presentation(), ast_escape_c_alloc(), ast_free, ast_manager_event_blob_create(), ast_channel_snapshot::caller, EVENT_FLAG_CALL, NULL, and ast_channel_snapshot_caller::pres.
|
static |
Definition at line 649 of file manager_channels.c.
References ast_channel_snapshot_connected_line_equal(), ast_manager_event_blob_create(), EVENT_FLAG_CALL, and NULL.
|
static |
Definition at line 588 of file manager_channels.c.
References ast_channel_snapshot_dialplan::appl, ast_channel_snapshot_cep_equal(), AST_FLAG_DEAD, ast_manager_event_blob_create(), ast_strlen_zero(), ast_test_flag, ast_channel_snapshot_dialplan::data, ast_channel_snapshot::dialplan, EVENT_FLAG_DIALPLAN, ast_channel_snapshot_dialplan::exten, ast_channel_snapshot::flags, and NULL.
|
static |
Definition at line 691 of file manager_channels.c.
References ao2_cleanup, ARRAY_LEN, ast_free, ast_manager_build_channel_state_string(), ast_str_buffer(), channel_monitors, manager_event, NULL, RAII_VAR, stasis_message_data(), and update().
Referenced by manager_channels_init().
|
static |
Handle channel state changes.
Definition at line 551 of file manager_channels.c.
References ast_cause2str(), AST_FLAG_DEAD, ast_manager_event_blob_create(), ast_test_flag, ast_channel_snapshot_hangup::cause, EVENT_FLAG_CALL, ast_channel_snapshot::flags, ast_channel_snapshot::hangup, NO_EXTRA_FIELDS, NULL, and ast_channel_snapshot::state.
|
static |
Definition at line 1288 of file manager_channels.c.
References ast_free, ast_manager_build_channel_state_string(), ast_str_buffer(), EVENT_FLAG_CALL, manager_event, ast_channel_blob::snapshot, and stasis_message_data().
Referenced by manager_channels_init().
|
static |
Definition at line 981 of file manager_channels.c.
References ast_free, ast_manager_build_channel_state_string(), ast_str_buffer(), EVENT_FLAG_CALL, manager_event, ast_channel_blob::snapshot, and stasis_message_data().
Referenced by manager_channels_init().
|
static |
Definition at line 1188 of file manager_channels.c.
Referenced by channel_dial_cb().
int manager_channels_init | ( | void | ) |
Initialize support for AMI channel events.
0 | on success. |
non-zero | on error. |
Definition at line 1312 of file manager_channels.c.
References ast_channel_chanspy_start_type(), ast_channel_chanspy_stop_type(), ast_channel_dial_type(), ast_channel_dtmf_begin_type(), ast_channel_dtmf_end_type(), ast_channel_fax_type(), ast_channel_flash_type(), ast_channel_hangup_handler_type(), ast_channel_hangup_request_type(), ast_channel_hold_type(), ast_channel_mixmonitor_mute_type(), ast_channel_mixmonitor_start_type(), ast_channel_mixmonitor_stop_type(), ast_channel_moh_start_type(), ast_channel_moh_stop_type(), ast_channel_snapshot_type(), ast_channel_topic_all(), ast_channel_unhold_type(), ast_channel_wink_type(), ast_manager_get_message_router(), ast_manager_get_topic(), ast_register_cleanup(), channel_chanspy_start_cb(), channel_chanspy_stop_cb(), channel_dial_cb(), channel_dtmf_begin_cb(), channel_dtmf_end_cb(), channel_fax_cb(), channel_flash_cb(), channel_hangup_handler_cb(), channel_hangup_request_cb(), channel_hold_cb(), channel_mixmonitor_mute_cb(), channel_mixmonitor_start_cb(), channel_mixmonitor_stop_cb(), channel_moh_start_cb(), channel_moh_stop_cb(), channel_snapshot_update(), channel_unhold_cb(), channel_wink_cb(), manager_channels_shutdown(), manager_topic, NULL, stasis_forward_all(), stasis_message_router_add(), and topic_forwarder.
Referenced by subscribe_all().
|
static |
Definition at line 1306 of file manager_channels.c.
References NULL, stasis_forward_cancel(), and topic_forwarder.
Referenced by manager_channels_init().
|
static |
Definition at line 723 of file manager_channels.c.
References ast_free, ast_manager_build_channel_state_string(), ast_str_buffer(), manager_event, NULL, and RAII_VAR.
Referenced by channel_mixmonitor_start_cb(), channel_mixmonitor_stop_cb(), and channel_moh_stop_cb().
channel_snapshot_monitor channel_monitors[] |
Definition at line 683 of file manager_channels.c.
Referenced by channel_snapshot_update().
|
static |
The Stasis Message Bus API subscription returned by the forwarding of the channel topic to the manager topic.
Definition at line 459 of file manager_channels.c.
Referenced by manager_channels_init(), and manager_channels_shutdown().