Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
The Asterisk Management Interface - AMI. More...
#include "asterisk.h"
#include "asterisk/paths.h"
#include <ctype.h>
#include <sys/time.h>
#include <signal.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <regex.h>
#include "asterisk/channel.h"
#include "asterisk/file.h"
#include "asterisk/manager.h"
#include "asterisk/module.h"
#include "asterisk/config.h"
#include "asterisk/callerid.h"
#include "asterisk/core_local.h"
#include "asterisk/lock.h"
#include "asterisk/cli.h"
#include "asterisk/app.h"
#include "asterisk/mwi.h"
#include "asterisk/pbx.h"
#include "asterisk/md5.h"
#include "asterisk/acl.h"
#include "asterisk/utils.h"
#include "asterisk/tcptls.h"
#include "asterisk/http.h"
#include "asterisk/ast_version.h"
#include "asterisk/threadstorage.h"
#include "asterisk/linkedlists.h"
#include "asterisk/term.h"
#include "asterisk/astobj2.h"
#include "asterisk/features.h"
#include "asterisk/security_events.h"
#include "asterisk/aoc.h"
#include "asterisk/strings.h"
#include "asterisk/stringfields.h"
#include "asterisk/presencestate.h"
#include "asterisk/stasis_message_router.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/stasis_bridges.h"
#include "asterisk/test.h"
#include "asterisk/json.h"
#include "asterisk/bridge.h"
#include "asterisk/features_config.h"
#include "asterisk/rtp_engine.h"
#include "asterisk/format_cache.h"
#include "asterisk/translate.h"
#include "asterisk/taskprocessor.h"
#include "asterisk/message.h"
Go to the source code of this file.
Data Structures | |
struct | actions |
list of actions registered More... | |
struct | all_events |
struct | ast_manager_user |
user descriptor, as read from the config file. More... | |
struct | event_filter_entry |
struct | eventqent |
struct | fast_originate_helper |
helper function for originate More... | |
struct | manager_hooks |
list of hooks registered More... | |
struct | mansession |
In case you didn't read that giant block of text above the mansession_session struct, the 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. More... | |
struct | mansession_session::mansession_datastores |
struct | mansession_session |
struct | originate_permissions_entry |
struct | permalias |
struct | users |
list of users found in the config file More... | |
struct | variable_count |
Macros | |
#define | any_manager_listeners(sessions) ((sessions && ao2_container_count(sessions)) || !AST_RWLIST_EMPTY(&manager_hooks)) |
#define | ASTMAN_APPEND_BUF_INITSIZE 256 |
initial allocated size for the astman_append_buf and astman_send_*_va More... | |
#define | DEFAULT_REALM "asterisk" |
#define | EVENT_FLAG_SHUTDOWN -1 |
Fake event class used to end sessions at shutdown. More... | |
#define | FORMAT " %-25.25s %-15.55s\n" |
#define | FORMAT2 " %-25.25s %-15d\n" |
#define | FORMAT3 " %-25.25s %s\n" |
#define | GET_HEADER_FIRST_MATCH 0 |
#define | GET_HEADER_LAST_MATCH 1 |
#define | GET_HEADER_SKIP_EMPTY 2 |
#define | HSMC_FORMAT " %-*.*s %-.*s\n" |
#define | HSMCONN_FORMAT1 " %-15.15s %-55.55s %-10.10s %-10.10s %-8.8s %-8.8s %-10.10s %-10.10s\n" |
#define | HSMCONN_FORMAT2 " %-15.15s %-55.55s %-10d %-10d %-8d %-8d %-10.10d %-10.10d\n" |
#define | MANAGER_EVENT_BUF_INITSIZE 256 |
#define | manager_event_sessions(sessions, category, event, contents, ...) __manager_event_sessions(sessions, category, event, 0, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, contents , ## __VA_ARGS__) |
#define | MAX_AUTH_PERM_STRING 150 |
#define | MAX_BLACKLIST_CMD_LEN 2 |
Descriptor for a manager session, either on the AMI socket or over HTTP. More... | |
#define | MAX_VARS 128 |
#define | MGR_SHOW_TERMINAL_WIDTH 80 |
#define | MSG_MOREDATA ((char *)astman_send_response) |
#define | ROW_FMT "<tr><td colspan=\"2\" bgcolor=\"#f1f1ff\">%s</td></tr>\r\n" |
#define | TEST_STRING "<form action=\"manager\" method=\"post\">\n\ Action: <select name=\"action\">\n\ <option value=\"\">-----></option>\n\ <option value=\"login\">login</option>\n\ <option value=\"command\">Command</option>\n\ <option value=\"waitevent\">waitevent</option>\n\ <option value=\"listcommands\">listcommands</option>\n\ </select>\n\ or <input name=\"action\"><br/>\n\ CLI Command <input name=\"command\"><br>\n\ user <input name=\"username\"> pass <input type=\"password\" name=\"secret\"><br>\n\ <input type=\"submit\">\n</form>\n" |
Enumerations | |
enum | add_filter_result { FILTER_SUCCESS = 0 , FILTER_ALLOC_FAILED , FILTER_COMPILE_FAIL , FILTER_FORMAT_ERROR } |
enum | error_type { UNKNOWN_ACTION = 1 , UNKNOWN_CATEGORY , UNSPECIFIED_CATEGORY , UNSPECIFIED_ARGUMENT , FAILURE_ALLOCATION , FAILURE_NEWCAT , FAILURE_DELCAT , FAILURE_EMPTYCAT , FAILURE_UPDATE , FAILURE_DELETE , FAILURE_APPEND , FAILURE_TEMPLATE } |
enum | event_filter_match_type { FILTER_MATCH_REGEX = 0 , FILTER_MATCH_EXACT , FILTER_MATCH_STARTS_WITH , FILTER_MATCH_ENDS_WITH , FILTER_MATCH_CONTAINS , FILTER_MATCH_NONE } |
enum | mansession_message_parsing { MESSAGE_OKAY , MESSAGE_LINE_TOO_LONG } |
enum | output_format { FORMAT_RAW , FORMAT_HTML , FORMAT_XML } |
Functions | |
int | __ast_manager_event_multichan (int category, const char *event, int chancount, struct ast_channel **chans, const char *file, int line, const char *func, const char *fmt,...) |
static const char * | __astman_get_header (const struct message *m, char *var, int mode) |
Return a matching header value. More... | |
static void | __init_astman_append_buf (void) |
thread local buffer for astman_append More... | |
static int | __init_manager (int reload, int by_external_config) |
static void | __init_manager_event_buf (void) |
static void | __init_userevent_buf (void) |
static int | __manager_event_sessions (struct ao2_container *sessions, int category, const char *event, int chancount, struct ast_channel **chans, const char *file, int line, const char *func, const char *fmt,...) |
static int | __manager_event_sessions_va (struct ao2_container *sessions, int category, const char *event, int chancount, struct ast_channel **chans, const char *file, int line, const char *func, const char *fmt, va_list ap) |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static void | acl_change_stasis_cb (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static void | acl_change_stasis_subscribe (void) |
static void | acl_change_stasis_unsubscribe (void) |
static struct ast_aoc_decoded * | action_aoc_de_message (struct mansession *s, const struct message *m) |
static struct ast_aoc_decoded * | action_aoc_s_message (struct mansession *s, const struct message *m) |
static int | action_aoc_s_submessage (struct mansession *s, const struct message *m, struct ast_aoc_decoded *decoded) |
static int | action_aocmessage (struct mansession *s, const struct message *m) |
static int | action_atxfer (struct mansession *s, const struct message *m) |
static int | action_blind_transfer (struct mansession *s, const struct message *m) |
static int | action_cancel_atxfer (struct mansession *s, const struct message *m) |
static int | action_challenge (struct mansession *s, const struct message *m) |
static int | action_command (struct mansession *s, const struct message *m) |
Manager command "command" - execute CLI command. More... | |
static int | action_coresettings (struct mansession *s, const struct message *m) |
Show PBX core settings information. More... | |
static int | action_coreshowchannelmap (struct mansession *s, const struct message *m) |
Manager command "CoreShowChannelMap" - Lists all channels connected to the specified channel. More... | |
static int | action_coreshowchannels (struct mansession *s, const struct message *m) |
Manager command "CoreShowChannels" - List currently defined channels and some information about them. More... | |
static int | action_corestatus (struct mansession *s, const struct message *m) |
Show PBX core status information. More... | |
static int | action_createconfig (struct mansession *s, const struct message *m) |
static void | action_destroy (void *obj) |
static int | action_events (struct mansession *s, const struct message *m) |
static int | action_extensionstate (struct mansession *s, const struct message *m) |
static int | action_filter (struct mansession *s, const struct message *m) |
Manager command to add an event filter to a manager session. More... | |
static struct manager_action * | action_find (const char *name) |
static int | action_getconfig (struct mansession *s, const struct message *m) |
static int | action_getconfigjson (struct mansession *s, const struct message *m) |
static int | action_getvar (struct mansession *s, const struct message *m) |
static int | action_hangup (struct mansession *s, const struct message *m) |
static int | action_listcategories (struct mansession *s, const struct message *m) |
static int | action_listcommands (struct mansession *s, const struct message *m) |
static int | action_loggerrotate (struct mansession *s, const struct message *m) |
Manager command "LoggerRotate" - reloads and rotates the logger in the same manner as the CLI command 'logger rotate'. More... | |
static int | action_login (struct mansession *s, const struct message *m) |
static int | action_logoff (struct mansession *s, const struct message *m) |
static int | action_mailboxcount (struct mansession *s, const struct message *m) |
static int | action_mailboxstatus (struct mansession *s, const struct message *m) |
static int | action_originate (struct mansession *s, const struct message *m) |
static int | action_ping (struct mansession *s, const struct message *m) |
static int | action_presencestate (struct mansession *s, const struct message *m) |
static int | action_redirect (struct mansession *s, const struct message *m) |
action_redirect: The redirect manager command More... | |
static int | action_reload (struct mansession *s, const struct message *m) |
Send a reload event. More... | |
static int | action_sendtext (struct mansession *s, const struct message *m) |
static int | action_setvar (struct mansession *s, const struct message *m) |
static int | action_status (struct mansession *s, const struct message *m) |
Manager "status" command to show channels. More... | |
static int | action_timeout (struct mansession *s, const struct message *m) |
static int | action_updateconfig (struct mansession *s, const struct message *m) |
static int | action_userevent (struct mansession *s, const struct message *m) |
static int | action_waitevent (struct mansession *s, const struct message *m) |
static struct eventqent * | advance_event (struct eventqent *e) |
static | AO2_GLOBAL_OBJ_STATIC (event_docs) |
A container of event documentation nodes. More... | |
static | AO2_GLOBAL_OBJ_STATIC (mgr_sessions) |
static int | aocmessage_get_unit_entry (const struct message *m, struct ast_aoc_unit_entry *entry, unsigned int entry_num) |
static int | app_match (const char *app, const char *data, const char *search) |
static int | appdata_match (const char *app, const char *data, const char *search) |
static void | append_channel_vars (struct ast_str **pbuf, struct ast_channel *chan) |
static int | append_event (const char *str, int event_name_hash, int category) |
events are appended to a queue from where they can be dispatched to clients. More... | |
int | ast_hook_send_action (struct manager_custom_hook *hook, const char *msg) |
access for hooks to send action messages to ami More... | |
static int | ast_instring (const char *bigstr, const char *smallstr, const char delim) |
int | ast_manager_check_enabled (void) |
Check if AMI is enabled. More... | |
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. More... | |
struct stasis_message_router * | ast_manager_get_message_router (void) |
Get the stasis_message_router for AMI. More... | |
struct stasis_topic * | ast_manager_get_topic (void) |
Get the Stasis Message Bus API topic for AMI. More... | |
int | ast_manager_hangup_helper (struct mansession *s, const struct message *m, manager_hangup_handler_t hangup_handler, manager_hangup_cause_validator_t cause_validator) |
A manager helper function that hangs up a channel using a supplied channel type specific hangup function and cause code validator. More... | |
void | ast_manager_publish_event (const char *type, int class_type, struct ast_json *obj) |
Publish an event to AMI. More... | |
int | ast_manager_register2 (const char *action, int auth, int(*func)(struct mansession *s, const struct message *m), struct ast_module *module, const char *synopsis, const char *description) |
register a new command with manager, including online help. This is the preferred way to register a manager command More... | |
void | ast_manager_register_hook (struct manager_custom_hook *hook) |
Add a custom hook to be called when an event is fired. More... | |
static int | ast_manager_register_struct (struct manager_action *act) |
struct ast_str * | ast_manager_str_from_json_object (struct ast_json *blob, key_exclusion_cb exclusion_cb) |
Convert a JSON object into an AMI compatible string. More... | |
int | ast_manager_unregister (const char *action) |
support functions to register/unregister AMI action handlers, More... | |
void | ast_manager_unregister_hook (struct manager_custom_hook *hook) |
Delete a custom hook to be called when an event is fired. More... | |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
int | ast_str_append_event_header (struct ast_str **fields_string, const char *header, const char *value) |
append an event header to an ast string More... | |
int | ast_webmanager_check_enabled (void) |
Check if AMI/HTTP is enabled. More... | |
static int | ast_xml_doc_item_cmp_fn (const void *a, const void *b) |
void | astman_append (struct mansession *s, const char *fmt,...) |
static void | astman_append_headers (struct message *m, const struct ast_variable *params) |
Append additional headers into the message structure from params. More... | |
static void | astman_append_json (struct mansession *s, const char *str) |
int | astman_datastore_add (struct mansession *s, struct ast_datastore *datastore) |
Add a datastore to a session. More... | |
struct ast_datastore * | astman_datastore_find (struct mansession *s, const struct ast_datastore_info *info, const char *uid) |
Find a datastore on a session. More... | |
int | astman_datastore_remove (struct mansession *s, struct ast_datastore *datastore) |
Remove a datastore from a session. More... | |
static void | astman_flush (struct mansession *s, struct ast_str *buf) |
static void | astman_free_headers (struct message *m) |
Free headers inside message structure, but not the message structure itself. More... | |
const char * | astman_get_header (const struct message *m, char *var) |
Return the first matching variable from an array. More... | |
struct ast_variable * | astman_get_variables (const struct message *m) |
Get a linked list of the Variable: headers. More... | |
struct ast_variable * | astman_get_variables_order (const struct message *m, enum variable_orders order) |
Get a linked list of the Variable: headers with order specified. More... | |
int | astman_is_authed (uint32_t ident) |
Determine if a manager session ident is authenticated. More... | |
void | astman_live_dangerously (int new_live_dangerously) |
Enable/disable the inclusion of 'dangerous' configurations outside of the ast_config_AST_CONFIG_DIR. More... | |
void | astman_send_ack (struct mansession *s, const struct message *m, char *msg) |
Send ack in manager transaction. More... | |
void | astman_send_error (struct mansession *s, const struct message *m, char *error) |
Send error in manager transaction. More... | |
void | astman_send_error_va (struct mansession *s, const struct message *m, const char *fmt,...) |
Send error in manager transaction (with va_args support) More... | |
static void | astman_send_list_complete (struct mansession *s, const struct message *m, const char *event_name, int count) |
void | astman_send_list_complete_end (struct mansession *s) |
End the list complete event. More... | |
void | astman_send_list_complete_start (struct mansession *s, const struct message *m, const char *event_name, int count) |
Start the list complete event. More... | |
static struct ast_str * | astman_send_list_complete_start_common (struct mansession *s, const struct message *m, const char *event_name, int count) |
void | astman_send_listack (struct mansession *s, const struct message *m, char *msg, char *listflag) |
Send ack in manager transaction to begin a list. More... | |
void | astman_send_response (struct mansession *s, const struct message *m, char *resp, char *msg) |
Send response in manager transaction. More... | |
static void | astman_send_response_full (struct mansession *s, const struct message *m, char *resp, char *msg, char *listflag) |
send a response with an optional message, and terminate it with an empty line. m is used only to grab the 'ActionID' field. More... | |
static void | astman_start_ack (struct mansession *s, const struct message *m) |
int | astman_verify_session_readpermissions (uint32_t ident, int perm) |
Verify a session's read permissions against a permission mask. More... | |
int | astman_verify_session_writepermissions (uint32_t ident, int perm) |
Verify a session's write permissions against a permission mask. More... | |
static int | auth_http_callback (struct ast_tcptls_session_instance *ser, enum ast_http_method method, enum output_format format, const struct ast_sockaddr *remote_address, const char *uri, struct ast_variable *get_params, struct ast_variable *headers) |
static int | auth_manager_http_callback (struct ast_tcptls_session_instance *ser, const struct ast_http_uri *urih, const char *uri, enum ast_http_method method, struct ast_variable *get_params, struct ast_variable *headers) |
static int | auth_mxml_http_callback (struct ast_tcptls_session_instance *ser, const struct ast_http_uri *urih, const char *uri, enum ast_http_method method, struct ast_variable *get_params, struct ast_variable *headers) |
static int | auth_rawman_http_callback (struct ast_tcptls_session_instance *ser, const struct ast_http_uri *urih, const char *uri, enum ast_http_method method, struct ast_variable *get_params, struct ast_variable *headers) |
static int | authenticate (struct mansession *s, const struct message *m) |
static const char * | authority_to_str (int authority, struct ast_str **res) |
Convert authority code to a list of options. Note that the EVENT_FLAG_ALL authority will always be returned. More... | |
static struct mansession_session * | build_mansession (const struct ast_sockaddr *addr) |
Allocate manager session structure and add it to the list of sessions. More... | |
static int | check_blacklist (const char *cmd) |
static int | check_manager_session_inuse (const char *name) |
static void | close_mansession_file (struct mansession *s) |
static int | coreshowchannelmap_add_connected_channels (struct ao2_container *channel_map, struct ast_channel_snapshot *channel_snapshot, struct ast_bridge_snapshot *bridge_snapshot) |
Recursive function to get all channels in a bridge. Follow local channels as well. More... | |
static int | coreshowchannelmap_add_to_map (struct ao2_container *c, const char *s) |
Helper function to add a channel name to the vector. More... | |
static void | destroy_fast_originate_helper (struct fast_originate_helper *doomed) |
static int | do_message (struct mansession *s) |
static void | event_filter_destructor (void *obj) |
static void * | fast_originate (void *data) |
static int | file_in_modules_dir (const char *filename) |
Check if the given file path is in the modules dir or not. More... | |
static int | filter_cmp_fn (void *obj, void *arg, void *data, int flags) |
static struct mansession_session * | find_session (uint32_t ident, int incinuse) |
static struct mansession_session * | find_session_by_nonce (const char *username, unsigned long nonce, int *stale) |
static int | function_amiclient (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
${AMI_CLIENT()} Dialplan function - reads manager client data More... | |
static int | function_capable_string_allowed_with_auths (const char *evaluating, int writepermlist) |
Checks to see if a string which can be used to evaluate functions should be rejected. More... | |
static void | generate_status (struct mansession *s, struct ast_channel *chan, char **vars, int varc, int all_variables, char *id_text, int *count) |
static int | generic_http_callback (struct ast_tcptls_session_instance *ser, enum ast_http_method method, enum output_format format, const struct ast_sockaddr *remote_address, const char *uri, struct ast_variable *get_params, struct ast_variable *headers) |
static int | get_input (struct mansession *s, char *output) |
static struct ast_manager_user * | get_manager_by_name_locked (const char *name) |
static int | get_manager_sessions_cb (void *obj, void *arg, void *data, int flags) |
Get number of logged in sessions for a login name. More... | |
static int | get_perm (const char *instr) |
static struct eventqent * | grab_last (void) |
static char * | handle_kickmanconn (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
CLI command manager kick session. More... | |
static char * | handle_manager_reload (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
CLI command manager reload. More... | |
static char * | handle_manager_show_event (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_manager_show_events (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_manager_show_settings (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
CLI command manager show settings. More... | |
static char * | handle_mandebug (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static void | handle_parse_error (struct mansession *s, struct message *m, char *error) |
static char * | handle_showmanager (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_showmanagers (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_showmancmd (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_showmancmds (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
CLI command manager list commands. More... | |
static char * | handle_showmanconn (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
CLI command manager list connected. More... | |
static char * | handle_showmaneventq (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
CLI command manager list eventq. More... | |
static enum error_type | handle_updates (struct mansession *s, const struct message *m, struct ast_config *cfg, const char *dfn) |
helper function for action_updateconfig More... | |
static int | is_originate_app_permitted (const char *app, const char *data, int permission) |
static void | json_escape (char *out, const char *in) |
static void | load_channelvars (struct ast_variable *var) |
static void | load_disabledevents (struct ast_variable *var) |
static int | load_module (void) |
static void | log_action (const struct message *m, const char *action) |
static struct ast_variable * | man_do_variable_value (struct ast_variable *head, const char *hdr_val) |
static enum add_filter_result | manager_add_filter (const char *criteria, const char *filter_pattern, struct ao2_container *includefilters, struct ao2_container *excludefilters) |
Add an event filter to a manager session. More... | |
static void | manager_default_msg_cb (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static int | manager_displayconnects (struct mansession_session *session) |
Get displayconnects config option. More... | |
static void | manager_event_blob_dtor (void *obj) |
static void | manager_free_user (struct ast_manager_user *user) |
static void | manager_generic_msg_cb (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static int | manager_http_callback (struct ast_tcptls_session_instance *ser, const struct ast_http_uri *urih, const char *uri, enum ast_http_method method, struct ast_variable *get_params, struct ast_variable *headers) |
static void | manager_json_array_with_key (struct ast_json *obj, const char *key, size_t index, struct ast_str **res, key_exclusion_cb exclusion_cb) |
static void | manager_json_obj_with_key (struct ast_json *obj, const char *key, const char *parent_key, struct ast_str **res, key_exclusion_cb exclusion_cb) |
static void | manager_json_to_ast_str (struct ast_json *obj, const char *key, struct ast_str **res, key_exclusion_cb exclusion_cb) |
static void | manager_json_value_str_append (struct ast_json *value, const char *key, struct ast_str **res) |
static int | manager_modulecheck (struct mansession *s, const struct message *m) |
Manager function to check if module is loaded. More... | |
static int | manager_moduleload (struct mansession *s, const struct message *m) |
static void | manager_set_defaults (void) |
static void | manager_shutdown (void) |
static int | manager_state_cb (const char *context, const char *exten, struct ast_state_cb_info *info, void *data) |
static int | manager_subscriptions_init (void) |
Initialize all Stasis Message Bus API topics and routers used by the various sub-components of AMI. More... | |
static int | mansession_cmp_fn (void *obj, void *arg, int flags) |
static enum ast_transport | mansession_get_transport (const struct mansession *s) |
static void | mansession_lock (struct mansession *s) |
Lock the 'mansession' structure. More... | |
static void | mansession_unlock (struct mansession *s) |
Unlock the 'mansession' structure. More... | |
static int | match_eventdata (struct event_filter_entry *entry, const char *eventdata) |
Test eventdata against a filter entry. More... | |
static int | mxml_http_callback (struct ast_tcptls_session_instance *ser, const struct ast_http_uri *urih, const char *uri, enum ast_http_method method, struct ast_variable *get_params, struct ast_variable *headers) |
static void | print_event_instance (struct ast_cli_args *a, struct ast_xml_doc_item *instance) |
static int | process_events (struct mansession *s) |
static int | process_message (struct mansession *s, const struct message *m) |
Process an AMI message, performing desired action. Return 0 on success, -1 on error that require the session to be destroyed. More... | |
static void | process_output (struct mansession *s, struct ast_str **out, struct ast_variable *params, enum output_format format) |
static void | purge_events (void) |
static void | purge_old_stuff (void *data) |
cleanup code called at each iteration of server_root, guaranteed to happen every 5 seconds at most More... | |
static int | purge_sessions (int n_max) |
remove at most n_max stale session from the list. More... | |
static int | queue_match (const char *app, const char *data, const char *search) |
static int | queue_read_action_payload (struct ast_channel *chan, const unsigned char *payload, size_t payload_size, enum ast_frame_read_action action) |
Queue a given read action containing a payload onto a channel. More... | |
static int | queue_sendtext (struct ast_channel *chan, const char *body) |
Queue a read action to send a text message. More... | |
static int | queue_sendtext_data (struct ast_channel *chan, const char *body, const char *content_type) |
Queue a read action to send a text data message. More... | |
static int | rawman_http_callback (struct ast_tcptls_session_instance *ser, const struct ast_http_uri *urih, const char *uri, enum ast_http_method method, struct ast_variable *get_params, struct ast_variable *headers) |
static int | reload_module (void) |
static void | report_auth_success (const struct mansession *s) |
static void | report_failed_acl (const struct mansession *s, const char *username) |
static void | report_failed_challenge_response (const struct mansession *s, const char *response, const char *expected_response) |
static void | report_inval_password (const struct mansession *s, const char *username) |
static void | report_invalid_user (const struct mansession *s, const char *username) |
static void | report_req_bad_format (const struct mansession *s, const char *action) |
static void | report_req_not_allowed (const struct mansession *s, const char *action) |
static void | report_session_limit (const struct mansession *s) |
static int | restrictedFile (const char *filename) |
Check if a file is restricted or not. More... | |
static int | send_string (struct mansession *s, char *string) |
static void | session_destroy (struct mansession_session *s) |
static void | session_destructor (void *obj) |
static void * | session_do (void *data) |
The body of the individual manager session. Call get_input() to read one line at a time (or be woken up on new events), collect the lines in a message until found an empty line, and execute the request. In any case, deliver events asynchronously through process_events() (called from here if no line is available, or at the end of process_message(). ) More... | |
static int | set_eventmask (struct mansession *s, const char *eventmask) |
Rather than braindead on,off this now can also accept a specific int mask value or a ',' delim list of mask strings (the same as manager.conf) -anthm. More... | |
static int | should_send_event (struct ao2_container *includefilters, struct ao2_container *excludefilters, struct eventqent *eqe) |
static int | strings_to_mask (const char *string) |
static int | subscribe_all (void) |
static int | unload_module (void) |
static struct mansession_session * | unref_mansession (struct mansession_session *s) |
Unreference manager session object. If no more references, then go ahead and delete it. More... | |
static const char * | user_authority_to_str (int authority, struct ast_str **res) |
Convert authority code to a list of options for a user. This will only display those authority codes that have an explicit match on authority. More... | |
static int | variable_count_cmp_fn (void *obj, void *vstr, int flags) |
static int | variable_count_hash_fn (const void *vvc, const int flags) |
static void | xml_copy_escape (struct ast_str **out, const char *src, int mode) |
static void | xml_translate (struct ast_str **out, char *in, struct ast_variable *get_vars, enum output_format format) |
Convert the input into XML or HTML. The input is supposed to be a sequence of lines of the form Name: value optionally followed by a blob of unformatted text. A blank line is a section separator. Basically, this is a mixture of the format of Manager Interface and CLI commands. The unformatted text is considered as a single value of a field named 'Opaque-data'. More... | |
STASIS_MESSAGE_TYPE_DEFN (ast_manager_get_generic_type) | |
Define AMI message types. More... | |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER , .description = "Asterisk Manager Interface" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .reload = reload_module, .load_pri = AST_MODPRI_CORE, .requires = "extconfig,acl,http", } |
static struct stasis_subscription * | acl_change_sub |
static struct actions | actions = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
static struct all_events | all_events = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
static int | allowmultiplelogin = 1 |
static struct ast_http_uri | amanageruri |
static struct ast_http_uri | amanagerxmluri |
static struct ast_tcptls_session_args | ami_desc |
static struct ast_tls_config | ami_tls_cfg |
static struct ast_tcptls_session_args | amis_desc |
static struct ast_http_uri | arawmanuri |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_threadstorage | astman_append_buf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_astman_append_buf , .custom_init = NULL , } |
static int | authlimit |
static int | authtimeout |
static int | broken_events_action = 0 |
static struct ast_cli_entry | cli_manager [] |
struct { | |
const char * words [AST_MAX_CMD_LEN] | |
} | command_blacklist [] |
static const char *const | contenttype [] |
static int | displayconnects = 1 |
static char | global_realm [MAXHOSTNAMELEN] |
static int | httptimeout = 60 |
static int | live_dangerously |
Set to true (non-zero) to globally allow all dangerous AMI actions to run. More... | |
static char * | manager_channelvars |
static int | manager_debug = 0 |
static char * | manager_disabledevents |
static int | manager_enabled = 0 |
static struct ast_threadstorage | manager_event_buf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_manager_event_buf , .custom_init = NULL , } |
static struct manager_hooks | manager_hooks = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
static struct stasis_topic * | manager_topic |
A stasis_topic that all topics AMI cares about will be forwarded to. More... | |
static struct ast_custom_function | managerclient_function |
description of AMI_CLIENT dialplan function More... | |
static struct ast_http_uri | manageruri |
static struct ast_http_uri | managerxmluri |
static char * | match_type_names [] |
static struct originate_permissions_entry | originate_app_permissions [] |
static const struct permalias | perms [] |
static struct ast_http_uri | rawmanuri |
static struct stasis_forward * | rtp_topic_forwarder |
The stasis_subscription for forwarding the RTP topic to the AMI topic. More... | |
static struct stasis_forward * | security_topic_forwarder |
The stasis_subscription for forwarding the Security topic to the AMI topic. More... | |
static struct stasis_message_router * | stasis_router |
The stasis_message_router for all Stasis Message Bus API messages. More... | |
static int | subscribed = 0 |
static int | timestampevents |
static int | unauth_sessions = 0 |
static struct ast_threadstorage | userevent_buf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_userevent_buf , .custom_init = NULL , } |
static struct users | users = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
static int | webmanager_enabled = 0 |
static int | webregged = 0 |
The Asterisk Management Interface - AMI.
OpenSSL http://www.openssl.org - for AMI/SSL
At the moment this file contains a number of functions, namely:
Definition in file manager.c.
#define FORMAT " %-25.25s %-15.55s\n" |
#define FORMAT2 " %-25.25s %-15d\n" |
#define FORMAT3 " %-25.25s %s\n" |
#define HSMC_FORMAT " %-*.*s %-.*s\n" |
#define HSMCONN_FORMAT1 " %-15.15s %-55.55s %-10.10s %-10.10s %-8.8s %-8.8s %-10.10s %-10.10s\n" |
#define ROW_FMT "<tr><td colspan=\"2\" bgcolor=\"#f1f1ff\">%s</td></tr>\r\n" |
#define TEST_STRING "<form action=\"manager\" method=\"post\">\n\ Action: <select name=\"action\">\n\ <option value=\"\">-----></option>\n\ <option value=\"login\">login</option>\n\ <option value=\"command\">Command</option>\n\ <option value=\"waitevent\">waitevent</option>\n\ <option value=\"listcommands\">listcommands</option>\n\ </select>\n\ or <input name=\"action\"><br/>\n\ CLI Command <input name=\"command\"><br>\n\ user <input name=\"username\"> pass <input type=\"password\" name=\"secret\"><br>\n\ <input type=\"submit\">\n</form>\n" |
enum output_format |
Enumerator | |
---|---|
FORMAT_RAW | |
FORMAT_HTML | |
FORMAT_XML |
|
static |
Definition at line 9535 of file manager.c.
References __ast_custom_function_register(), acl_change_stasis_subscribe(), acl_change_stasis_unsubscribe(), action_aocmessage(), action_atxfer(), action_blind_transfer(), action_cancel_atxfer(), action_challenge(), action_command(), action_coresettings(), action_coreshowchannelmap(), action_coreshowchannels(), action_corestatus(), action_createconfig(), action_events(), action_extensionstate(), action_filter(), action_getconfig(), action_getconfigjson(), action_getvar(), action_hangup(), action_listcategories(), action_listcommands(), action_loggerrotate(), action_login(), action_logoff(), action_mailboxcount(), action_mailboxstatus(), action_originate(), action_ping(), action_presencestate(), action_redirect(), action_reload(), action_sendtext(), action_setvar(), action_status(), action_timeout(), action_updateconfig(), action_userevent(), action_waitevent(), allowmultiplelogin, amanageruri, amanagerxmluri, ami_desc, ami_tls_cfg, amis_desc, AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_list, ao2_global_obj_replace_unref, ao2_ref, ao2_t_callback, ao2_t_global_obj_replace_unref, ao2_t_ref, append_event(), arawmanuri, ARRAY_LEN, ast_append_acl(), ast_begins_with(), ast_calloc, ast_category_browse(), ast_cli_register_multiple, ast_config_destroy(), ast_config_load2(), ast_copy_string(), ast_debug, ast_extension_state_add(), ast_free, ast_free_acl_list(), ast_http_uri_link(), ast_http_uri_unlink(), AST_LIST_INSERT_TAIL, ast_log, ast_manager_get_generic_type(), ast_manager_register_xml_core, ast_md5_hash(), ast_parse_arg(), AST_RWLIST_INSERT_TAIL, AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_sockaddr_copy(), ast_sockaddr_isnull(), ast_sockaddr_parse(), ast_sockaddr_port, ast_sockaddr_set_port, ast_sockaddr_stringify_addr(), ast_ssl_setup(), ast_str_hash(), ast_strdup, ast_strlen_zero(), ast_tcptls_server_start(), ast_tcptls_server_stop(), ast_tls_read_conf(), ast_true(), ast_variable_browse(), ast_variable_new, ast_variable_retrieve(), ast_variables_destroy(), ast_xmldoc_build_documentation(), authlimit, authtimeout, broken_events_action, cli_manager, CONFIG_FLAG_FILEUNCHANGED, CONFIG_STATUS_FILEINVALID, CONFIG_STATUS_FILEUNCHANGED, DEFAULT_MANAGER_PORT, DEFAULT_MANAGER_TLS_PORT, displayconnects, ast_tls_config::enabled, EVENT_FLAG_AOC, EVENT_FLAG_CALL, EVENT_FLAG_COMMAND, EVENT_FLAG_CONFIG, EVENT_FLAG_ORIGINATE, EVENT_FLAG_REPORTING, EVENT_FLAG_SYSTEM, EVENT_FLAG_USER, get_manager_by_name_locked(), get_perm(), global_realm, httptimeout, load_channelvars(), load_disabledevents(), ast_tcptls_session_args::local_address, LOG_ERROR, LOG_NOTICE, LOG_WARNING, manager_add_filter(), manager_debug, manager_enabled, manager_free_user(), manager_modulecheck(), manager_moduleload(), manager_set_defaults(), manager_state_cb(), manager_topic, managerclient_function, manageruri, managerxmluri, mansession_cmp_fn(), ast_variable::next, NULL, OBJ_MULTIPLE, OBJ_NODATA, OBJ_UNLINK, PARSE_ADDR, PARSE_IN_RANGE, PARSE_PORT_IGNORE, PARSE_UINT32, rawmanuri, reload(), sessions, stasis_forward_all(), STASIS_MESSAGE_TYPE_INIT, stasis_topic_create(), subscribe_all(), subscribed, timestampevents, ast_tcptls_session_args::tls_cfg, value, var, webmanager_enabled, and webregged.
Referenced by acl_change_stasis_cb(), load_module(), and reload_module().
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.
The returned object is AO2 managed, so clean up with ao2_cleanup().
event_flags | Flags the event should be raised with. |
manager_event | The event to be raised, should be a string literal. |
extra_fields_fmt | Format string for extra fields to include. Or NO_EXTRA_FIELDS for no extra fields. |
NULL | on error. |
Definition at line 10128 of file manager.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_ref, ast_assert, ast_string_field_init, ast_string_field_ptr_build_va, ast_manager_event_blob::event_flags, ast_manager_event_blob::extra_fields, manager_event, ast_manager_event_blob::manager_event, manager_event_blob_dtor(), and NULL.
Referenced by agent_login_to_ami(), agent_logoff_to_ami(), agi_channel_to_ami(), aoc_to_ami(), attended_transfer_to_ami(), blind_transfer_to_ami(), bridge_create(), bridge_destroy(), bridge_video_update(), call_pickup_to_ami(), cc_available_to_ami(), cc_callerrecalling_to_ami(), cc_callerstartmonitoring_to_ami(), cc_callerstopmonitoring_to_ami(), cc_failure_to_ami(), cc_monitorfailed_to_ami(), cc_offertimerstart_to_ami(), cc_recallcomplete_to_ami(), cc_requestacknowledged_to_ami(), cc_requested_to_ami(), channel_new_accountcode(), channel_new_callerid(), channel_new_connected_line(), channel_newexten(), channel_state_change(), contactstatus_to_ami(), dahdichannel_to_ami(), devstate_to_ami(), fake_ami(), local_message_to_ami(), multi_user_event_to_ami(), peerstatus_to_ami(), presence_state_to_ami(), queue_channel_to_ami(), queue_member_to_ami(), queue_multi_channel_to_ami(), rtcp_report_to_ami(), security_event_to_ami_blob(), system_registry_to_ami(), talking_start_to_ami(), talking_stop_to_ami(), and varset_to_ami().
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
int ast_str_append_event_header | ( | struct ast_str ** | fields_string, |
const char * | header, | ||
const char * | value | ||
) |
append an event header to an ast string
fields_string | pointer to an ast_string pointer. It may be a pointer to a NULL ast_str pointer, in which case the ast_str will be initialized. |
header | The header being applied |
value | the value of the header |
0 | if successful |
non-zero | on failure |
Definition at line 10106 of file manager.c.
References ast_str_append(), ast_str_create, and value.
Referenced by confbridge_talking_cb(), get_bool_header(), and meetme_stasis_cb().
|
static |
Definition at line 9077 of file manager.c.
Referenced by handle_manager_show_events().
int astman_datastore_add | ( | struct mansession * | s, |
struct ast_datastore * | datastore | ||
) |
Add a datastore to a session.
0 | success |
non-zero | failure |
Definition at line 10067 of file manager.c.
References AST_LIST_INSERT_HEAD, mansession_session::datastores, and mansession::session.
struct ast_datastore * astman_datastore_find | ( | struct mansession * | s, |
const struct ast_datastore_info * | info, | ||
const char * | uid | ||
) |
Find a datastore on a session.
NULL | if not found |
Definition at line 10079 of file manager.c.
References AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, mansession_session::datastores, sip_to_pjsip::info(), ast_datastore::info, NULL, mansession::session, and ast_datastore::uid.
int astman_datastore_remove | ( | struct mansession * | s, |
struct ast_datastore * | datastore | ||
) |
Remove a datastore from a session.
0 | success |
non-zero | failure |
Definition at line 10074 of file manager.c.
References AST_LIST_REMOVE, mansession_session::datastores, and mansession::session.
int astman_is_authed | ( | uint32_t | ident | ) |
Determine if a manager session ident is authenticated.
Definition at line 7900 of file manager.c.
References ao2_unlock, find_session(), session, and unref_mansession().
Referenced by http_post_callback(), and static_callback().
int astman_verify_session_readpermissions | ( | uint32_t | ident, |
int | perm | ||
) |
Verify a session's read permissions against a permission mask.
ident | session identity |
perm | permission mask to verify |
1 | if the session has the permission mask capabilities |
0 | otherwise |
Definition at line 7916 of file manager.c.
References ao2_global_obj_ref, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_lock, ao2_ref, ao2_unlock, result, session, sessions, and unref_mansession().
int astman_verify_session_writepermissions | ( | uint32_t | ident, |
int | perm | ||
) |
Verify a session's write permissions against a permission mask.
ident | session identity |
perm | permission mask to verify |
1 | if the session has the permission mask capabilities, otherwise 0 |
0 | otherwise |
Definition at line 7949 of file manager.c.
References ao2_global_obj_ref, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_lock, ao2_ref, ao2_unlock, result, session, sessions, and unref_mansession().
Referenced by http_post_callback().
|
static |
Definition at line 8478 of file manager.c.
References ao2_lock, ao2_unlock, ast_apply_acl(), ast_asprintf, ast_copy_string(), ast_debug, ast_free, ast_get_http_method(), ast_http_auth(), ast_http_error(), AST_HTTP_GET, ast_http_get_post_vars(), AST_HTTP_HEAD, AST_HTTP_POST, ast_http_request_close_on_completion(), ast_http_send(), ast_iostream_close(), ast_iostream_from_fd(), ast_iostream_get_fd(), AST_LIST_HEAD_INIT_NOLOCK, ast_log, ast_md5_hash(), ast_mutex_destroy, ast_mutex_init, ast_parse_digest(), ast_random(), AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_sockaddr_stringify_addr(), ast_str_append(), ast_str_create, ast_string_field_free_memory, ast_string_field_init, ast_strlen_zero(), ast_variables_destroy(), ast_verb, astman_append_headers(), astman_free_headers(), build_mansession(), close_mansession_file(), contenttype, d, errno, find_session_by_nonce(), FORMAT_HTML, FORMAT_XML, get_manager_by_name_locked(), global_realm, grab_last(), httptimeout, mansession::lock, LOG_NOTICE, LOG_WARNING, method, ast_variable::name, ast_variable::next, NULL, out, process_message(), process_output(), mansession::session, session, session_destroy(), mansession::stream, and ast_variable::value.
Referenced by auth_manager_http_callback(), auth_mxml_http_callback(), and auth_rawman_http_callback().
|
static |
Definition at line 8860 of file manager.c.
References ast_sockaddr_copy(), auth_http_callback(), FORMAT_HTML, method, ast_tcptls_session_instance::remote_address, and retval.
|
static |
Definition at line 8871 of file manager.c.
References ast_sockaddr_copy(), auth_http_callback(), FORMAT_XML, method, ast_tcptls_session_instance::remote_address, and retval.
|
static |
Definition at line 8882 of file manager.c.
References ast_sockaddr_copy(), auth_http_callback(), FORMAT_RAW, method, ast_tcptls_session_instance::remote_address, and retval.
|
static |
Definition at line 8223 of file manager.c.
References ast_iostream_close(), ast_log, LOG_ERROR, NULL, and mansession::stream.
Referenced by auth_http_callback(), generic_http_callback(), and process_output().
|
static |
locate an http session in the list. The search key (ident) is the value of the mansession_id cookie (0 is not valid and means a session on the AMI socket).
Definition at line 7828 of file manager.c.
References ao2_global_obj_ref, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_lock, ao2_ref, ao2_unlock, ast_atomic_fetchadd_int(), NULL, session, sessions, and unref_mansession().
Referenced by astman_is_authed(), generic_http_callback(), and manager_fax_session().
|
static |
locate an http session in the list. The search keys (nonce) and (username) is value from received "Authorization" http header. As well as in find_session() function, the value of the nonce can't be zero. (0 meansi, that the session used for AMI socket connection). Flag (stale) is set, if client used valid, but old, nonce value.
Definition at line 7867 of file manager.c.
References ao2_global_obj_ref, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_lock, ao2_ref, ao2_unlock, NULL, session, sessions, and unref_mansession().
Referenced by auth_http_callback().
|
static |
${AMI_CLIENT()} Dialplan function - reads manager client data
Definition at line 8936 of file manager.c.
References ao2_callback_data, ao2_global_obj_ref, ao2_ref, args, AST_APP_ARG, AST_DECLARE_APP_ARGS, ast_log, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, AST_STANDARD_APP_ARGS, ast_strip(), ast_strlen_zero(), buf, get_manager_by_name_locked(), get_manager_sessions_cb(), len(), LOG_ERROR, LOG_WARNING, name, NULL, and sessions.
|
static |
Definition at line 8266 of file manager.c.
References ao2_lock, ao2_unlock, ast_debug, ast_free, ast_http_error(), AST_HTTP_GET, ast_http_get_post_vars(), AST_HTTP_HEAD, ast_http_manid_from_vars(), AST_HTTP_POST, ast_http_request_close_on_completion(), ast_http_send(), ast_iostream_close(), ast_iostream_from_fd(), AST_LIST_HEAD_INIT_NOLOCK, ast_log, ast_mutex_destroy, ast_mutex_init, ast_mutex_lock, ast_mutex_unlock, AST_PTHREADT_NULL, ast_random(), ast_sockaddr_stringify_addr(), ast_str_append(), ast_str_create, ast_variables_destroy(), ast_verb, astman_append_headers(), astman_free_headers(), build_mansession(), close_mansession_file(), contenttype, displayconnects, errno, find_session(), FORMAT_HTML, FORMAT_XML, grab_last(), httptimeout, mansession::lock, LOG_WARNING, manager_displayconnects(), method, NULL, out, process_message(), process_output(), ROW_FMT, mansession::session, session, session_destroy(), mansession::stream, TEST_STRING, and unref_mansession().
Referenced by manager_http_callback(), mxml_http_callback(), and rawman_http_callback().
|
static |
Get number of logged in sessions for a login name.
Definition at line 8921 of file manager.c.
References session.
Referenced by function_amiclient().
|
static |
Definition at line 9202 of file manager.c.
References a, ao2_cleanup, ao2_find, ao2_global_obj_ref, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_cli(), ast_cli_completion_add(), AST_LIST_NEXT, ast_strdup, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, events, item, aco_type::name, ast_xml_doc_item::next, NULL, OBJ_KEY, print_event_instance(), RAII_VAR, and ast_cli_entry::usage.
|
static |
Definition at line 9084 of file manager.c.
References a, ao2_callback, ao2_container_count(), ao2_global_obj_ref, ao2_iterator_destroy(), ao2_iterator_next, ao2_lock, ao2_ref, ao2_unlock, ast_calloc, ast_cli(), ast_free, ast_log, AST_LOG_ERROR, ast_str_append(), ast_str_buffer(), ast_str_create, ast_str_set(), ast_xml_doc_item_cmp_fn(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, events, item, name, NULL, OBJ_MULTIPLE, OBJ_NOLOCK, and ast_cli_entry::usage.
|
static |
CLI command manager show settings.
Definition at line 9033 of file manager.c.
References a, allowmultiplelogin, ami_desc, ami_tls_cfg, amis_desc, ast_cli(), AST_CLI_YESNO, ast_sockaddr_stringify(), ast_tls_config::certfile, ast_tls_config::cipher, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, displayconnects, ast_tls_config::enabled, FORMAT, FORMAT2, FORMAT3, httptimeout, ast_tcptls_session_args::local_address, manager_channelvars, manager_debug, manager_disabledevents, manager_enabled, NULL, ast_tls_config::pvtfile, S_OR, timestampevents, ast_cli_entry::usage, and webmanager_enabled.
|
static |
Definition at line 9287 of file manager.c.
References args, AST_APP_ARG, ast_channel_set_manager_vars(), AST_DECLARE_APP_ARGS, ast_free, AST_STANDARD_APP_ARGS, ast_strdup, ast_strdupa, manager_channelvars, MAX_VARS, NULL, and var.
Referenced by __init_manager().
|
static |
Definition at line 9310 of file manager.c.
References ast_free, ast_strdup, manager_disabledevents, and var.
Referenced by __init_manager().
|
static |
Definition at line 10049 of file manager.c.
References __init_manager(), AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_SUCCESS, ast_register_cleanup(), AST_TEST_REGISTER, and manager_shutdown().
|
static |
Definition at line 10119 of file manager.c.
References ast_string_field_free_memory.
Referenced by ast_manager_event_blob_create().
|
static |
Definition at line 9320 of file manager.c.
References ao2_t_ref, ast_free, ast_free_acl_list(), and ast_variables_destroy().
Referenced by __init_manager(), and manager_shutdown().
|
static |
Definition at line 8801 of file manager.c.
References ast_sockaddr_copy(), FORMAT_HTML, generic_http_callback(), method, ast_tcptls_session_instance::remote_address, and retval.
|
static |
Definition at line 9507 of file manager.c.
References ami_desc, ami_tls_cfg, amis_desc, AST_CERTFILE, ast_config_AST_SYSTEM_NAME, ast_copy_string(), ast_free, ast_sockaddr_setnull(), ast_strdup, authlimit, authtimeout, broken_events_action, ast_tls_config::cafile, ast_tls_config::capath, ast_tls_config::certfile, ast_tls_config::cipher, DEFAULT_REALM, displayconnects, ast_tls_config::enabled, global_realm, ast_tcptls_session_args::local_address, manager_debug, manager_enabled, ast_tls_config::pvtfile, and S_OR.
Referenced by __init_manager().
|
static |
Definition at line 9339 of file manager.c.
References acl_change_stasis_unsubscribe(), ami_desc, ami_tls_cfg, amis_desc, ao2_cleanup, ao2_global_obj_release, ao2_t_global_obj_release, ARRAY_LEN, ast_cli_unregister_multiple(), ast_custom_function_unregister(), ast_free, AST_LIST_REMOVE_HEAD, ast_manager_get_generic_type(), ast_manager_unregister(), ast_tcptls_server_stop(), AST_TEST_UNREGISTER, ast_tls_config::cafile, ast_tls_config::capath, ast_tls_config::certfile, ast_tls_config::cipher, cli_manager, EVENT_FLAG_SHUTDOWN, manager_channelvars, manager_disabledevents, manager_event, manager_free_user(), manager_topic, managerclient_function, NULL, ast_tls_config::pvtfile, rtp_topic_forwarder, security_topic_forwarder, stasis_forward_cancel(), stasis_message_router_unsubscribe_and_join(), STASIS_MESSAGE_TYPE_CLEANUP, stasis_router, and user.
Referenced by load_module().
|
static |
Initialize all Stasis Message Bus API topics and routers used by the various sub-components of AMI.
Definition at line 9444 of file manager.c.
References ast_manager_get_generic_type(), ast_rtp_topic(), ast_security_topic(), AST_TASKPROCESSOR_HIGH_WATER_LEVEL, manager_default_msg_cb(), manager_generic_msg_cb(), manager_topic, NULL, rtp_topic_forwarder, security_topic_forwarder, stasis_forward_all(), stasis_message_router_add(), stasis_message_router_create, stasis_message_router_set_congestion_limits(), stasis_message_router_set_formatters_default(), stasis_router, and STASIS_SUBSCRIPTION_FORMATTER_AMI.
Referenced by subscribe_all().
|
static |
Definition at line 8812 of file manager.c.
References ast_sockaddr_copy(), FORMAT_XML, generic_http_callback(), method, ast_tcptls_session_instance::remote_address, and retval.
|
static |
Definition at line 8233 of file manager.c.
References ast_iostream_get_fd(), ast_iostream_write(), ast_log, ast_str_append(), buf, close_mansession_file(), FORMAT_HTML, FORMAT_XML, LOG_WARNING, NULL, out, mansession::stream, and xml_translate().
Referenced by auth_http_callback(), and generic_http_callback().
|
static |
cleanup code called at each iteration of server_root, guaranteed to happen every 5 seconds at most
Definition at line 8994 of file manager.c.
References ast_tcptls_session_args::poll_timeout, purge_events(), and purge_sessions().
|
static |
Definition at line 8823 of file manager.c.
References ast_sockaddr_copy(), FORMAT_RAW, generic_http_callback(), method, ast_tcptls_session_instance::remote_address, and retval.
|
static |
Definition at line 9477 of file manager.c.
References ast_log, AST_LOG_ERROR, manager_bridging_init(), manager_channels_init(), manager_endpoints_init(), manager_mwi_init(), manager_subscriptions_init(), manager_system_init(), and subscribed.
Referenced by __init_manager().
|
static |
|
static |
Definition at line 8066 of file manager.c.
References CMP_MATCH, CMP_STOP, str, and variable_count::varname.
Referenced by xml_translate().
|
static |
Definition at line 8059 of file manager.c.
References ast_str_hash(), and variable_count::varname.
Referenced by xml_translate().
|
static |
Definition at line 7987 of file manager.c.
References ast_str_append(), buf, and out.
Referenced by xml_translate().
|
static |
Convert the input into XML or HTML. The input is supposed to be a sequence of lines of the form Name: value optionally followed by a blob of unformatted text. A blank line is a section separator. Basically, this is a mixture of the format of Manager Interface and CLI commands. The unformatted text is considered as a single value of a field named 'Opaque-data'.
At the moment the output format is the following (but it may change depending on future requirements so don't count too much on it when writing applications):
General: the unformatted text is used as a value of XML output: to be completed
* Each section is within <response type="object" id="xxx"> * where xxx is taken from ajaxdest variable or defaults to unknown * Each row is reported as an attribute Name="value" of an XML * entity named from the variable ajaxobjtype, default to "generic" *
HTML output: each Name-value pair is output as a single row of a two-column table. Sections (blank lines in the input) are separated by a
Definition at line 8105 of file manager.c.
References ao2_alloc, AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_hash, ao2_find, ao2_link, ao2_ref, ast_debug, ast_skip_blanks(), ast_str_append(), ast_strlen_zero(), ast_trim_blanks(), variable_count::count, FORMAT_XML, in, ast_variable::name, ast_variable::next, NULL, out, strsep(), ast_variable::value, var, variable_count_cmp_fn(), variable_count_hash_fn(), variable_count::varname, and xml_copy_escape().
Referenced by process_output().
|
static |
|
static |
Definition at line 8902 of file manager.c.
Referenced by __init_manager().
|
static |
Definition at line 8911 of file manager.c.
Referenced by __init_manager().
|
static |
Definition at line 9011 of file manager.c.
Referenced by __init_manager(), handle_manager_show_settings(), manager_set_defaults(), and manager_shutdown().
|
static |
Definition at line 9010 of file manager.c.
Referenced by __init_manager(), handle_manager_show_settings(), manager_set_defaults(), and manager_shutdown().
|
static |
Definition at line 9022 of file manager.c.
Referenced by __init_manager(), handle_manager_show_settings(), manager_set_defaults(), and manager_shutdown().
|
static |
Definition at line 8893 of file manager.c.
Referenced by __init_manager().
|
static |
|
static |
Definition at line 9264 of file manager.c.
Referenced by __init_manager(), and manager_shutdown().
|
static |
Definition at line 7817 of file manager.c.
Referenced by auth_http_callback(), and generic_http_callback().
|
static |
description of AMI_CLIENT dialplan function
Definition at line 8983 of file manager.c.
Referenced by __init_manager(), and manager_shutdown().
|
static |
Definition at line 8842 of file manager.c.
Referenced by __init_manager().
|
static |
Definition at line 8850 of file manager.c.
Referenced by __init_manager().
|
static |
Definition at line 8834 of file manager.c.
Referenced by __init_manager().
|
static |
Definition at line 8989 of file manager.c.
Referenced by __init_manager().
const char* words[AST_MAX_CMD_LEN] |
Definition at line 225 of file manager.c.
Referenced by check_blacklist().