Asterisk - The Open Source Telephony Project
18.5.0
|
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 568 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 |
ast_str* | on success (must be ast_freed by caller) |
Definition at line 561 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(), 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(), session_timeout_to_ami(), 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 |
ast_str* | on success (must be ast_freed by caller) |
Definition at line 487 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_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_var_t::name, 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, ast_channel_snapshot_dialplan::priority, S_OR, ast_channel_snapshot::state, ast_channel_snapshot_base::tech_properties, ast_channel_snapshot_base::uniqueid, ast_var_t::value, 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 842 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 807 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 1194 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 877 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 921 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 1020 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 971 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 989 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 759 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 1247 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, musicclass, ast_channel_blob::snapshot, and stasis_message_data().
Referenced by manager_channels_init().
|
static |
Definition at line 1153 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 1137 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 1145 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 1093 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 1113 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 1121 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 1129 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 688 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 640 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 671 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 610 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 713 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, ast_channel_snapshot_update::new_snapshot, NULL, ast_channel_snapshot_update::old_snapshot, RAII_VAR, stasis_message_data(), and update().
Referenced by manager_channels_init().
|
static |
Handle channel state changes.
Definition at line 573 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 1284 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 1184 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 1308 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_monitor_start_type(), ast_channel_monitor_stop_type(), ast_channel_snapshot_type(), ast_channel_topic_all(), ast_channel_unhold_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_monitor_start_cb(), channel_monitor_stop_cb(), channel_snapshot_update(), channel_unhold_cb(), manager_channels_shutdown(), manager_topic, NULL, stasis_forward_all(), and stasis_message_router_add().
Referenced by subscribe_all().
|
static |
Definition at line 1302 of file manager_channels.c.
References NULL, and stasis_forward_cancel().
Referenced by manager_channels_init().
|
static |
Definition at line 745 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(), channel_moh_stop_cb(), channel_monitor_start_cb(), and channel_monitor_stop_cb().
channel_snapshot_monitor channel_monitors[] |
Definition at line 705 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 485 of file manager_channels.c.