1602#define DEFAULT_REALM "asterisk"
1625#ifdef TEST_FRAMEWORK
1630#define MGR_SHOW_TERMINAL_WIDTH 80
1635#define EVENT_FLAG_SHUTDOWN -1
1647#define MAX_BLACKLIST_CMD_LEN 2
1648static const struct {
1651 {{
"module",
"load",
NULL }},
1652 {{
"module",
"unload",
NULL }},
1653 {{
"restart",
"gracefully",
NULL }},
1836 ao2_t_ref(act, +1,
"found action object");
1881 size_t index,
struct ast_str **res,
1891 const char *parent_key,
struct ast_str **res,
1896 ast_str_set(&key_str, 0,
"%s/%s", parent_key, key);
1919 if (exclusion_cb && key && exclusion_cb(key)) {
1933 key, j, res, exclusion_cb);
1942 key, res, exclusion_cb);
1957#define manager_event_sessions(sessions, category, event, contents , ...) \
1958 __manager_event_sessions(sessions, category, event, 0, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, contents , ## __VA_ARGS__)
1960#define any_manager_listeners(sessions) \
1961 ((sessions && ao2_container_count(sessions)) || !AST_RWLIST_EMPTY(&manager_hooks))
2017 if (!event_buffer) {
2041 "class_type", class_type,
2168#define MAX_AUTH_PERM_STRING 150
2175 strstr(evaluating,
"SHELL") ||
2176 strstr(evaluating,
"EVAL")
2217 if (authority &
perms[i].num) {
2237static int ast_instring(
const char *bigstr,
const char *smallstr,
const char delim)
2239 const char *
val = bigstr, *next;
2242 if ((next = strchr(
val, delim))) {
2243 if (!strncmp(
val, smallstr, (next -
val))) {
2249 return !strcmp(smallstr,
val);
2251 }
while (*(
val = (next + 1)));
2285 for (p =
string; *p; p++) {
2286 if (*p < '0' || *p >
'9') {
2291 return atoi(
string);
2310 int refcount =
ao2_ref(s, -1);
2312 ast_debug(1,
"Mansession: %p refcount now %d\n", s, refcount - 1);
2319 regex_t *regex_filter = obj;
2320 regfree(regex_filter);
2343 ao2_t_ref(
session->whitefilters, -1,
"decrement ref for white container, should be last one");
2347 ao2_t_ref(
session->blackfilters, -1,
"decrement ref for black container, should be last one");
2435 if (!strcasecmp(
user->username,
name)) {
2454 ret =
user->displayconnects;
2471 const char *auth_str;
2473 char syntax_title[64], description_title[64], synopsis_title[64], seealso_title[64];
2474 char arguments_title[64], privilege_title[64], final_response_title[64], list_responses_title[64];
2479 e->
command =
"manager show command";
2481 "Usage: manager show command <actionname> [<actionname> [<actionname> [...]]]\n"
2482 " Shows the detailed description for a specific Asterisk manager interface command.\n";
2485 l = strlen(
a->word);
2488 if (!strncasecmp(
a->word, cur->
action, l)) {
2517 for (num = 3; num <
a->argc; num++) {
2518 if (!strcasecmp(cur->
action,
a->argv[num])) {
2531 if (!syntax || !
synopsis || !description || !arguments
2532 || !seealso || !privilege || !responses) {
2540 ast_cli(
a->fd,
"Allocation failure.\n");
2546 ast_cli(
a->fd,
"%s%s\n\n%s%s\n\n%s%s\n\n%s%s\n\n%s%s\n\n%s%s\n\n%s",
2547 syntax_title, syntax,
2549 description_title, description,
2550 arguments_title, arguments,
2551 seealso_title, seealso,
2552 privilege_title, privilege,
2553 list_responses_title);
2556 ast_cli(
a->fd,
"%s\n\n", responses);
2565 ast_cli(
a->fd,
"%s", final_response_title);
2568 ast_cli(
a->fd,
"%s\n\n", responses);
2584 ast_cli(
a->fd,
"Action: %s\nSynopsis: %s\nPrivilege: %s\n%s\n",
2601 e->
command =
"manager set debug [on|off]";
2602 e->
usage =
"Usage: manager set debug [on|off]\n Show, enable, disable debugging of the manager code.\n";
2610 }
else if (
a->argc == 4) {
2611 if (!strcasecmp(
a->argv[3],
"on")) {
2613 }
else if (!strcasecmp(
a->argv[3],
"off")) {
2632 e->
command =
"manager show user";
2634 " Usage: manager show user <user>\n"
2635 " Display all information related to the manager user specified.\n";
2638 l = strlen(
a->word);
2644 if (!strncasecmp(
a->word,
user->username, l)) {
2661 ast_cli(
a->fd,
"There is no manager called %s\n",
a->argv[3]);
2673 " displayconnects: %s\n"
2674 "allowmultiplelogin: %s\n",
2676 (
user->secret ?
"<Set>" :
"(N/A)"),
2680 (
user->displayconnects ?
"yes" :
"no"),
2681 (
user->allowmultiplelogin ?
"yes" :
"no"));
2683 for (v =
user->chanvars ; v ; v = v->
next) {
2701 e->
command =
"manager show users";
2703 "Usage: manager show users\n"
2704 " Prints a listing of all managers that are currently configured on that\n"
2718 ast_cli(
a->fd,
"There are no manager users.\n");
2723 ast_cli(
a->fd,
"\nusername\n--------\n");
2732 ast_cli(
a->fd,
"-------------------\n"
2733 "%d manager users configured.\n", count_amu);
2742 int space_remaining;
2743#define HSMC_FORMAT " %-*.*s %-.*s\n"
2746 e->
command =
"manager show commands";
2748 "Usage: manager show commands\n"
2749 " Prints a listing of all the available Asterisk manager interface commands.\n";
2757 int incoming_len = strlen(cur->
action);
2758 if (incoming_len > name_len) {
2759 name_len = incoming_len;
2764 if (space_remaining < 0) {
2765 space_remaining = 0;
2790 e->
command =
"manager kick session";
2792 "Usage: manager kick session <file descriptor>\n"
2793 " Kick an active Asterisk Manager Interface session\n";
2803 fd = atoi(
a->argv[3]);
2805 ast_cli(
a->fd,
"Invalid AMI file descriptor: %s\n",
a->argv[3]);
2818 ast_cli(
a->fd,
"Manager session using file descriptor %d has already been kicked\n", fd);
2825 ast_cli(
a->fd,
"Kicking manager session connected using file descriptor %d\n", fd);
2829 pthread_kill(
session->waiting_thread, SIGURG);
2844 ast_cli(
a->fd,
"No manager session found using file descriptor %d\n", fd);
2854 time_t now = time(
NULL);
2855#define HSMCONN_FORMAT1 " %-15.15s %-55.55s %-10.10s %-10.10s %-8.8s %-8.8s %-10.10s %-10.10s\n"
2856#define HSMCONN_FORMAT2 " %-15.15s %-55.55s %-10d %-10d %-8d %-8d %-10.10d %-10.10d\n"
2862 e->
command =
"manager show connected";
2864 "Usage: manager show connected\n"
2865 " Prints a listing of the users that are currently connected to the\n"
2866 "Asterisk manager interface.\n";
2872 ast_cli(
a->fd,
HSMCONN_FORMAT1,
"Username",
"IP Address",
"Start",
"Elapsed",
"FileDes",
"HttpCnt",
"ReadPerms",
"WritePerms");
2882 (
int) (
session->sessionstart),
2883 (
int) (now -
session->sessionstart),
2894 ast_cli(
a->fd,
"%d users connected.\n", count);
2906 e->
command =
"manager show eventq";
2908 "Usage: manager show eventq\n"
2909 " Prints a listing of all events pending in the Asterisk manger\n"
2919 ast_cli(
a->fd,
"Event:\n%s", s->eventdata);
2933 e->
command =
"manager reload";
2935 "Usage: manager reload\n"
2936 " Reloads the manager configuration.\n";
2961#define GET_HEADER_FIRST_MATCH 0
2962#define GET_HEADER_LAST_MATCH 1
2963#define GET_HEADER_SKIP_EMPTY 2
2980 int x, l = strlen(
var);
2987 for (x = 0; x < m->
hdrcount; x++) {
2988 const char *h = m->
headers[x];
2989 if (!strncasecmp(
var, h, l) && h[l] ==
':') {
2990 const char *
value = h + l + 1;
3073 for (y = 0; y <
args.argc; y++) {
3078 if (!
args.vars[y]) {
3113 static const char var_hdr[] =
"Variable:";
3116 varlen = strlen(var_hdr);
3117 for (x = 0; x < m->
hdrcount; x++) {
3118 if (strncasecmp(var_hdr, m->
headers[x], varlen)) {
3155 curlen = strlen(src);
3156 for (x = 0; x < curlen; x++) {
3158 if (src[x] ==
'\r' && x+1 < curlen && src[x+1] ==
'\n')
3160 else if (src[x] ==
'\n')
3179 if (!strcasecmp(action,
"login")) {
3202 if (!act_found->
module || mod_ref) {
3203 ret = act_found->
func(&s, &m);
3209 ao2_t_ref(act_found, -1,
"done with found action object");
3237 len = strlen(
string);
3261#define ASTMAN_APPEND_BUF_INITSIZE 256
3268 ast_verbose(
"No connection stream in astman_append, should not happen\n");
3295 ast_verbose(
"No connection stream in astman_append, should not happen\n");
3309#define MSG_MOREDATA ((char *)astman_send_response)
3416 "EventList: Complete\r\n"
3417 "ListItems: %d\r\n",
3482 char session_id[32];
3486 .common.service =
"AMI",
3487 .common.account_id = username,
3489 .common.local_addr = {
3493 .common.remote_addr = {
3497 .common.session_id = session_id,
3500 snprintf(session_id,
sizeof(session_id),
"%p", s);
3507 char session_id[32];
3511 .common.service =
"AMI",
3512 .common.account_id = username,
3514 .common.local_addr = {
3518 .common.remote_addr = {
3522 .common.session_id = session_id,
3525 snprintf(session_id,
sizeof(session_id),
"%p", s->
session);
3532 char session_id[32];
3536 .common.service =
"AMI",
3537 .common.account_id = username,
3539 .common.local_addr = {
3543 .common.remote_addr = {
3547 .common.session_id = session_id,
3550 snprintf(session_id,
sizeof(session_id),
"%p", s->
session);
3557 char session_id[32];
3561 .common.service =
"AMI",
3564 .common.local_addr = {
3568 .common.remote_addr = {
3572 .common.session_id = session_id,
3575 snprintf(session_id,
sizeof(session_id),
"%p", s->
session);
3582 char session_id[32];
3583 char request_type[64];
3587 .common.service =
"AMI",
3590 .common.local_addr = {
3594 .common.remote_addr = {
3598 .common.session_id = session_id,
3603 snprintf(session_id,
sizeof(session_id),
"%p", s->
session);
3611 char session_id[32];
3616 .common.service =
"AMI",
3619 .common.local_addr = {
3623 .common.remote_addr = {
3627 .common.session_id = session_id,
3632 snprintf(session_id,
sizeof(session_id),
"%p", s->
session);
3639 const char *response,
const char *expected_response)
3641 char session_id[32];
3645 .common.service =
"AMI",
3648 .common.local_addr = {
3652 .common.remote_addr = {
3656 .common.session_id = session_id,
3663 snprintf(session_id,
sizeof(session_id),
"%p", s->
session);
3670 char session_id[32];
3674 .common.service =
"AMI",
3677 .common.local_addr = {
3681 .common.remote_addr = {
3685 .common.session_id = session_id,
3688 snprintf(session_id,
sizeof(session_id),
"%p", s->
session);
3706 regex_t *regex_filter;
3727 char md5key[256] =
"";
3729 unsigned char digest[16];
3735 for (x = 0; x < 16; x++)
3736 len += sprintf(md5key +
len,
"%02hhx", digest[x]);
3737 if (!strcmp(md5key, key)) {
3743 ast_debug(1,
"MD5 authentication is not possible. challenge: '%s'\n",
3746 }
else if (
user->secret) {
3747 if (!strcmp(password,
user->secret)) {
3769 if (
user->chanvars) {
3776 ao2_t_ref(regex_filter, -1,
"remove iterator ref");
3783 ao2_t_ref(regex_filter, -1,
"remove iterator ref");
3809 "Timestamp: %ld.%06lu\r\n"
3811 (
long) now.tv_sec, (
unsigned long) now.tv_usec);
3838 char *stripped_filename;
3849 if (stripped_filename[0] ==
'/') {
3850 real_path = realpath(stripped_filename,
NULL);
3855 real_path = realpath(path,
NULL);
3875 const char *category_name;
3892 }
else if (ret == -1) {
3912 astman_append(s,
"Category-%06d: %s\r\n", catcount, category_name);
3969 if (catcount == 0) {
3983 if (*
in ==
'\\' || *
in ==
'\"') {
4014 const char *category_name;
4090 for (x = 0; x < 100000; x++) {
4091 unsigned int object = 0;
4095 int ignoreerror = 0;
4103 snprintf(hdr,
sizeof(hdr),
"Action-%06d", x);
4108 snprintf(hdr,
sizeof(hdr),
"Cat-%06d", x);
4115 snprintf(hdr,
sizeof(hdr),
"Var-%06d", x);
4118 snprintf(hdr,
sizeof(hdr),
"Value-%06d", x);
4126 snprintf(hdr,
sizeof(hdr),
"Match-%06d", x);
4129 snprintf(hdr,
sizeof(hdr),
"Line-%06d", x);
4132 snprintf(hdr,
sizeof(hdr),
"Options-%06d", x);
4139 if (!strcasecmp(
"allowdups", token)) {
4143 if (!strcasecmp(
"template", token)) {
4147 if (!strcasecmp(
"ignoreerror", token)) {
4170 if (!strcasecmp(action,
"newcat")) {
4172 char *tmpl_name =
NULL;
4212 if (category !=
NULL) {
4223 }
else if (!strcasecmp(action,
"renamecat")) {
4239 }
else if (!strcasecmp(action,
"delcat")) {
4246 if (!foundcat && !ignoreerror) {
4250 }
else if (!strcasecmp(action,
"emptycat")) {
4261 }
else if (!strcasecmp(action,
"update")) {
4285 }
else if (!strcasecmp(action,
"delete")) {
4305 if (!foundvar && !ignoreerror) {
4309 }
else if (!strcasecmp(action,
"append")) {
4321 if (
object || (
match && !strcasecmp(
match,
"object"))) {
4332 }
else if (!strcasecmp(action,
"insert")) {
4372 const char *preserve_effective_context_string =
astman_get_header(m,
"PreserveEffectiveContext");
4483 snprintf(idText,
sizeof(idText),
"ActionID: %s\r\n",
id);
4489 sscanf(timeouts,
"%30i", &timeout);
4510 time_t now = time(
NULL);
4516 if (timeout < 0 || timeout >
max) {
4528 ast_debug(1,
"Starting waiting for an event!\n");
4530 for (x = 0; x < timeout || timeout < 0; x++) {
4559 ast_debug(1,
"Finished waiting for an event!\n");
4579 "Event: WaitEventComplete\r\n"
4585 ast_debug(1,
"Abandoning event request!\n");
4618 snprintf(id_text,
sizeof(id_text),
"ActionID: %s\r\n",
id);
4630 if (!strcasecmp(
perms[x].label,
"all") && res ==
perms[x].
num) {
4635 "Events: On\r\n\r\n", id_text);
4636 }
else if (res == 0)
4638 "Events: Off\r\n\r\n", id_text);
4644 "Events: On\r\n\r\n", id_text);
4647 "Events: Off\r\n\r\n", id_text);
4686 long lastreloaded = 0;
4692 uptime =
tmp.tv_sec;
4697 lastreloaded =
tmp.tv_sec;
4703 "LastReload: %ld\r\n"
4704 "Status: Fully Booted\r\n\r\n", cat_str, uptime, lastreloaded);
4713 if (!strcasecmp(authtype,
"MD5")) {
4740 int channels_matched = 0;
4748 snprintf(idText,
sizeof(idText),
"ActionID: %s\r\n",
id);
4753 if (cause_validator) {
4754 causecode = cause_validator(name_or_regex, cause);
4757 causecode = strtol(cause, &endptr, 10);
4758 if (causecode < 0 || causecode > 127 || *endptr !=
'\0') {
4768 if (name_or_regex[0] !=
'/') {
4776 ast_verb(3,
"%sManager '%s' from %s, hanging up channel: %s\n",
4782 hangup_handler(
c, causecode);
4794 if (!regex_string) {
4801 astman_send_error(s, m,
"Regex format invalid, Channel param should be /regex/");
4807 if (regcomp(®exbuf,
ast_str_buffer(regex_string), REG_EXTENDED | REG_NOSUB)) {
4822 ast_verb(3,
"%sManager '%s' from %s, hanging up channel: %s\n",
4828 hangup_handler(
c, causecode);
4832 "Event: ChannelHungup\r\n"
4893 char workspace[1024];
4913 workspace[0] =
'\0';
4914 if (varname[strlen(varname) - 1] ==
')') {
4918 ast_func_read(
c, (
char *) varname, workspace,
sizeof(workspace));
4920 ast_log(
LOG_ERROR,
"Unable to allocate bogus channel for variable substitution. Function results may be blank.\n");
4922 ast_func_read(
c, (
char *) varname, workspace,
sizeof(workspace));
4934 astman_append(s,
"Variable: %s\r\nValue: %s\r\n\r\n", varname,
S_OR(varval,
""));
4942 long elapsed_seconds;
4960 if (!snapshot_str) {
4964 if (all_variables) {
4969 if (!variable_str) {
4978 for (i = 0; i < varc; i++) {
4979 char valbuf[512], *ret =
NULL;
4981 if (vars[i][strlen(vars[i]) - 1] ==
')') {
4982 if (
ast_func_read(chan, vars[i], valbuf,
sizeof(valbuf)) < 0) {
4990 ast_str_append(&variable_str, 0,
"Variable: %s=%s\r\n", vars[i], ret);
4994 if (all_variables) {
5008 "Privilege: Call\r\n"
5012 "EffectiveConnectedLineNum: %s\r\n"
5013 "EffectiveConnectedLineName: %s\r\n"
5014 "TimeToHangup: %ld\r\n"
5016 "Application: %s\r\n"
5018 "Nativeformats: %s\r\n"
5019 "Readformat: %s\r\n"
5021 "Writeformat: %s\r\n"
5022 "Writetrans: %s\r\n"
5023 "Callgroup: %llu\r\n"
5024 "Pickupgroup: %llu\r\n"
5045 (
long)elapsed_seconds,
5059 int all_variables = 0;
5072 all_variables =
ast_true(all_chan_variables);
5097 snprintf(id_text,
sizeof(id_text),
"ActionID: %s\r\n",
id);
5149 obj_size = payload_size +
sizeof(*obj);
5158 memcpy(obj->
payload, payload, payload_size);
5192 const char *content_type)
5289 if (sscanf(
priority,
"%30d", &pi) != 1) {
5307 if (sscanf(priority2,
"%30d", &pi2) != 1) {
5318 snprintf(
buf,
sizeof(
buf),
"Channel does not exist: %s",
name);
5342 snprintf(
buf,
sizeof(
buf),
"ExtraChannel does not exist: %s", name2);
5519 if (!feature_code) {
5541 char *cmd_copy, *cur_cmd;
5553 cmd_words[i] = cur_cmd;
5578 char *
buf =
NULL, *final_buf =
NULL, *delim, *output;
5579 char template[] =
"/tmp/ast-ami-XXXXXX";
5593 if ((fd = mkstemp(
template)) < 0) {
5602 if ((
len = lseek(fd, 0, SEEK_END)) < 0) {
5603 astman_append(s,
"Message: Failed to determine number of characters: %s\r\n", strerror(
errno));
5604 goto action_command_cleanup;
5611 if (!
buf || !final_buf) {
5613 goto action_command_cleanup;
5616 if (lseek(fd, 0, SEEK_SET) < 0) {
5617 astman_append(s,
"Message: Failed to set position on temporary file: %s\r\n", strerror(
errno));
5618 goto action_command_cleanup;
5621 if (read(fd,
buf,
len) < 0) {
5622 astman_append(s,
"Message: Failed to read from temporary file: %s\r\n", strerror(
errno));
5623 goto action_command_cleanup;
5628 final_buf[
len] =
'\0';
5631 if (
len && final_buf[
len - 1] ==
'\n') {
5632 final_buf[
len - 1] =
'\0';
5638 while ((output =
strsep(&delim,
"\n"))) {
5642action_command_cleanup:
5700 .uniqueid2 =
in->otherchannelid
5705 in->timeout,
in->app,
in->appdata, &reason,
5709 in->vars,
in->account, &chan, &assignedids);
5712 in->timeout,
in->context,
in->exten,
in->priority, &reason,
5716 in->vars,
in->account, &chan,
in->early_media, &assignedids);
5729 "Application: %s\r\n"
5733 "CallerIDNum: %s\r\n"
5734 "CallerIDName: %s\r\n",
5735 in->idtext, res ?
"Failure" :
"Success",
5737 in->app,
in->appdata, reason,
5739 S_OR(
in->cid_num,
"<unknown>"),
5740 S_OR(
in->cid_name,
"<unknown>")
5751 "CallerIDNum: %s\r\n"
5752 "CallerIDName: %s\r\n",
5753 in->idtext, res ?
"Failure" :
"Success",
5755 in->context,
in->exten, reason,
5757 S_OR(
in->cid_num,
"<unknown>"),
5758 S_OR(
in->cid_name,
"<unknown>")
5773 const char *unitamount;
5774 const char *unittype;
5786 entry->valid_amount = 1;
5790 entry->valid_type = 1;
5806 const char *association_num =
astman_get_header(m,
"ChargingAssociationNumber");
5814 unsigned int _currencyamount = 0;
5815 int _association_id = 0;
5816 unsigned int _association_plan = 0;
5822 goto aocmessage_cleanup;
5827 if (!strcasecmp(chargetype,
"NA")) {
5829 }
else if (!strcasecmp(chargetype,
"Free")) {
5831 }
else if (!strcasecmp(chargetype,
"Currency")) {
5833 }
else if (!strcasecmp(chargetype,
"Unit")) {
5837 goto aocmessage_cleanup;
5842 if (
ast_strlen_zero(currencyamount) || (sscanf(currencyamount,
"%30u", &_currencyamount) != 1)) {
5843 astman_send_error(s, m,
"Invalid CurrencyAmount, CurrencyAmount is a required when ChargeType is Currency");
5844 goto aocmessage_cleanup;
5848 astman_send_error(s, m,
"ChargeMultiplier unspecified, ChargeMultiplier is required when ChargeType is Currency.");
5849 goto aocmessage_cleanup;
5850 }
else if (!strcasecmp(mult,
"onethousandth")) {
5852 }
else if (!strcasecmp(mult,
"onehundredth")) {
5854 }
else if (!strcasecmp(mult,
"onetenth")) {
5856 }
else if (!strcasecmp(mult,
"one")) {
5858 }
else if (!strcasecmp(mult,
"ten")) {
5860 }
else if (!strcasecmp(mult,
"hundred")) {
5862 }
else if (!strcasecmp(mult,
"thousand")) {
5866 goto aocmessage_cleanup;
5873 goto aocmessage_cleanup;
5877 if (!
ast_strlen_zero(totaltype) && !strcasecmp(totaltype,
"subtotal")) {
5883 }
else if (!strcasecmp(aocbillingid,
"Normal")) {
5885 }
else if (!strcasecmp(aocbillingid,
"ReverseCharge")) {
5887 }
else if (!strcasecmp(aocbillingid,
"CreditCard")) {
5891 goto aocmessage_cleanup;
5896 }
else if (!strcasecmp(aocbillingid,
"Normal")) {
5898 }
else if (!strcasecmp(aocbillingid,
"ReverseCharge")) {
5900 }
else if (!strcasecmp(aocbillingid,
"CreditCard")) {
5902 }
else if (!strcasecmp(aocbillingid,
"CallFwdUnconditional")) {
5904 }
else if (!strcasecmp(aocbillingid,
"CallFwdBusy")) {
5906 }
else if (!strcasecmp(aocbillingid,
"CallFwdNoReply")) {
5908 }
else if (!strcasecmp(aocbillingid,
"CallDeflection")) {
5910 }
else if (!strcasecmp(aocbillingid,
"CallTransfer")) {
5914 goto aocmessage_cleanup;
5917 if (!
ast_strlen_zero(association_id) && (sscanf(association_id,
"%30d", &_association_id) != 1)) {
5919 goto aocmessage_cleanup;
5921 if (!
ast_strlen_zero(association_plan) && (sscanf(association_plan,
"%30u", &_association_plan) != 1)) {
5923 goto aocmessage_cleanup;
5926 if (_association_id) {
5940 for (i = 0; i < 32; i++) {
5950 astman_send_error(s, m,
"Invalid UnitAmount(0), At least one valid unit entry is required when ChargeType is set to Unit");
5951 goto aocmessage_cleanup;
5986 unsigned int _currencyamount = 0;
5988 unsigned int _time = 0;
5990 unsigned int _granularity = 0;
5997 goto aocmessage_cleanup;
6002 goto aocmessage_cleanup;
6005 if (!strcasecmp(chargeditem,
"NA")) {
6007 }
else if (!strcasecmp(chargeditem,
"SpecialArrangement")) {
6009 }
else if (!strcasecmp(chargeditem,
"BasicCommunication")) {
6011 }
else if (!strcasecmp(chargeditem,
"CallAttempt")) {
6013 }
else if (!strcasecmp(chargeditem,
"CallSetup")) {
6015 }
else if (!strcasecmp(chargeditem,
"UserUserInfo")) {
6017 }
else if (!strcasecmp(chargeditem,
"SupplementaryService")) {
6021 goto aocmessage_cleanup;
6024 if (!strcasecmp(ratetype,
"NA")) {
6026 }
else if (!strcasecmp(ratetype,
"Free")) {
6028 }
else if (!strcasecmp(ratetype,
"FreeFromBeginning")) {
6030 }
else if (!strcasecmp(ratetype,
"Duration")) {
6032 }
else if (!strcasecmp(ratetype,
"Flat")) {
6034 }
else if (!strcasecmp(ratetype,
"Volume")) {
6036 }
else if (!strcasecmp(ratetype,
"SpecialCode")) {
6040 goto aocmessage_cleanup;
6044 if (
ast_strlen_zero(currencyamount) || (sscanf(currencyamount,
"%30u",
6045 &_currencyamount) != 1)) {
6046 astman_send_error(s, m,
"Invalid CurrencyAmount, CurrencyAmount is a required when RateType is non-free");
6047 goto aocmessage_cleanup;
6051 astman_send_error(s, m,
"ChargeMultiplier unspecified, ChargeMultiplier is required when ChargeType is Currency.");
6052 goto aocmessage_cleanup;
6053 }
else if (!strcasecmp(mult,
"onethousandth")) {
6055 }
else if (!strcasecmp(mult,
"onehundredth")) {
6057 }
else if (!strcasecmp(mult,
"onetenth")) {
6059 }
else if (!strcasecmp(mult,
"one")) {
6061 }
else if (!strcasecmp(mult,
"ten")) {
6063 }
else if (!strcasecmp(mult,
"hundred")) {
6065 }
else if (!strcasecmp(mult,
"thousand")) {
6069 goto aocmessage_cleanup;
6075 astman_send_error(s, m,
"TimeScale unspecified, TimeScale is required when RateType is Duration.");
6076 goto aocmessage_cleanup;
6077 }
else if (!strcasecmp(timescale,
"onehundredthsecond")) {
6079 }
else if (!strcasecmp(timescale,
"onetenthsecond")) {
6081 }
else if (!strcasecmp(timescale,
"second")) {
6083 }
else if (!strcasecmp(timescale,
"tenseconds")) {
6085 }
else if (!strcasecmp(timescale,
"minute")) {
6087 }
else if (!strcasecmp(timescale,
"hour")) {
6089 }
else if (!strcasecmp(timescale,
"day")) {
6093 goto aocmessage_cleanup;
6097 astman_send_error(s, m,
"Invalid Time, Time is a required when RateType is Duration");
6098 goto aocmessage_cleanup;
6102 if ((sscanf(time,
"%30u", &_granularity) != 1)) {
6104 goto aocmessage_cleanup;
6108 astman_send_error(s, m,
"Invalid GranularityTimeScale, GranularityTimeScale is a required when Granularity is specified");
6109 }
else if (!strcasecmp(granularitytimescale,
"onehundredthsecond")) {
6111 }
else if (!strcasecmp(granularitytimescale,
"onetenthsecond")) {
6113 }
else if (!strcasecmp(granularitytimescale,
"second")) {
6115 }
else if (!strcasecmp(granularitytimescale,
"tenseconds")) {
6117 }
else if (!strcasecmp(granularitytimescale,
"minute")) {
6119 }
else if (!strcasecmp(granularitytimescale,
"hour")) {
6121 }
else if (!strcasecmp(granularitytimescale,
"day")) {
6125 goto aocmessage_cleanup;
6129 if (
ast_strlen_zero(chargingtype) || strcasecmp(chargingtype,
"continuouscharging") == 0) {
6131 }
else if (strcasecmp(chargingtype,
"stepfunction") == 0 ) {
6135 goto aocmessage_cleanup;
6141 astman_send_error(s, m,
"VolumeUnit unspecified, VolumeUnit is required when RateType is Volume.");
6142 goto aocmessage_cleanup;
6143 }
else if (!strcasecmp(timescale,
"octet")) {
6145 }
else if (!strcasecmp(timescale,
"segment")) {
6147 }
else if (!strcasecmp(timescale,
"message")) {
6151 goto aocmessage_cleanup;
6158 astman_send_error(s, m,
"Invalid Code, Code is a required when ChargedItem is SpecialArrangement and when RateType is SpecialCode");
6159 goto aocmessage_cleanup;
6167 currencyname, _time, _scale, _granularity, _granularity_time_scale, _step);
6173 _mult, currencyname);
6197 static const char hdr[] =
"ChargedItem:";
6203 goto aocmessage_cleanup;
6206 hdrlen = strlen(hdr);
6207 for (x = 0; x < m->
hdrcount; x++) {
6208 if (strncasecmp(hdr, m->
headers[x], hdrlen) == 0) {
6211 goto aocmessage_cleanup;
6222 goto aocmessage_cleanup;
6244 size_t encoded_size = 0;
6247 astman_send_error(s, m,
"Channel and PartialChannel are not specified. Specify at least one of these.");
6248 goto aocmessage_cleanup;
6257 goto aocmessage_cleanup;
6260 if (strcasecmp(msgtype,
"d") == 0 || strcasecmp(msgtype,
"e") == 0) {
6263 else if (strcasecmp(msgtype,
"s") == 0) {
6268 goto aocmessage_cleanup;
6272 goto aocmessage_cleanup;
6279 astman_send_error(s, m,
"Error encoding AOC message, could not queue onto channel");
6325 int bridge_early = 0;
6338 goto fast_orig_cleanup;
6344 goto fast_orig_cleanup;
6350 goto fast_orig_cleanup;
6353 if (!
ast_strlen_zero(timeout) && (sscanf(timeout,
"%30d", &to) != 1)) {
6356 goto fast_orig_cleanup;
6360 data = strchr(
tmp,
'/');
6364 goto fast_orig_cleanup;
6386 int bad_appdata = 0;
6400 (strstr(appdata,
"SHELL") && (bad_appdata = 1)) ||
6401 (strstr(appdata,
"EVAL") && (bad_appdata = 1))
6404 snprintf(error_buf,
sizeof(error_buf),
"Originate Access Forbidden: %s", bad_appdata ?
"Data" :
"Application");
6407 goto fast_orig_cleanup;
6417 goto fast_orig_cleanup;
6432 for (v = vars; v->
next; v = v->
next );
6438 bridge_early =
ast_true(early_media);
6485 l, n, vars, account,
NULL, bridge_early,
6489 astman_send_error(s, m,
"Originate with 'Exten' requires 'Context' and 'Priority'");
6492 goto fast_orig_cleanup;
6519 "Waiting: %d\r\n\r\n",
mailbox, ret);
6526 int newmsgs = 0, oldmsgs = 0, urgentmsgs = 0;;
6536 "UrgMessages: %d\r\n"
6537 "NewMessages: %d\r\n"
6538 "OldMessages: %d\r\n"
6540 mailbox, urgentmsgs, newmsgs, oldmsgs);
6567 "StatusText: %s\r\n"
6606 "PresenceMessage: %s\r\n",
6619 struct timeval when = { timeout, 0 };
6626 if (!timeout || timeout < 0) {
6636 when.tv_usec = (timeout - when.tv_sec) * 1000000.0;
6650 regex_t *regex_filter = obj;
6651 const char *eventdata = arg;
6654 if (!regexec(regex_filter, eventdata, 0,
NULL, 0)) {
6664 regex_t *regex_filter = obj;
6665 const char *eventdata = arg;
6668 if (!regexec(regex_filter, eventdata, 0,
NULL, 0)) {
6687 if (!strcasecmp(operation,
"Add")) {
6695 astman_send_error(s, m,
"Filter did not compile. Check the syntax of the filter given.");
6741 if (filter_pattern[0] ==
'!') {
6748 if (regcomp(new_filter, filter_pattern, REG_EXTENDED | REG_NOSUB)) {
6749 ao2_t_ref(new_filter, -1,
"failed to make regex");
6753 if (is_blackfilter) {
6754 ao2_t_link(blackfilters, new_filter,
"link new filter into black user container");
6756 ao2_t_link(whitefilters, new_filter,
"link new filter into white user container");
6769 ast_verbose(
"<-- Examining AMI event: -->\n%s\n", eventdata);
6771 ast_debug(4,
"Examining AMI event:\n%s\n", eventdata);
6808 ast_debug(3,
"Received CloseSession event\n");
6834 for (x = 0; x < m->
hdrcount; x++) {
6835 if (strncasecmp(
"UserEvent:", m->
headers[x], strlen(
"UserEvent:")) &&
6836 strncasecmp(
"Action:", m->
headers[x], strlen(
"Action:"))) {
6853 snprintf(idText,
sizeof(idText),
"ActionID: %s\r\n", actionid);
6860 "AMIversion: %s\r\n"
6861 "AsteriskVersion: %s\r\n"
6862 "SystemName: %s\r\n"
6863 "CoreMaxCalls: %d\r\n"
6864 "CoreMaxLoadAvg: %f\r\n"
6865 "CoreRunUser: %s\r\n"
6866 "CoreRunGroup: %s\r\n"
6867 "CoreMaxFilehandles: %d\r\n"
6868 "CoreRealTimeEnabled: %s\r\n"
6869 "CoreCDRenabled: %s\r\n"
6870 "CoreHTTPenabled: %s\r\n"
6871 "SoundsSearchCustomDir: %s\r\n"
6895 char startuptime[150], startupdate[150];
6896 char reloadtime[150], reloaddate[150];
6900 snprintf(idText,
sizeof(idText),
"ActionID: %s\r\n", actionid);
6906 ast_strftime(startuptime,
sizeof(startuptime),
"%H:%M:%S", &tm);
6907 ast_strftime(startupdate,
sizeof(startupdate),
"%Y-%m-%d", &tm);
6909 ast_strftime(reloadtime,
sizeof(reloadtime),
"%H:%M:%S", &tm);
6910 ast_strftime(reloaddate,
sizeof(reloaddate),
"%Y-%m-%d", &tm);
6914 "CoreStartupDate: %s\r\n"
6915 "CoreStartupTime: %s\r\n"
6916 "CoreReloadDate: %s\r\n"
6917 "CoreReloadTime: %s\r\n"
6918 "CoreCurrentCalls: %d\r\n"
6973 snprintf(idText,
sizeof(idText),
"ActionID: %s\r\n", actionid);
6985 char durbuf[16] =
"";
6992 int duration, durh, durm, durs;
6995 durh = duration / 3600;
6996 durm = (duration % 3600) / 60;
6997 durs = duration % 60;
6998 snprintf(durbuf,
sizeof(durbuf),
"%02d:%02d:%02d", durh, durm, durs);
7002 "Event: CoreShowChannel\r\n"
7005 "Application: %s\r\n"
7006 "ApplicationData: %s\r\n"
7052 char *current_channel_uid;
7057 int add_channel_res;
7061 if (!strcmp(current_channel_uid, channel_snapshot->
base->
uniqueid)) {
7062 ao2_ref(current_channel_uid, -1);
7067 if (!current_channel_snapshot) {
7068 ast_debug(5,
"Unable to get channel snapshot\n");
7069 ao2_ref(current_channel_uid, -1);
7074 if (add_channel_res) {
7076 ao2_ref(current_channel_snapshot, -1);
7077 ao2_ref(current_channel_uid, -1);
7085 int size = strlen(current_channel_snapshot->
base->
name);
7086 char other_local[size + 1];
7091 other_local[size] =
'\0';
7094 if (!other_local_snapshot) {
7095 ast_debug(5,
"Unable to get other local channel snapshot\n");
7096 ao2_ref(current_channel_snapshot, -1);
7097 ao2_ref(current_channel_uid, -1);
7103 ao2_ref(current_channel_snapshot, -1);
7104 ao2_ref(current_channel_uid, -1);
7105 ao2_ref(other_local_snapshot, -1);
7110 if (other_bridge_snapshot) {
7114 ao2_ref(current_channel_snapshot, -1);
7115 ao2_ref(current_channel_uid, -1);
7116 ao2_ref(other_local_snapshot, -1);
7117 ao2_ref(other_bridge_snapshot, -1);
7135 char *current_channel_name;
7144 snprintf(id_text,
sizeof(id_text),
"ActionID: %s\r\n", actionid);
7155 if (!channel_snapshot) {
7161 if (!bridge_snapshot) {
7185 "Event: CoreShowChannelMap\r\n"
7188 "ConnectedChannel: %s\r\n\n",
7191 current_channel_name);
7222 ast_debug(1,
"**** ModuleCheck .so file %s\n", module);
7234#if !defined(LOW_MEMORY)
7252 if (!loadtype || strlen(loadtype) == 0) {
7255 if ((!module || strlen(module) == 0) && strcasecmp(loadtype,
"reload") != 0) {
7259 if (!strcasecmp(loadtype,
"load")) {
7266 }
else if (!strcasecmp(loadtype,
"unload")) {
7273 }
else if (!strcasecmp(loadtype,
"reload")) {
7278 switch (reload_res) {
7323 for (x = 0; x < m->
hdrcount; ++x) {
7324 if (!strncasecmp(m->
headers[x],
"Secret", 6)) {
7353 const char *username;
7368 ast_log(
LOG_ERROR,
"Unable to process manager action '%s'. Asterisk is shutting down.\n", action);
7376 && strcasecmp(action,
"Login")
7377 && strcasecmp(action,
"Logoff")
7378 && strcasecmp(action,
"Challenge")) {
7389 && (!strcasecmp(action,
"Login")
7390 || !strcasecmp(action,
"Challenge"))) {
7396 if (
user && !
user->allowmultiplelogin) {
7423 if (mod_ref || !act_found->
module) {
7425 ret = act_found->
func(s, m);
7444 ao2_t_ref(act_found, -1,
"done with found action object");
7449 snprintf(
buf,
sizeof(
buf),
"Invalid/unknown command: %s. Use Action: ListCommands to show available commands.", action);
7490 if (src[x] ==
'\r' && x+1 < s->
session->
inlen && src[x + 1] ==
'\n') {
7492 }
else if (src[x] ==
'\n') {
7497 memmove(output, src, x);
7516 if(time(&now) == -1) {
7545 ast_debug(1,
"Manager session has been kicked\n");
7616 if (time(&now) == -1) {
7631 }
else if (res > 0) {
7727 if(time(&
session->authstart) == -1) {
7780 time_t now = time(
NULL);
7796 ast_verb(2,
"HTTP Manager '%s' timed out from %s\n",
7827 tmp->category = category;
7831 strcpy(
tmp->eventdata,
str);
7858#define MANAGER_EVENT_BUF_INITSIZE 256
7873 const char *cat_str;
7880 ast_debug(3,
"AMI Event '%s' is globally disabled, skipping\n",
event);
7894 "Privilege: %s\r\n",
7900 "Timestamp: %ld.%06lu\r\n",
7901 (
long)now.tv_sec, (
unsigned long) now.tv_usec);
7907 "SequenceNumber: %d\r\n",
7917 "SystemName: %s\r\n",
7939 pthread_kill(
session->waiting_thread, SIGURG);
7984 file, line, func, fmt, ap);
7991 const char *fmt, ...)
8005 file, line, func, fmt, ap);
8020 if (!strcasecmp(action, cur->
action)) {
8037 ao2_t_ref(cur, -1,
"action object removed from list");
8038 ast_verb(5,
"Manager unregistered action %s\n", action);
8052 switch(
info->reason) {
8059 "StatusText: %s\r\n",
8078 info->presence_subtype,
8079 info->presence_message);
8105 ao2_t_ref(act, +1,
"action object added to list");
8149 ao2_t_ref(cur, -1,
"action object creation failed");
8195 ao2_t_ref(cur, -1,
"action object registration failed");
8199 ao2_t_ref(cur, -1,
"action object registration successful");
8279 if (nonce == 0 || username ==
NULL || stale ==
NULL) {
8291 if (!strcasecmp(
session->username, username) &&
session->managerid == nonce) {
8294 }
else if (!strcasecmp(
session->username, username) &&
session->oldnonce == nonce) {
8314 authed = (
session->authenticated != 0);
8341 if ((
session->managerid == ident) && (
session->readperm & perm)) {
8374 if ((
session->managerid == ident) && (
session->writeperm & perm)) {
8398 const char *save = src;
8399 int space =
sizeof(
buf);
8401 for ( ; *src || dst !=
buf ; src++) {
8402 if (*src ==
'\0' || space < 10) {
8406 space =
sizeof(
buf);
8413 if (save == src && isdigit(*src)) {
8419 }
else if (!isalnum(*src)) {
8428 strcpy(dst,
"<");
8433 strcpy(dst,
">");
8438 strcpy(dst,
""");
8443 strcpy(dst,
"'");
8448 strcpy(dst,
"&");
8454 *dst++ = mode ? tolower(*src) : *src;
8514 const char *dest =
NULL;
8516 const char *objtype =
NULL;
8525 for (v = get_vars; v; v = v->
next) {
8526 if (!strcasecmp(v->
name,
"ajaxdest")) {
8528 }
else if (!strcasecmp(v->
name,
"ajaxobjtype")) {
8536 objtype =
"generic";
8543 if (
in && *
in ==
'\n') {
8547 ast_debug(5,
"inobj %d in_data %d line <%s>\n", inobj, in_data,
val);
8559 "<tr><td colspan=\"2\"><hr></td></tr>\r\n");
8594 var =
"Opaque-data";
8611 if (vc->
count > 1) {
8617 if (!in_data || !*
in) {
8624 "<tr><td colspan=\"2\"><hr></td></tr>\r\n");
8635 ast_log(
LOG_ERROR,
"Attempted to close file/file descriptor on mansession without a valid file or file descriptor.\n");
8653 l = lseek(fd, 0, SEEK_CUR);
8655 if (MAP_FAILED == (
buf = mmap(
NULL, l, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0))) {
8675 const struct ast_sockaddr *remote_address,
const char *uri,
8685 char template[] =
"/tmp/ast-http-XXXXXX";
8690 ast_http_error(ser, 501,
"Not Implemented",
"Attempt to use unimplemented / unsupported method");
8704 ast_http_error(ser, 500,
"Server Error",
"Internal Server Error (out of memory)");
8730 ast_http_error(ser, 500,
"Server Error",
"Internal Server Error (ast_str_create() out of memory)");
8731 goto generic_callback_out;
8735 fd = mkstemp(
template);
8738 ast_http_error(ser, 500,
"Server Error",
"Internal Server Error (mkstemp failed)");
8739 goto generic_callback_out;
8744 ast_http_error(ser, 500,
"Server Error",
"Internal Server Error (fdopen failed)");
8746 goto generic_callback_out;
8754 ast_http_error(ser, 413,
"Request Entity Too Large",
"Body too large");
8756 goto generic_callback_out;
8761 goto generic_callback_out;
8763 ast_http_error(ser, 400,
"Bad Request",
"Error parsing request body");
8765 goto generic_callback_out;
8788 "Content-type: text/%s\r\n"
8789 "Set-Cookie: mansession_id=\"%08x\"; Version=1; Max-Age=%d\r\n"
8790 "Pragma: SuppressEvents\r\n",
8803#define ROW_FMT "<tr><td colspan=\"2\" bgcolor=\"#f1f1ff\">%s</td></tr>\r\n"
8804#define TEST_STRING \
8805 "<form action=\"manager\" method=\"post\">\n\
8806 Action: <select name=\"action\">\n\
8807 <option value=\"\">-----></option>\n\
8808 <option value=\"login\">login</option>\n\
8809 <option value=\"command\">Command</option>\n\
8810 <option value=\"waitevent\">waitevent</option>\n\
8811 <option value=\"listcommands\">listcommands</option>\n\
8813 or <input name=\"action\"><br/>\n\
8814 CLI Command <input name=\"command\"><br>\n\
8815 user <input name=\"username\"> pass <input type=\"password\" name=\"secret\"><br>\n\
8816 <input type=\"submit\">\n</form>\n"
8819 ast_str_append(&
out, 0,
"<body bgcolor=\"#ffffff\"><table align=center bgcolor=\"#f1f1f1\" width=\"500\">\r\n");
8838 ast_debug(1,
"Need destroy, doing it now!\n");
8841 ast_debug(1,
"Need destroy, but can't do it yet!\n");
8844 pthread_kill(
session->waiting_thread, SIGURG);
8858generic_callback_out:
8887 const struct ast_sockaddr *remote_address,
const char *uri,
8894 char template[] =
"/tmp/ast-http-XXXXXX";
8900 time_t time_now = time(
NULL);
8901 unsigned long nonce = 0, nc;
8905 char resp_hash[256]=
"";
8907 char u_username[80];
8911 int u_displayconnects;
8914 ast_http_error(ser, 501,
"Not Implemented",
"Attempt to use unimplemented / unsupported method");
8919 for (v = headers; v; v = v->
next) {
8920 if (!strcasecmp(v->
name,
"Authorization")) {
8932 ast_http_error(ser, 500,
"Server Error",
"Internal Server Error (out of memory)");
8941 if (sscanf(
d.nonce,
"%30lx", &nonce) != 1) {
8961 ast_http_error(ser, 403,
"Permission denied",
"Permission denied");
8978 ast_http_error(ser, 500,
"Server Error",
"Internal Server Error (out of memory)");
8987 snprintf(resp,
sizeof(resp),
"%s:%08lx:%s:%s:auth:%s",
user->a1_hash, nonce,
d.nc,
d.cnonce, a2_hash);
8990 snprintf(resp,
sizeof(resp),
"%s:%08lx:%s",
user->a1_hash, nonce, a2_hash);
8995 if (strncasecmp(
d.response, resp_hash, strlen(resp_hash))) {
9007 u_readperm =
user->readperm;
9008 u_writeperm =
user->writeperm;
9009 u_displayconnects =
user->displayconnects;
9010 u_writetimeout =
user->writetimeout;
9020 ast_http_error(ser, 500,
"Server Error",
"Internal Server Error (out of memory)");
9030 session->readperm = u_readperm;
9031 session->writeperm = u_writeperm;
9032 session->writetimeout = u_writetimeout;
9034 if (u_displayconnects) {
9057 sscanf(
d.nc,
"%30lx", &nc);
9058 if (
session->nc >= nc || ((time_now -
session->noncetime) > 62) ) {
9069 session->noncetime = time_now;
9085 fd = mkstemp(
template);
9088 ast_http_error(ser, 500,
"Server Error",
"Internal Server Error (mkstemp failed)");
9089 goto auth_callback_out;
9094 ast_http_error(ser, 500,
"Server Error",
"Internal Server Error (fdopen failed)");
9096 goto auth_callback_out;
9104 ast_http_error(ser, 413,
"Request Entity Too Large",
"Body too large");
9106 goto auth_callback_out;
9111 goto auth_callback_out;
9113 ast_http_error(ser, 400,
"Bad Request",
"Error parsing request body");
9115 goto auth_callback_out;
9123 if (u_displayconnects) {
9138 ast_http_error(ser, 500,
"Server Error",
"Internal Server Error (ast_str_create() out of memory)");
9140 goto auth_callback_out;
9149 "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\r\n"
9151 "<title>Asterisk™ Manager Interface</title>\r\n"
9152 "</head><body style=\"background-color: #ffffff;\">\r\n"
9153 "<form method=\"POST\">\r\n"
9154 "<table align=\"center\" style=\"background-color: #f1f1f1;\" width=\"500\">\r\n"
9155 "<tr><th colspan=\"2\" style=\"background-color: #f1f1ff;\"><h1>Manager Tester</h1></th></tr>\r\n"
9156 "<tr><th colspan=\"2\" style=\"background-color: #f1f1ff;\">Action: <input name=\"action\" /> Cmd: <input name=\"command\" /><br>"
9157 "<input type=\"submit\" value=\"Send request\" /></th></tr>\r\n");
9191 ast_debug(1,
"Need destroy, doing it now!\n");
9241 .
description =
"Raw HTTP Manager Event Interface",
9300 .
description =
"Raw HTTP Manager Event Interface w/Digest authentication",
9309 .
description =
"HTML Manager Event Interface w/Digest authentication",
9318 .
description =
"XML Manager Event Interface w/Digest authentication",
9330 const char *login = (
char *)arg;
9331 int *no_sessions = data;
9333 if (strcasecmp(
session->username, login) == 0) {
9353 ast_log(
LOG_WARNING,
"AMI_CLIENT() requires two arguments: AMI_CLIENT(<name>[,<arg>])\n");
9368 if (!strcasecmp(
args.param,
"sessions")) {
9369 int no_sessions = 0;
9377 snprintf(
buf,
len,
"%d", no_sessions);
9390 .
name =
"AMI_CLIENT",
9421 .poll_timeout = 5000,
9423 .name =
"AMI server",
9433 .name =
"AMI TLS server",
9443 e->
command =
"manager show settings";
9445 "Usage: manager show settings\n"
9446 " Provides detailed list of the configuration of the Manager.\n";
9451#define FORMAT " %-25.25s %-15.55s\n"
9452#define FORMAT2 " %-25.25s %-15d\n"
9453#define FORMAT3 " %-25.25s %s\n"
9457 ast_cli(
a->fd,
"\nGlobal Settings:\n");
9458 ast_cli(
a->fd,
"----------------\n");
9487 return strcmp((*item_a)->name, (*item_b)->name);
9497 int i = 0, totalitems = 0;
9501 e->
command =
"manager show events";
9503 "Usage: manager show events\n"
9504 " Prints a listing of the available Asterisk manager interface events.\n";
9520 ast_cli(
a->fd,
"No manager event documentation loaded\n");
9544 items[totalitems++] =
item;
9551 ast_cli(
a->fd,
" -------------------- -------------------- -------------------- \n");
9552 for (i = 0; i < totalitems; i++) {
9554 if ((i + 1) % 3 == 0) {
9559 if ((i + 1) % 3 != 0) {
9573 char syntax_title[64], description_title[64], synopsis_title[64], seealso_title[64], arguments_title[64];
9588 ast_cli(
a->fd,
"%s%s\n\n", syntax_title, syntax);
9593 ast_cli(
a->fd,
"%s%s\n\n", description_title, description);
9598 ast_cli(
a->fd,
"%s%s\n\n", arguments_title, arguments);
9603 ast_cli(
a->fd,
"%s%s\n\n", seealso_title, seealso);
9616 e->
command =
"manager show event";
9618 "Usage: manager show event <eventname>\n"
9619 " Provides a detailed description a Manager interface event.\n";
9625 ast_cli(
a->fd,
"No manager event documentation loaded\n");
9634 length = strlen(
a->word);
9637 if (!strncasecmp(
a->word,
item->
name, length)) {
9655 ast_cli(
a->fd,
"Could not find event '%s'\n",
a->argv[3]);
9659 ast_cli(
a->fd,
"Event: %s\n",
a->argv[3]);
9730 if (
user->whitefilters) {
9731 ao2_t_ref(
user->whitefilters, -1,
"decrement ref for white container, should be last one");
9733 if (
user->blackfilters) {
9734 ao2_t_ref(
user->blackfilters, -1,
"decrement ref for black container, should be last one");
9798#ifdef TEST_FRAMEWORK
9800 test_suite_forwarder =
NULL;
9940 int newhttptimeout = 60;
9948 int tls_was_enabled = 0;
9949 int acl_subscription_flag = 0;
10008#ifdef TEST_FRAMEWORK
10023 if (temp_event_docs) {
10025 ao2_t_ref(temp_event_docs, -1,
"Remove creation ref - container holds only ref now");
10045 ast_log(
LOG_NOTICE,
"Unable to open AMI configuration manager.conf, or configuration is invalid.\n");
10050 if (!by_external_config) {
10067 if (strcasecmp(
var->name,
"tlscafile")
10068 && strcasecmp(
var->name,
"tlscapath")
10069 && strcasecmp(
var->name,
"tlscadir")
10070 && strcasecmp(
var->name,
"tlsverifyclient")
10071 && strcasecmp(
var->name,
"tlsdontverifyserver")
10072 && strcasecmp(
var->name,
"tlsclientmethod")
10073 && strcasecmp(
var->name,
"sslclientmethod")
10078 if (!strcasecmp(
var->name,
"enabled")) {
10080 }
else if (!strcasecmp(
var->name,
"webenabled")) {
10082 }
else if (!strcasecmp(
var->name,
"port")) {
10088 }
else if (!strcasecmp(
var->name,
"bindaddr")) {
10103 }
else if (!strcasecmp(
var->name,
"brokeneventsaction")) {
10105 }
else if (!strcasecmp(
var->name,
"allowmultiplelogin")) {
10107 }
else if (!strcasecmp(
var->name,
"displayconnects")) {
10109 }
else if (!strcasecmp(
var->name,
"timestampevents")) {
10111 }
else if (!strcasecmp(
var->name,
"debug")) {
10113 }
else if (!strcasecmp(
var->name,
"httptimeout")) {
10114 newhttptimeout = atoi(
val);
10115 }
else if (!strcasecmp(
var->name,
"authtimeout")) {
10116 int timeout = atoi(
var->value);
10123 }
else if (!strcasecmp(
var->name,
"authlimit")) {
10124 int limit = atoi(
var->value);
10131 }
else if (!strcasecmp(
var->name,
"channelvars")) {
10133 }
else if (!strcasecmp(
var->name,
"disabledevents")) {
10174 const char *hasmanager;
10178 if (!strcasecmp(cat,
"general")) {
10183 if ((!hasmanager && genhasmanager) ||
ast_true(hasmanager)) {
10205 user->readperm = -1;
10206 user->writeperm = -1;
10211 user->writetimeout = 100;
10214 if (!user_secret) {
10223 if (!user_displayconnects) {
10226 if (!user_allowmultiplelogin) {
10229 if (!user_writetimeout) {
10244 if (user_displayconnects) {
10245 user->displayconnects =
ast_true(user_displayconnects);
10247 if (user_allowmultiplelogin) {
10248 user->allowmultiplelogin =
ast_true(user_allowmultiplelogin);
10250 if (user_writetimeout) {
10251 int value = atoi(user_writetimeout);
10268 if (!strcasecmp(cat,
"general")) {
10281 user->readperm = 0;
10282 user->writeperm = 0;
10287 user->writetimeout = 100;
10290 if (!
user->whitefilters || !
user->blackfilters) {
10304 oldacl =
user->acl;
10310 if (!strcasecmp(
var->name,
"secret")) {
10313 }
else if (!strcasecmp(
var->name,
"deny") ||
10314 !strcasecmp(
var->name,
"permit") ||
10315 !strcasecmp(
var->name,
"acl")) {
10320 ast_log(
LOG_ERROR,
"Invalid ACL '%s' for manager user '%s' on line %d. Deleting user\n",
10324 }
else if (!strcasecmp(
var->name,
"read") ) {
10326 }
else if (!strcasecmp(
var->name,
"write") ) {
10328 }
else if (!strcasecmp(
var->name,
"displayconnects") ) {
10330 }
else if (!strcasecmp(
var->name,
"allowmultiplelogin") ) {
10332 }
else if (!strcasecmp(
var->name,
"writetimeout")) {
10339 }
else if (!strcasecmp(
var->name,
"setvar")) {
10348 if ((varval = strchr(varname,
'='))) {
10352 user->chanvars = tmpvar;
10355 }
else if (!strcasecmp(
var->name,
"eventfilter")) {
10359 ast_debug(1,
"%s is an unknown option.\n",
var->name);
10368 if (acl_subscription_flag && !by_external_config) {
10417 if (newhttptimeout > 0) {
10489 if ((datastore->
uid !=
NULL) && !strcasecmp(
uid, datastore->
uid)) {
10502 if (!*fields_string) {
10504 if (!*fields_string) {
10520__attribute__((format(printf, 3, 4)))
10524 const
char *extra_fields_fmt,
10546 va_start(argp, extra_fields_fmt);
10559 .
requires =
"extconfig,acl,http",
Access Control of various sorts.
enum ast_acl_sense ast_apply_acl(struct ast_acl_list *acl_list, const struct ast_sockaddr *addr, const char *purpose)
Apply a set of rules to a given IP address.
struct stasis_message_type * ast_named_acl_change_type(void)
a stasis_message_type for changes against a named ACL or the set of all named ACLs
void ast_acl_output(int fd, struct ast_acl_list *acl, const char *prefix)
output an ACL to the provided fd
void ast_append_acl(const char *sense, const char *stuff, struct ast_acl_list **path, int *error, int *named_acl_flag)
Add a rule to an ACL struct.
int ast_acl_list_is_empty(struct ast_acl_list *acl_list)
Determines if an ACL is empty or if it contains entries.
struct ast_acl_list * ast_free_acl_list(struct ast_acl_list *acl)
Free a list of ACLs.
Generic Advice of Charge encode and decode routines.
void * ast_aoc_destroy_encoded(struct ast_aoc_encoded *encoded)
free an ast_aoc_encoded object
int ast_aoc_s_add_rate_duration(struct ast_aoc_decoded *decoded, enum ast_aoc_s_charged_item charged_item, unsigned int amount, enum ast_aoc_currency_multiplier multiplier, const char *currency_name, unsigned long time, enum ast_aoc_time_scale time_scale, unsigned long granularity_time, enum ast_aoc_time_scale granularity_time_scale, int step_function)
Add AOC-S duration rate entry.
@ AST_AOC_CHARGED_ITEM_BASIC_COMMUNICATION
@ AST_AOC_CHARGED_ITEM_SPECIAL_ARRANGEMENT
@ AST_AOC_CHARGED_ITEM_NA
@ AST_AOC_CHARGED_ITEM_USER_USER_INFO
@ AST_AOC_CHARGED_ITEM_CALL_SETUP
@ AST_AOC_CHARGED_ITEM_SUPPLEMENTARY_SERVICE
@ AST_AOC_CHARGED_ITEM_CALL_ATTEMPT
@ AST_AOC_CHARGE_CURRENCY
@ AST_AOC_TIME_SCALE_TEN_SECOND
@ AST_AOC_TIME_SCALE_TENTH_SECOND
@ AST_AOC_TIME_SCALE_MINUTE
@ AST_AOC_TIME_SCALE_SECOND
@ AST_AOC_TIME_SCALE_HOUR
@ AST_AOC_TIME_SCALE_HUNDREDTH_SECOND
@ AST_AOC_VOLUME_UNIT_OCTET
@ AST_AOC_VOLUME_UNIT_SEGMENT
@ AST_AOC_VOLUME_UNIT_MESSAGE
int ast_aoc_s_add_rate_special_charge_code(struct ast_aoc_decoded *decoded, enum ast_aoc_s_charged_item charged_item, unsigned int code)
Add AOC-S special rate entry.
ast_aoc_currency_multiplier
Defines the currency multiplier for an aoc message.
@ AST_AOC_MULT_ONEHUNDREDTH
@ AST_AOC_MULT_ONETHOUSANDTH
struct ast_aoc_decoded * ast_aoc_create(const enum ast_aoc_type msg_type, const enum ast_aoc_charge_type charge_type, const enum ast_aoc_request requests)
creates a ast_aoc_decode object of a specific message type
void * ast_aoc_destroy_decoded(struct ast_aoc_decoded *decoded)
free an ast_aoc_decoded object
int ast_aoc_set_association_number(struct ast_aoc_decoded *decoded, const char *num, uint8_t plan)
set the charging association number for an AOC-E message
int ast_aoc_add_unit_entry(struct ast_aoc_decoded *decoded, const unsigned int amount_is_present, const unsigned int amount, const unsigned int type_is_present, const unsigned int type)
Adds a unit entry into the list of units.
ast_aoc_billing_id
Defines the billing id options for an aoc message.
@ AST_AOC_BILLING_CALL_FWD_BUSY
@ AST_AOC_BILLING_CALL_FWD_NO_REPLY
@ AST_AOC_BILLING_CALL_DEFLECTION
@ AST_AOC_BILLING_CREDIT_CARD
@ AST_AOC_BILLING_CALL_TRANSFER
@ AST_AOC_BILLING_CALL_FWD_UNCONDITIONAL
@ AST_AOC_BILLING_REVERSE_CHARGE
int ast_aoc_s_add_rate_free(struct ast_aoc_decoded *decoded, enum ast_aoc_s_charged_item charged_item, int from_beginning)
Add AOC-S indicating charge item is free.
int ast_aoc_set_billing_id(struct ast_aoc_decoded *decoded, const enum ast_aoc_billing_id id)
set the billing id for a AOC-D or AST_AOC_E message
int ast_aoc_s_add_special_arrangement(struct ast_aoc_decoded *decoded, unsigned int code)
Add AOC-S special arrangement entry.
int ast_aoc_set_currency_info(struct ast_aoc_decoded *decoded, const unsigned int amount, const enum ast_aoc_currency_multiplier multiplier, const char *name)
Sets the currency values for a AOC-D or AOC-E message.
int ast_aoc_set_association_id(struct ast_aoc_decoded *decoded, const int id)
set the charging association id for an AST_AOC_E message
int ast_aoc_s_add_rate_flat(struct ast_aoc_decoded *decoded, enum ast_aoc_s_charged_item charged_item, unsigned int amount, enum ast_aoc_currency_multiplier multiplier, const char *currency_name)
Add AOC-S flat rate entry.
struct ast_aoc_encoded * ast_aoc_encode(struct ast_aoc_decoded *decoded, size_t *out_size, struct ast_channel *chan)
encodes a decoded aoc structure so it can be passed on the wire
int ast_aoc_set_total_type(struct ast_aoc_decoded *decoded, const enum ast_aoc_total_type type)
Sets the type of total for a AOC-D message.
int ast_aoc_s_add_rate_volume(struct ast_aoc_decoded *decoded, enum ast_aoc_s_charged_item charged_item, enum ast_aoc_volume_unit volume_unit, unsigned int amount, enum ast_aoc_currency_multiplier multiplier, const char *currency_name)
Add AOC-S volume rate entry.
unsigned int ast_aoc_s_get_count(struct ast_aoc_decoded *decoded)
get the number rates associated with an AOC-S message
int ast_aoc_s_add_rate_na(struct ast_aoc_decoded *decoded, enum ast_aoc_s_charged_item charged_item)
Add AOC-S entry indicating charge item is not available.
@ AST_AOC_RATE_TYPE_VOLUME
@ AST_AOC_RATE_TYPE_FREE_FROM_BEGINNING
@ AST_AOC_RATE_TYPE_SPECIAL_CODE
@ AST_AOC_RATE_TYPE_DURATION
static const struct adsi_event events[]
static volatile unsigned int seq
static int copy(char *infile, char *outfile)
Utility function to copy a file.
Asterisk version information.
const char * ast_get_version(void)
Retrieve the Asterisk version string.
Asterisk main include file. File version handling, generic pbx functions.
int ast_register_cleanup(void(*func)(void))
Register a function to be executed before Asterisk gracefully exits.
int ast_shutting_down(void)
static struct ast_mansession session
void ast_std_free(void *ptr)
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
#define ast_strdup(str)
A wrapper for strdup()
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define ast_asprintf(ret, fmt,...)
A wrapper for asprintf()
#define ast_calloc(num, len)
A wrapper for calloc()
#define ast_malloc(len)
A wrapper for malloc()
#define ao2_t_ref(o, delta, tag)
#define ao2_iterator_next(iter)
#define ao2_link(container, obj)
Add an object to a container.
@ AO2_ALLOC_OPT_LOCK_NOLOCK
@ AO2_ALLOC_OPT_LOCK_MUTEX
#define ao2_global_obj_replace_unref(holder, obj)
Replace an ao2 object in the global holder, throwing away any old object.
#define ao2_t_global_obj_replace_unref(holder, obj, tag)
#define ao2_callback(c, flags, cb_fn, arg)
ao2_callback() is a generic function that applies cb_fn() to all objects in a container,...
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
#define ao2_callback_data(container, flags, cb_fn, arg, data)
#define ao2_unlink(container, obj)
Remove an object from a container.
#define ao2_t_link(container, obj, tag)
#define ao2_global_obj_ref(holder)
Get a reference to the object stored in the global holder.
#define ao2_find(container, arg, flags)
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
#define ao2_alloc_options(data_size, destructor_fn, options)
#define ao2_t_callback_data(container, flags, cb_fn, arg, data, tag)
ao2_callback_data() is a generic function that applies cb_fn() to all objects in a container....
#define ao2_global_obj_release(holder)
Release the ao2 object held in the global holder.
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
#define ao2_t_alloc(data_size, destructor_fn, debug_msg)
@ OBJ_NOLOCK
Assume that the ao2_container is already locked.
#define ao2_container_alloc_list(ao2_options, container_options, sort_fn, cmp_fn)
Allocate and initialize a list container.
#define ao2_alloc(data_size, destructor_fn)
#define ao2_t_global_obj_release(holder, tag)
#define ao2_t_callback(c, flags, cb_fn, arg, tag)
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
Allocate and initialize a hash container with the desired number of buckets.
@ AO2_CONTAINER_ALLOC_OPT_DUPS_OBJ_REJECT
Reject duplicate objects in container.
enum ast_transfer_result ast_bridge_transfer_blind(int is_external, struct ast_channel *transferer, const char *exten, const char *context, transfer_channel_cb new_channel_cb, void *user_data)
Blind transfer target to the extension and context provided.
@ AST_BRIDGE_TRANSFER_NOT_PERMITTED
@ AST_BRIDGE_TRANSFER_SUCCESS
@ AST_BRIDGE_TRANSFER_INVALID
@ AST_BRIDGE_TRANSFER_FAIL
static struct prometheus_metrics_provider provider
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
int ast_callerid_parse(char *instr, char **name, char **location)
Destructively parse inbuf into name and location (or number)
void ast_shrink_phone_number(char *n)
Shrink a phone number in place to just digits (more accurately it just removes ()'s,...
int ast_cdr_is_enabled(void)
Return TRUE if CDR subsystem is enabled.
static int match(struct ast_sockaddr *addr, unsigned short callno, unsigned short dcallno, const struct chan_iax2_pvt *cur, int check_dcallno)
static struct unistimsession * sessions
General Asterisk PBX channel definitions.
struct varshead * ast_channel_get_manager_vars(struct ast_channel *chan)
Gets the variables for a given channel, as specified by ast_channel_set_manager_vars().
const char * ast_channel_name(const struct ast_channel *chan)
#define AST_MAX_PUBLIC_UNIQUEID
const char * ast_channel_data(const struct ast_channel *chan)
void ast_channel_clear_flag(struct ast_channel *chan, unsigned int flag)
Clear a flag on a channel.
struct varshead * ast_channel_varshead(struct ast_channel *chan)
struct ast_channel_iterator * ast_channel_iterator_destroy(struct ast_channel_iterator *i)
Destroy a channel iterator.
void ast_channel_set_manager_vars(size_t varc, char **vars)
Sets the variables to be stored in the manager_vars field of all snapshots.
#define ast_channel_lock(chan)
struct ast_trans_pvt * ast_channel_readtrans(const struct ast_channel *chan)
struct ast_format_cap * ast_channel_nativeformats(const struct ast_channel *chan)
struct ast_trans_pvt * ast_channel_writetrans(const struct ast_channel *chan)
ast_group_t ast_channel_pickupgroup(const struct ast_channel *chan)
struct ast_channel * ast_channel_iterator_next(struct ast_channel_iterator *i)
Get the next channel for a channel iterator.
struct ast_flags * ast_channel_flags(struct ast_channel *chan)
int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f)
Queue one or more frames to a channel's frame queue.
const char * ast_channel_uniqueid(const struct ast_channel *chan)
const char * ast_channel_context(const struct ast_channel *chan)
int ast_check_hangup_locked(struct ast_channel *chan)
struct ast_channel * ast_channel_get_by_name_prefix(const char *name, size_t name_len)
Find a channel by a name prefix.
void ast_channel_softhangup_withcause_locked(struct ast_channel *chan, int causecode)
Lock the given channel, then request softhangup on the channel with the given causecode.
int ast_queue_control_data(struct ast_channel *chan, enum ast_control_frame_type control, const void *data, size_t datalen)
Queue a control frame with payload.
const char * ast_channel_appl(const struct ast_channel *chan)
struct timeval ast_channel_creationtime(struct ast_channel *chan)
int ast_active_channels(void)
returns number of active/allocated channels
int ast_channel_is_bridged(const struct ast_channel *chan)
Determine if a channel is in a bridge.
struct ast_bridge * ast_channel_get_bridge(const struct ast_channel *chan)
Get the bridge associated with a channel.
struct ast_party_dialed * ast_channel_dialed(struct ast_channel *chan)
int ast_indicate_data(struct ast_channel *chan, int condition, const void *data, size_t datalen)
Indicates condition of channel, with payload.
struct timeval * ast_channel_whentohangup(struct ast_channel *chan)
#define ast_channel_unref(c)
Decrease channel reference count.
struct ast_format * ast_channel_writeformat(struct ast_channel *chan)
ast_group_t ast_channel_callgroup(const struct ast_channel *chan)
struct ast_party_id ast_channel_connected_effective_id(struct ast_channel *chan)
void ast_channel_setwhentohangup_tv(struct ast_channel *chan, struct timeval offset)
Set when to hang a channel up.
#define ast_dummy_channel_alloc()
Create a fake channel structure.
@ AST_FLAG_BRIDGE_DUAL_REDIRECT_WAIT
const struct ast_channel_tech * ast_channel_tech(const struct ast_channel *chan)
struct ast_channel * ast_channel_get_by_name(const char *name)
Find a channel by name.
struct ast_channel_iterator * ast_channel_iterator_all_new(void)
Create a new channel iterator.
#define ast_channel_unlock(chan)
struct ast_format * ast_channel_readformat(struct ast_channel *chan)
const char * ast_var_name(const struct ast_var_t *var)
const char * ast_var_value(const struct ast_var_t *var)
Standard Command Line Interface.
#define AST_CLI_YESNO(x)
Return Yes or No depending on the argument.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define AST_CLI_DEFINE(fn, txt,...)
int ast_cli_completion_add(char *value)
Add a result to a request for completion options.
void ast_cli(int fd, const char *fmt,...)
ast_cli_command
calling arguments for new-style handlers.
#define ast_cli_register_multiple(e, len)
Register multiple commands.
static struct ao2_container * codecs
Registered codecs.
static struct channel_usage channels
Local proxy channel special access.
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
void ast_verbose(const char *fmt,...)
Call Parking and Pickup API Includes code and algorithms from the Zapata library.
Generic File Format Support. Should be included by clients of the file handling routines....
static int md5(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
static int filter(struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len)
static int action_setvar(struct mansession *s, const struct message *m)
static int blackfilter_cmp_fn(void *obj, void *arg, void *data, int flags)
static int action_createconfig(struct mansession *s, const struct message *m)
static void purge_events(void)
static char * handle_showmancmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int manager_state_cb(const char *context, const char *exten, struct ast_state_cb_info *info, void *data)
static void mansession_unlock(struct mansession *s)
Unlock the 'mansession' structure.
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...
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,...)
#define GET_HEADER_LAST_MATCH
void astman_send_listack(struct mansession *s, const struct message *m, char *msg, char *listflag)
Send ack in manager transaction to begin a list.
static int purge_sessions(int n_max)
remove at most n_max stale session from the list.
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 ...
static int strings_to_mask(const char *string)
static void print_event_instance(struct ast_cli_args *a, struct ast_xml_doc_item *instance)
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 struct ast_manager_user * get_manager_by_name_locked(const char *name)
static void acl_change_stasis_subscribe(void)
static char * handle_showmaneventq(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
CLI command manager list eventq.
static void log_action(const struct message *m, const char *action)
static struct mansession_session * build_mansession(const struct ast_sockaddr *addr)
Allocate manager session structure and add it to the list of sessions.
static void report_invalid_user(const struct mansession *s, const char *username)
static int manager_enabled
int ast_manager_check_enabled(void)
Check if AMI is enabled.
static void astman_free_headers(struct message *m)
Free headers inside message structure, but not the message structure itself.
static int action_sendtext(struct mansession *s, const struct message *m)
static int action_mailboxcount(struct mansession *s, const struct message *m)
static void manager_json_to_ast_str(struct ast_json *obj, const char *key, struct ast_str **res, key_exclusion_cb exclusion_cb)
static int ast_manager_register_struct(struct manager_action *act)
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.
static AO2_GLOBAL_OBJ_STATIC(mgr_sessions)
static int whitefilter_cmp_fn(void *obj, void *arg, void *data, int flags)
static struct manager_action * action_find(const char *name)
static int action_getconfigjson(struct mansession *s, const struct message *m)
int ast_webmanager_check_enabled(void)
Check if AMI/HTTP is enabled.
static const struct @371 command_blacklist[]
void astman_send_response(struct mansession *s, const struct message *m, char *resp, char *msg)
Send response in manager transaction.
static void report_failed_acl(const struct mansession *s, const char *username)
static int action_listcategories(struct mansession *s, const struct message *m)
static int action_hangup(struct mansession *s, const struct message *m)
static void mansession_lock(struct mansession *s)
Lock the 'mansession' structure.
static int action_listcommands(struct mansession *s, const struct message *m)
static void destroy_fast_originate_helper(struct fast_originate_helper *doomed)
static int action_atxfer(struct mansession *s, const struct message *m)
static struct ast_threadstorage manager_event_buf
static int action_timeout(struct mansession *s, const struct message *m)
static enum add_filter_result manager_add_filter(const char *filter_pattern, struct ao2_container *whitefilters, struct ao2_container *blackfilters)
Add an event filter to a manager session.
void astman_send_error(struct mansession *s, const struct message *m, char *error)
Send error in manager transaction.
static struct stasis_subscription * acl_change_sub
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 do_message(struct mansession *s)
void astman_send_error_va(struct mansession *s, const struct message *m, const char *fmt,...)
Send error in manager transaction (with va_args support)
static void manager_default_msg_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
static int action_coresettings(struct mansession *s, const struct message *m)
Show PBX core settings information.
static int mansession_cmp_fn(void *obj, void *arg, int flags)
static int displayconnects
static int action_filter(struct mansession *s, const struct message *m)
Manager command to add an event filter to a manager session.
static int action_mailboxstatus(struct mansession *s, const struct message *m)
static void append_channel_vars(struct ast_str **pbuf, struct ast_channel *chan)
static int action_login(struct mansession *s, const struct message *m)
static int action_getvar(struct mansession *s, const struct message *m)
static int get_input(struct mansession *s, char *output)
static int action_blind_transfer(struct mansession *s, const struct message *m)
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 ...
static struct mansession_session * unref_mansession(struct mansession_session *s)
Unreference manager session object. If no more references, then go ahead and delete it.
#define ASTMAN_APPEND_BUF_INITSIZE
initial allocated size for the astman_append_buf and astman_send_*_va
void ast_manager_publish_event(const char *type, int class_type, struct ast_json *obj)
Publish an event to AMI.
static void session_destroy(struct mansession_session *s)
void astman_send_list_complete_start(struct mansession *s, const struct message *m, const char *event_name, int count)
Start the list complete event.
struct stasis_message_router * ast_manager_get_message_router(void)
Get the stasis_message_router for AMI.
struct stasis_topic * ast_manager_get_topic(void)
Get the Stasis Message Bus API topic for AMI.
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...
static void astman_append_json(struct mansession *s, const char *str)
#define MGR_SHOW_TERMINAL_WIDTH
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
static int action_extensionstate(struct mansession *s, const struct message *m)
static char * handle_showmanconn(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
CLI command manager list connected.
static int action_getconfig(struct mansession *s, const struct message *m)
static void event_filter_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 ...
static struct eventqent * advance_event(struct eventqent *e)
static struct ast_threadstorage astman_append_buf
static int restrictedFile(const char *filename)
Check if a file is restricted or not.
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.
static void session_destructor(void *obj)
static struct stasis_message_router * stasis_router
The stasis_message_router for all Stasis Message Bus API messages.
static void json_escape(char *out, const char *in)
static int manager_displayconnects(struct mansession_session *session)
Get displayconnects config option.
static int action_logoff(struct mansession *s, const struct message *m)
static char * handle_kickmanconn(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
CLI command manager kick session.
static int action_updateconfig(struct mansession *s, const struct message *m)
static void astman_start_ack(struct mansession *s, const struct message *m)
static const char * __astman_get_header(const struct message *m, char *var, int mode)
Return a matching header value.
void astman_send_ack(struct mansession *s, const struct message *m, char *msg)
Send ack in manager transaction.
STASIS_MESSAGE_TYPE_DEFN(ast_manager_get_generic_type)
Define AMI message types.
static void handle_parse_error(struct mansession *s, struct message *m, char *error)
static int manager_moduleload(struct mansession *s, const struct message *m)
static void acl_change_stasis_unsubscribe(void)
static int reload_module(void)
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 astman_append_headers(struct message *m, const struct ast_variable *params)
Append additional headers into the message structure from params.
static void report_failed_challenge_response(const struct mansession *s, const char *response, const char *expected_response)
#define any_manager_listeners(sessions)
static int action_reload(struct mansession *s, const struct message *m)
Send a reload event.
struct ast_variable * astman_get_variables(const struct message *m)
Get a linked list of the Variable: headers.
static int live_dangerously
Set to true (non-zero) to globally allow all dangerous AMI actions to run.
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.
static struct eventqent * grab_last(void)
static struct stasis_forward * rtp_topic_forwarder
The stasis_subscription for forwarding the RTP topic to the AMI topic.
static int action_aocmessage(struct mansession *s, const struct message *m)
static char * handle_showmanagers(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int check_manager_session_inuse(const char *name)
static int check_blacklist(const char *cmd)
static int action_events(struct mansession *s, const struct message *m)
void ast_manager_unregister_hook(struct manager_custom_hook *hook)
Delete a custom hook to be called when an event is fired.
static void astman_flush(struct mansession *s, struct ast_str *buf)
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 re...
static int action_redirect(struct mansession *s, const struct message *m)
action_redirect: The redirect manager command
static struct stasis_forward * security_topic_forwarder
The stasis_subscription for forwarding the Security topic to the AMI topic.
static int action_presencestate(struct mansession *s, const struct message *m)
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.
static char * manager_channelvars
void ast_manager_register_hook(struct manager_custom_hook *hook)
Add a custom hook to be called when an event is fired.
static int allowmultiplelogin
static void manager_json_value_str_append(struct ast_json *value, const char *key, struct ast_str **res)
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.
const char * astman_get_header(const struct message *m, char *var)
Return the first matching variable from an array.
#define GET_HEADER_SKIP_EMPTY
static struct ast_threadstorage userevent_buf
static enum ast_transport mansession_get_transport(const struct mansession *s)
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.
static char * handle_showmanager(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int action_cancel_atxfer(struct mansession *s, const struct message *m)
static void report_req_not_allowed(const struct mansession *s, const char *action)
static char global_realm[MAXHOSTNAMELEN]
static int action_originate(struct mansession *s, const struct message *m)
static int send_string(struct mansession *s, char *string)
#define MAX_AUTH_PERM_STRING
static int action_userevent(struct mansession *s, const struct message *m)
static int action_command(struct mansession *s, const struct message *m)
Manager command "command" - execute CLI command.
static void report_inval_password(const struct mansession *s, const char *username)
static int ast_instring(const char *bigstr, const char *smallstr, const char delim)
#define MAX_BLACKLIST_CMD_LEN
Descriptor for a manager session, either on the AMI socket or over HTTP.
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 m...
static int process_events(struct mansession *s)
static int broken_events_action
static void report_session_limit(const struct mansession *s)
static int unauth_sessions
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 ',...
static int timestampevents
static void manager_generic_msg_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
static struct ast_aoc_decoded * action_aoc_s_message(struct mansession *s, const struct message *m)
void astman_send_list_complete_end(struct mansession *s)
End the list complete event.
static char * handle_manager_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
CLI command manager reload.
static struct ast_aoc_decoded * action_aoc_de_message(struct mansession *s, const struct message *m)
static int authenticate(struct mansession *s, const struct message *m)
void astman_append(struct mansession *s, const char *fmt,...)
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 char * handle_showmancmds(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
CLI command manager list commands.
#define EVENT_FLAG_SHUTDOWN
Fake event class used to end sessions at shutdown.
static int manager_modulecheck(struct mansession *s, const struct message *m)
Manager function to check if module is loaded.
static void astman_send_list_complete(struct mansession *s, const struct message *m, const char *event_name, int count)
void astman_live_dangerously(int new_live_dangerously)
Enable/disable the inclusion of 'dangerous' configurations outside of the ast_config_AST_CONFIG_DIR.
int ast_hook_send_action(struct manager_custom_hook *hook, const char *msg)
access for hooks to send action messages to ami
static int action_aoc_s_submessage(struct mansession *s, const struct message *m, struct ast_aoc_decoded *decoded)
static int webmanager_enabled
static struct ast_str * astman_send_list_complete_start_common(struct mansession *s, const struct message *m, const char *event_name, int count)
static int action_status(struct mansession *s, const struct message *m)
Manager "status" command to show channels.
static int match_filter(struct mansession *s, char *eventdata)
static int get_perm(const char *instr)
static int action_coreshowchannels(struct mansession *s, const struct message *m)
Manager command "CoreShowChannels" - List currently defined channels and some information about them.
static struct ast_variable * man_do_variable_value(struct ast_variable *head, const char *hdr_val)
static int action_corestatus(struct mansession *s, const struct message *m)
Show PBX core status information.
static int queue_sendtext(struct ast_channel *chan, const char *body)
Queue a read action to send a text message.
static void action_destroy(void *obj)
static int action_challenge(struct mansession *s, const struct message *m)
static struct stasis_topic * manager_topic
A stasis_topic that all topics AMI cares about will be forwarded to.
static int action_waitevent(struct mansession *s, const struct message *m)
static void report_req_bad_format(const struct mansession *s, const char *action)
static int append_event(const char *str, int category)
events are appended to a queue from where they can be dispatched to clients.
static int action_coreshowchannelmap(struct mansession *s, const struct message *m)
Manager command "CoreShowChannelMap" - Lists all channels connected to the specified channel.
mansession_message_parsing
static char * handle_mandebug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int action_ping(struct mansession *s, const struct message *m)
#define GET_HEADER_FIRST_MATCH
static int aocmessage_get_unit_entry(const struct message *m, struct ast_aoc_unit_entry *entry, unsigned int entry_num)
static int coreshowchannelmap_add_to_map(struct ao2_container *c, const char *s)
Helper function to add a channel name to the vector.
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 funct...
static void report_auth_success(const struct mansession *s)
static void * fast_originate(void *data)
static void acl_change_stasis_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
#define MANAGER_EVENT_BUF_INITSIZE
static const struct permalias perms[]
#define manager_event_sessions(sessions, category, event, contents,...)
static char * manager_disabledevents
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)
int ast_manager_unregister(const char *action)
support functions to register/unregister AMI action handlers,
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,...
struct ast_channel_snapshot * ast_channel_snapshot_get_latest_by_name(const char *name)
Obtain the latest ast_channel_snapshot from the Stasis Message Bus API cache. This is an ao2 object,...
struct ao2_container * ast_channel_cache_by_name(void)
Secondary channel cache, indexed by name.
struct ast_msg_data * ast_msg_data_alloc2(enum ast_msg_data_source_type source_type, const char *to, const char *from, const char *content_type, const char *body)
Allocates an ast_msg_data structure.
size_t ast_msg_data_get_length(struct ast_msg_data *msg)
Get length of the structure.
@ AST_MSG_DATA_SOURCE_TYPE_UNKNOWN
double ast_option_maxload
struct ast_flags ast_options
@ AST_OPT_FLAG_FULLY_BOOTED
Support for Private Asterisk HTTP Servers.
void ast_http_send(struct ast_tcptls_session_instance *ser, enum ast_http_method method, int status_code, const char *status_title, struct ast_str *http_header, struct ast_str *out, int fd, unsigned int static_content)
Generic function for sending HTTP/1.1 response.
struct ast_variable * ast_http_get_post_vars(struct ast_tcptls_session_instance *ser, struct ast_variable *headers)
Get post variables from client Request Entity-Body, if content type is application/x-www-form-urlenco...
ast_http_method
HTTP Request methods known by Asterisk.
void ast_http_uri_unlink(struct ast_http_uri *urihandler)
Unregister a URI handler.
uint32_t ast_http_manid_from_vars(struct ast_variable *headers) attribute_pure
Return manager id, if exist, from request headers.
const char * ast_get_http_method(enum ast_http_method method) attribute_pure
Return http method name string.
void ast_http_auth(struct ast_tcptls_session_instance *ser, const char *realm, const unsigned long nonce, const unsigned long opaque, int stale, const char *text)
Send http "401 Unauthorized" response and close socket.
void ast_http_request_close_on_completion(struct ast_tcptls_session_instance *ser)
Request the HTTP connection be closed after this HTTP request.
void ast_http_error(struct ast_tcptls_session_instance *ser, int status, const char *title, const char *text)
Send HTTP error message and close socket.
int ast_http_uri_link(struct ast_http_uri *urihandler)
Register a URI handler.
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define AST_APP_ARG(name)
Define an application argument.
int ast_app_has_voicemail(const char *mailboxes, const char *folder)
Determine if a given mailbox has any voicemail If folder is NULL, defaults to "INBOX"....
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
int ast_app_inboxcount2(const char *mailboxes, int *urgentmsgs, int *newmsgs, int *oldmsgs)
Determine number of urgent/new/old messages in a mailbox.
char * strsep(char **str, const char *delims)
char * strcasestr(const char *, const char *)
Configuration File Parser.
void ast_include_rename(struct ast_config *conf, const char *from_file, const char *to_file)
int ast_category_inherit(struct ast_category *existing, const struct ast_category *base)
Applies base (template) to category.
const char * ast_category_get_name(const struct ast_category *category)
Return the name of the category.
struct ast_category * ast_category_new_template(const char *name, const char *in_file, int lineno)
Create a category making it a template.
struct ast_config * ast_config_load2(const char *filename, const char *who_asked, struct ast_flags flags)
Load a config file.
char * ast_category_browse(struct ast_config *config, const char *prev_name)
Browse categories.
struct ast_category * ast_category_delete(struct ast_config *cfg, struct ast_category *cat)
Delete a category.
int ast_config_text_file_save2(const char *filename, const struct ast_config *cfg, const char *generator, uint32_t flags)
Save a config text file.
void ast_category_rename(struct ast_category *cat, const char *name)
int ast_variable_delete(struct ast_category *category, const char *variable, const char *match, const char *line)
#define CONFIG_STATUS_FILEMISSING
int ast_category_insert(struct ast_config *config, struct ast_category *cat, const char *match)
Inserts new category.
void ast_category_append(struct ast_config *config, struct ast_category *category)
Appends a category to a config.
void ast_variable_append(struct ast_category *category, struct ast_variable *variable)
int ast_variable_update(struct ast_category *category, const char *variable, const char *value, const char *match, unsigned int object)
Update variable value within a config.
struct ast_variable * ast_variables_reverse(struct ast_variable *var)
Reverse a variable list.
int ast_realtime_enabled(void)
Check if there's any realtime engines loaded.
struct ast_category * ast_category_new(const char *name, const char *in_file, int lineno)
Create a category.
#define ast_variable_new(name, value, filename)
struct ast_str * ast_category_get_templates(const struct ast_category *category)
Return the template names this category inherits from.
#define CONFIG_STATUS_FILEUNCHANGED
@ CONFIG_SAVE_FLAG_PRESERVE_EFFECTIVE_CONTEXT
#define CONFIG_STATUS_FILEINVALID
int ast_parse_arg(const char *arg, enum ast_parse_flags flags, void *p_result,...)
The argument parsing routine.
struct ast_variable * ast_variables_dup(struct ast_variable *var)
Duplicate variable list.
void ast_category_destroy(struct ast_category *cat)
void ast_config_destroy(struct ast_config *cfg)
Destroys a config.
int ast_category_empty(struct ast_category *category)
Removes and destroys all variables in a category.
int ast_category_is_template(const struct ast_category *category)
Check if category is a template.
const char * ast_variable_retrieve(struct ast_config *config, const char *category, const char *variable)
struct ast_variable * ast_category_first(struct ast_category *cat)
given a pointer to a category, return the root variable.
void ast_variable_insert(struct ast_category *category, struct ast_variable *variable, const char *line)
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
struct ast_category * ast_category_get(const struct ast_config *config, const char *category_name, const char *filter)
Retrieve a category if it exists.
@ CONFIG_FLAG_WITHCOMMENTS
@ CONFIG_FLAG_FILEUNCHANGED
struct ast_category * ast_category_browse_filtered(struct ast_config *config, const char *category_name, struct ast_category *prev, const char *filter)
Browse categories with filters.
#define AST_FEATURE_MAX_LEN
int ast_get_builtin_feature(struct ast_channel *chan, const char *feature, char *buf, size_t len)
Get the DTMF code for a builtin feature.
char * ast_get_chan_features_atxferabort(struct ast_channel *chan)
Get the transfer configuration option atxferabort.
ast_frame_read_action
Actions to indicate to, and be handled on channel read.
@ AST_FRAME_READ_ACTION_SEND_TEXT
@ AST_FRAME_READ_ACTION_SEND_TEXT_DATA
@ AST_CONTROL_READ_ACTION
int ast_logger_rotate(void)
Reload logger while rotating log files.
#define ast_debug(level,...)
Log a DEBUG message.
#define VERBOSITY_ATLEAST(level)
#define ast_verb(level,...)
void ast_iostream_set_timeout_inactivity(struct ast_iostream *stream, int timeout)
Set the iostream inactivity timeout timer.
struct ast_iostream * ast_iostream_from_fd(int *fd)
Create an iostream from a file descriptor.
ssize_t ast_iostream_write(struct ast_iostream *stream, const void *buffer, size_t count)
Write data to an iostream.
int ast_iostream_get_fd(struct ast_iostream *stream)
Get an iostream's file descriptor.
void ast_iostream_set_exclusive_input(struct ast_iostream *stream, int exclusive_input)
Set the iostream if it can exclusively depend upon the set timeouts.
ssize_t ast_iostream_read(struct ast_iostream *stream, void *buffer, size_t count)
Read data from an iostream.
void ast_iostream_set_timeout_sequence(struct ast_iostream *stream, struct timeval start, int timeout)
Set the iostream I/O sequence timeout timer.
void ast_iostream_nonblock(struct ast_iostream *stream)
Make an iostream non-blocking.
int ast_iostream_close(struct ast_iostream *stream)
Close an iostream.
void ast_iostream_set_timeout_disable(struct ast_iostream *stream)
Disable the iostream timeout timer.
Asterisk JSON abstraction layer.
struct ast_json * ast_json_object_iter_value(struct ast_json_iter *iter)
Get the value from an iterator.
enum ast_json_type ast_json_typeof(const struct ast_json *value)
Get the type of value.
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
struct ast_json_iter * ast_json_object_iter_next(struct ast_json *object, struct ast_json_iter *iter)
Get the next iterator.
struct ast_json * ast_json_array_get(const struct ast_json *array, size_t index)
Get an element from an array.
struct ast_json_payload * ast_json_payload_create(struct ast_json *json)
Create an ao2 object to pass json blobs as data payloads for stasis.
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
struct ast_json_iter * ast_json_object_iter(struct ast_json *object)
Get an iterator pointing to the first field in a JSON object.
struct ast_json * ast_json_ref(struct ast_json *value)
Increase refcount on value.
const char * ast_json_string_get(const struct ast_json *string)
Get the value of a JSON string.
const char * ast_json_object_iter_key(struct ast_json_iter *iter)
Get the key from an iterator.
struct ast_json * ast_json_object_get(struct ast_json *object, const char *key)
Get a field from a JSON object.
intmax_t ast_json_integer_get(const struct ast_json *integer)
Get the value from a JSON integer.
size_t ast_json_array_size(const struct ast_json *array)
Get the size of a JSON array.
int ast_json_is_null(const struct ast_json *value)
Check if value is JSON null.
A set of macros to manage forward-linked lists.
#define AST_RWLIST_REMOVE_CURRENT
#define AST_RWLIST_RDLOCK(head)
Read locks a list.
#define AST_LIST_HEAD_INIT_NOLOCK(head)
Initializes a list head structure.
#define AST_LIST_HEAD_NOLOCK(name, type)
Defines a structure to be used to hold a list of specified type (with no lock).
#define AST_RWLIST_TRAVERSE_SAFE_BEGIN
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_RWLIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a read/write list of specified type, statically initialized.
#define AST_RWLIST_REMOVE_HEAD
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
#define AST_RWLIST_INSERT_AFTER
#define AST_RWLIST_REMOVE
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define AST_RWLIST_TRAVERSE_SAFE_END
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
#define AST_RWLIST_TRAVERSE
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
#define AST_LIST_REMOVE(head, elm, field)
Removes a specific entry from a list.
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
#define AST_RWLIST_INSERT_HEAD
#define AST_RWLIST_INSERT_TAIL
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
struct ast_tm * ast_localtime(const struct timeval *timep, struct ast_tm *p_tm, const char *zone)
Timezone-independent version of localtime_r(3).
int ast_strftime(char *buf, size_t len, const char *format, const struct ast_tm *tm)
Special version of strftime(3) that handles fractions of a second. Takes the same arguments as strfti...
Asterisk locking-related definitions:
#define AST_PTHREADT_NULL
#define ast_mutex_init(pmutex)
#define ast_mutex_unlock(a)
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return the previous value of *p.
#define ast_mutex_destroy(a)
#define ast_mutex_lock(a)
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 manager_subscriptions_init(void)
Initialize all Stasis Message Bus API topics and routers used by the various sub-components of AMI.
static struct ast_tls_config ami_tls_cfg
static void close_mansession_file(struct mansession *s)
static int ast_xml_doc_item_cmp_fn(const void *a, const void *b)
static struct ast_tcptls_session_args ami_desc
static struct ast_http_uri managerxmluri
const char * words[AST_MAX_CMD_LEN]
static char * handle_manager_show_events(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
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)
int astman_verify_session_writepermissions(uint32_t ident, int perm)
Verify a session's write permissions against a permission mask.
static int __init_manager(int reload, int by_external_config)
static struct ast_tcptls_session_args amis_desc
static void xml_copy_escape(struct ast_str **out, const char *src, int mode)
static struct ast_custom_function managerclient_function
description of AMI_CLIENT dialplan function
static void purge_old_stuff(void *data)
cleanup code called at each iteration of server_root, guaranteed to happen every 5 seconds at most
struct ast_datastore * astman_datastore_find(struct mansession *s, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a session.
static struct mansession_session * find_session(uint32_t ident, int incinuse)
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)
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
int astman_datastore_add(struct mansession *s, struct ast_datastore *datastore)
Add a datastore to a session.
static int variable_count_cmp_fn(void *obj, void *vstr, int flags)
static char * handle_manager_show_settings(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
CLI command manager show settings.
static void manager_event_blob_dtor(void *obj)
static void load_channelvars(struct ast_variable *var)
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.
static struct mansession_session * find_session_by_nonce(const char *username, unsigned long nonce, int *stale)
int astman_verify_session_readpermissions(uint32_t ident, int perm)
Verify a session's read permissions against a permission mask.
static struct ast_http_uri manageruri
static void manager_set_defaults(void)
static void manager_shutdown(void)
static void process_output(struct mansession *s, struct ast_str **out, struct ast_variable *params, enum output_format format)
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 char * handle_manager_show_event(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
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
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 load_module(void)
static struct ast_http_uri arawmanuri
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:...
static int variable_count_hash_fn(const void *vvc, const int flags)
int astman_is_authed(uint32_t ident)
Determine if a manager session ident is authenticated.
static struct ast_http_uri rawmanuri
static struct ast_cli_entry cli_manager[]
static int unload_module(void)
static void manager_free_user(struct ast_manager_user *user)
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_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 struct ast_http_uri amanageruri
static int get_manager_sessions_cb(void *obj, void *arg, void *data, int flags)
Get number of logged in sessions for a login name.
static int subscribe_all(void)
static const char *const contenttype[]
static struct ast_http_uri amanagerxmluri
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)
int astman_datastore_remove(struct mansession *s, struct ast_datastore *datastore)
Remove a datastore from a session.
static void load_disabledevents(struct ast_variable *var)
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
#define EVENT_FLAG_VERBOSE
#define EVENT_FLAG_REPORTING
#define ast_manager_register_xml_core(action, authority, func)
Register a manager callback using XML documentation to describe the manager.
#define manager_event(category, event, contents,...)
External routines may send asterisk manager events this way.
struct ast_str * ast_manager_build_channel_state_string(const struct ast_channel_snapshot *snapshot)
Generate the AMI message body from a channel snapshot.
int manager_mwi_init(void)
Initialize support for AMI MWI events.
#define EVENT_FLAG_CONFIG
int manager_bridging_init(void)
Initialize support for AMI channel events.
#define EVENT_FLAG_SYSTEM
#define EVENT_FLAG_SECURITY
int manager_endpoints_init(void)
Initialize support for AMI endpoint events.
void(* manager_hangup_handler_t)(struct ast_channel *chan, int causecode)
Callback used by ast_manager_hangup_helper that will actually hangup a channel.
int(* key_exclusion_cb)(const char *key)
Callback used to determine whether a key should be skipped when converting a JSON object to a manager...
struct stasis_message_type * ast_manager_get_generic_type(void)
Get the stasis_message_type for generic messages.
#define DEFAULT_MANAGER_PORT
int manager_system_init(void)
Initialize support for AMI system events.
#define EVENT_FLAG_HOOKRESPONSE
#define ast_manager_event_multichan(category, event, nchans, chans, contents,...)
#define DEFAULT_MANAGER_TLS_PORT
#define EVENT_FLAG_MESSAGE
#define EVENT_FLAG_COMMAND
int manager_channels_init(void)
Initialize support for AMI channel events.
#define EVENT_FLAG_DIALPLAN
#define EVENT_FLAG_ORIGINATE
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.
int(* manager_hangup_cause_validator_t)(const char *channel_name, const char *cause)
Callback used by ast_manager_hangup_helper that will validate the cause code.
void MD5Update(struct MD5Context *context, unsigned char const *buf, unsigned len)
void MD5Init(struct MD5Context *context)
void MD5Final(unsigned char digest[16], struct MD5Context *context)
Out-of-call text message support.
Asterisk module definitions.
@ AST_MODFLAG_GLOBAL_SYMBOLS
#define ast_module_unref(mod)
Release a reference to the module.
int ast_module_check(const char *name)
Check if module with the name given is loaded.
int ast_unload_resource(const char *resource_name, enum ast_module_unload_mode)
Unload a module.
enum ast_module_load_result ast_load_resource(const char *resource_name)
Load a module.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
ast_module_reload_result
Possible return types for ast_module_reload.
@ AST_MODULE_RELOAD_IN_PROGRESS
@ AST_MODULE_RELOAD_QUEUED
@ AST_MODULE_RELOAD_SUCCESS
@ AST_MODULE_RELOAD_ERROR
@ AST_MODULE_RELOAD_NOT_IMPLEMENTED
@ AST_MODULE_RELOAD_NOT_FOUND
@ AST_MODULE_RELOAD_UNINITIALIZED
#define ast_module_running_ref(mod)
Hold a reference to the module if it is running.
@ AST_MODULE_LOAD_FAILURE
Module could not be loaded properly.
@ AST_MODULE_LOAD_SUCCESS
enum ast_module_reload_result ast_module_reload(const char *name)
Reload asterisk modules.
static char * ast_sockaddr_stringify(const struct ast_sockaddr *addr)
Wrapper around ast_sockaddr_stringify_fmt() with default format.
#define ast_sockaddr_port(addr)
Get the port number of a socket address.
static void ast_sockaddr_copy(struct ast_sockaddr *dst, const struct ast_sockaddr *src)
Copies the data from one ast_sockaddr to another.
int ast_sockaddr_parse(struct ast_sockaddr *addr, const char *str, int flags)
Parse an IPv4 or IPv6 address string.
static int ast_sockaddr_isnull(const struct ast_sockaddr *addr)
Checks if the ast_sockaddr is null. "null" in this sense essentially means uninitialized,...
#define ast_sockaddr_set_port(addr, port)
Sets the port number of a socket address.
static char * ast_sockaddr_stringify_addr(const struct ast_sockaddr *addr)
Wrapper around ast_sockaddr_stringify_fmt() to return an address only.
static void ast_sockaddr_setnull(struct ast_sockaddr *addr)
Sets address addr to null.
struct timeval ast_lastreloadtime
struct timeval ast_startuptime
#define ast_opt_sounds_search_custom
Asterisk file paths, configured in asterisk.conf.
const char * ast_config_AST_RUN_GROUP
const char * ast_config_AST_RUN_USER
const char * ast_config_AST_CONFIG_DIR
const char * ast_config_AST_SYSTEM_NAME
Core PBX routines and definitions.
int ast_findlabel_extension(struct ast_channel *c, const char *context, const char *exten, const char *label, const char *callerid)
Find the priority of an extension that has the specified label.
int ast_pbx_outgoing_exten_predial(const char *type, struct ast_format_cap *cap, const char *addr, int timeout, const char *context, const char *exten, int priority, int *reason, int synchronous, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel, int early_media, const struct ast_assigned_ids *assignedids, const char *predial_callee)
const char * ast_extension_state2str(int extension_state)
Return string representation of the state of an extension.
int ast_pbx_outgoing_app(const char *type, struct ast_format_cap *cap, const char *addr, int timeout, const char *app, const char *appdata, int *reason, int synchronous, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel, const struct ast_assigned_ids *assignedids)
Synchronously or asynchronously make an outbound call and execute an application on the channel.
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
int ast_pbx_outgoing_exten(const char *type, struct ast_format_cap *cap, const char *addr, int timeout, const char *context, const char *exten, int priority, int *reason, int synchronous, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel, int early_media, const struct ast_assigned_ids *assignedids)
Synchronously or asynchronously make an outbound call and send it to a particular extension.
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name.
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
int ast_func_read(struct ast_channel *chan, const char *function, char *workspace, size_t len)
executes a read operation on a function
int __ast_custom_function_register(struct ast_custom_function *acf, struct ast_module *mod)
Register a custom function.
void pbx_retrieve_variable(struct ast_channel *c, const char *var, char **ret, char *workspace, int workspacelen, struct varshead *headp)
Retrieve the value of a builtin variable or variable from the channel variable stack.
@ AST_HINT_UPDATE_PRESENCE
int ast_extension_state_add(const char *context, const char *exten, ast_state_cb_type change_cb, void *data)
Add watcher for extension states.
int ast_get_hint(char *hint, int hintsize, char *name, int namesize, struct ast_channel *c, const char *context, const char *exten)
If an extension hint exists, return non-zero.
int ast_async_goto(struct ast_channel *chan, const char *context, const char *exten, int priority)
Set the channel to next execute the specified dialplan location.
int ast_extension_state(struct ast_channel *c, const char *context, const char *exten)
Uses hint and devicestate callback to get the state of an extension.
Presence state management.
const char * ast_presence_state2str(enum ast_presence_state state)
Convert presence state to text string for output.
static struct templates templates
struct stasis_forward * sub
Pluggable RTP Architecture.
struct stasis_topic * ast_rtp_topic(void)
Stasis Message Bus API topic for RTP and RTCP related messages
Security Event Reporting API.
int ast_security_event_report(const struct ast_security_event_common *sec)
Report a security event.
struct stasis_topic * ast_security_topic(void)
A stasis_topic which publishes messages for security related issues.
#define AST_SECURITY_EVENT_CHAL_RESP_FAILED_VERSION
Event descriptor version.
#define AST_SECURITY_EVENT_SESSION_LIMIT_VERSION
Event descriptor version.
#define AST_SECURITY_EVENT_REQ_NOT_ALLOWED_VERSION
Event descriptor version.
#define AST_SECURITY_EVENT_REQ_BAD_FORMAT_VERSION
Event descriptor version.
#define AST_SECURITY_EVENT_FAILED_ACL_VERSION
Event descriptor version.
#define AST_SECURITY_EVENT_INVAL_PASSWORD_VERSION
Event descriptor version.
#define AST_SECURITY_EVENT_INVAL_ACCT_ID_VERSION
Event descriptor version.
@ AST_SECURITY_EVENT_INVAL_PASSWORD
An attempt at basic password authentication failed.
@ AST_SECURITY_EVENT_SESSION_LIMIT
Session limit reached.
@ AST_SECURITY_EVENT_FAILED_ACL
Failed ACL.
@ AST_SECURITY_EVENT_REQ_NOT_ALLOWED
A request was made that is not allowed.
@ AST_SECURITY_EVENT_CHAL_RESP_FAILED
An attempt at challenge/response authentication failed.
@ AST_SECURITY_EVENT_REQ_BAD_FORMAT
Request received with bad formatting.
@ AST_SECURITY_EVENT_SUCCESSFUL_AUTH
FYI FWIW, Successful authentication has occurred.
@ AST_SECURITY_EVENT_INVAL_ACCT_ID
Invalid Account ID.
#define AST_SECURITY_EVENT_SUCCESSFUL_AUTH_VERSION
Event descriptor version.
struct ast_manager_event_blob * stasis_message_to_ami(struct stasis_message *msg)
Build the AMI representation of the message.
struct stasis_message_type * stasis_message_type(const struct stasis_message *msg)
Get the message type for a stasis_message.
#define STASIS_MESSAGE_TYPE_CLEANUP(name)
Boiler-plate messaging macro for cleaning up message types.
@ STASIS_SUBSCRIPTION_FILTER_SELECTIVE
struct stasis_forward * stasis_forward_cancel(struct stasis_forward *forward)
struct stasis_topic * stasis_topic_create(const char *name)
Create a new topic.
int stasis_subscription_accept_message_type(struct stasis_subscription *subscription, const struct stasis_message_type *type)
Indicate to a subscription that we are interested in a message type.
int stasis_subscription_set_filter(struct stasis_subscription *subscription, enum stasis_subscription_message_filter filter)
Set the message type filtering level on a subscription.
@ STASIS_SUBSCRIPTION_FORMATTER_AMI
#define STASIS_MESSAGE_TYPE_INIT(name)
Boiler-plate messaging macro for initializing message types.
void * stasis_message_data(const struct stasis_message *msg)
Get the data contained in a message.
struct stasis_subscription * stasis_unsubscribe_and_join(struct stasis_subscription *subscription)
Cancel a subscription, blocking until the last message is processed.
struct stasis_message * stasis_message_create(struct stasis_message_type *type, void *data)
Create a new message.
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.
void stasis_publish(struct stasis_topic *topic, struct stasis_message *message)
Publish a message to a topic's subscribers.
#define stasis_subscribe(topic, callback, data)
int stasis_message_can_be_ami(struct stasis_message *msg)
Determine if the given message can be converted to AMI.
struct ast_bridge_snapshot * ast_bridge_get_snapshot_by_uniqueid(const char *bridge_id)
Returns the current snapshot for the bridge.
int stasis_message_router_set_congestion_limits(struct stasis_message_router *router, long low_water, long high_water)
Set the high and low alert water marks of the stasis message router.
#define stasis_message_router_create(topic)
Create a new message router object.
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.
void stasis_message_router_unsubscribe_and_join(struct stasis_message_router *router)
Unsubscribe the router from the upstream topic, blocking until the final message has been processed.
void stasis_message_router_set_formatters_default(struct stasis_message_router *router, stasis_subscription_cb callback, void *data, enum stasis_subscription_message_formatters formatters)
Sets the default route of a router with formatters.
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
#define ast_string_field_ptr_build_va(x, ptr, fmt, args)
Set a field to a complex (built) value with prebuilt va_lists.
#define AST_STRING_FIELD(name)
Declare a string field.
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
#define ast_string_field_build(x, field, fmt, args...)
Set a field to a complex (built) value.
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
String manipulation functions.
@ AST_DYNSTR_BUILD_FAILED
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
int ast_str_set_va(struct ast_str **buf, ssize_t max_len, const char *fmt, va_list ap)
Set a dynamic string from a va_list.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
static force_inline int attribute_pure ast_str_hash(const char *str)
Compute a hash value on a string.
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true"....
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
static int force_inline attribute_pure ast_ends_with(const char *str, const char *suffix)
Checks whether a string ends with another.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
int attribute_pure ast_false(const char *val)
Make sure something is false. Determine if a string containing a boolean value is "false"....
#define ast_str_alloca(init_len)
void ast_str_reset(struct ast_str *buf)
Reset the content of a dynamic string. Useful before a series of ast_str_append.
int ast_in_delimited_string(const char *needle, const char *haystack, char delim)
Check if there is an exact match for 'needle' between delimiters in 'haystack'.
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
size_t ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
int ast_str_append_va(struct ast_str **buf, ssize_t max_len, const char *fmt, va_list ap)
Append to a dynamic string using a va_list.
char * ast_trim_blanks(char *str)
Trims trailing whitespace characters from a string.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
static int force_inline attribute_pure ast_begins_with(const char *str, const char *prefix)
Checks whether a string begins with another.
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
struct ao2_container * ast_str_container_alloc_options(enum ao2_alloc_opts opts, int buckets)
Allocates a hash container for bare strings.
int ast_str_container_add(struct ao2_container *str_container, const char *add)
Adds a string to a string container allocated by ast_str_container_alloc.
char * ast_strsep(char **s, const char sep, uint32_t flags)
Act like strsep but ignore separators inside quotes.
char * ast_skip_blanks(const char *str)
Gets a pointer to the first non-whitespace character in a string.
int ast_regex_string_to_regex_pattern(const char *regex_string, struct ast_str **regex_pattern)
Given a string regex_string in the form of "/regex/", convert it into the form of "regex".
struct ast_str * ast_str_thread_get(struct ast_threadstorage *ts, size_t init_len)
Retrieve a thread locally stored dynamic string.
list of actions registered
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Wrapper for an ast_acl linked list.
Structure to pass both assignedid values to channel drivers.
Structure that contains a snapshot of information about a bridge.
struct ao2_container * channels
Structure that contains information about a bridge.
const ast_string_field uniqueid
struct ast_category * prev
struct timeval creationtime
const ast_string_field uniqueid
const ast_string_field name
const ast_string_field data
const ast_string_field appl
Structure representing a snapshot of channel state.
struct ast_channel_snapshot_dialplan * dialplan
struct ast_channel_snapshot_bridge * bridge
struct ast_channel_snapshot_base * base
Main Channel structure associated with a channel.
const ast_string_field name
descriptor for a cli entry.
enum ast_frame_read_action action
Data structure associated with a custom dialplan function.
Structure for a data store type.
Structure for a data store object.
const struct ast_datastore_info * info
Structure used to handle boolean flags.
Data structure associated with a single frame of data.
Definition of a URI handler.
Iterator for JSON object key/values.
Abstract JSON element (object, array, string, int, ...).
Struct containing info for an AMI event to send out.
const ast_string_field extra_fields
const char * manager_event
user descriptor, as read from the config file.
struct ast_variable * chanvars
struct ao2_container * whitefilters
struct ao2_container * blackfilters
struct ast_acl_list * acl
Structure used to transport a message through the frame core.
Structure for mutex and tracking information.
Information needed to identify an endpoint in a call.
struct ast_party_name name
Subscriber name.
struct ast_party_number number
Subscriber phone number.
unsigned char valid
TRUE if the name information is valid/present.
char * str
Subscriber name (Malloced)
unsigned char valid
TRUE if the number information is valid/present.
char * str
Subscriber phone number (Malloced)
An attempt at challenge/response auth failed.
const char * response
Response received.
struct ast_security_event_common common
Common security event descriptor elements.
const char * expected_response
Response expected to be received.
enum ast_security_event_type event_type
The security event sub-type.
Checking against an IP access control list failed.
struct ast_security_event_common common
Common security event descriptor elements.
Invalid account ID specified (invalid username, for example)
struct ast_security_event_common common
Common security event descriptor elements.
An attempt at basic password auth failed.
struct ast_security_event_common common
Common security event descriptor elements.
Request denied because it's not allowed.
struct ast_security_event_common common
Common security event descriptor elements.
const char * request_type
Request type that was made.
Request denied because of a session limit.
Successful authentication.
struct ast_security_event_common common
Common security event descriptor elements.
Socket address structure.
Support for dynamic strings.
arguments for the accepting thread
struct ast_sockaddr local_address
struct ast_tls_config * tls_cfg
describes a server instance
struct ast_iostream * stream
struct ast_sockaddr remote_address
struct ast_tcptls_session_args * parent
Structure for variables, used for configurations and for channel variables.
struct ast_variable * next
Struct that contains the XML documentation for a particular item. Note that this is an ao2 ref counte...
struct ast_xml_doc_item * next
struct ast_str * arguments
struct ast_str * description
const ast_string_field name
struct ast_str * synopsis
helper function for originate
struct ast_variable * vars
struct ast_format_cap * cap
const ast_string_field description
struct ast_module * module
struct ast_xml_doc_item * final_response
const ast_string_field synopsis
int(* func)(struct mansession *s, const struct message *m)
const ast_string_field seealso
const ast_string_field syntax
unsigned int registered
TRUE if the AMI action is registered and the callback can be called.
const ast_string_field arguments
struct ast_xml_doc_item * list_responses
struct ast_variable * chanvars
struct ast_iostream * stream
struct timeval sessionstart_tv
struct ao2_container * whitefilters
struct ao2_container * blackfilters
struct eventqent * last_ev
struct mansession_session::mansession_datastores datastores
struct mansession_session::@372 list
In case you didn't read that giant block of text above the mansession_session struct,...
struct ast_iostream * stream
struct manager_custom_hook * hook
struct mansession_session * session
enum mansession_message_parsing parsing
struct ast_tcptls_session_instance * tcptls_session
const char * headers[AST_MAX_MANHEADERS]
structure to hold users read from users.conf
list of users found in the config file
An API for managing task processing threads that can be shared across modules.
#define AST_TASKPROCESSOR_HIGH_WATER_LEVEL
Generic support for tcp/tls servers in Asterisk.
void * ast_tcptls_server_root(void *)
void ast_tcptls_server_stop(struct ast_tcptls_session_args *desc)
Shutdown a running server if there is one.
int ast_ssl_setup(struct ast_tls_config *cfg)
Set up an SSL server.
void ast_tcptls_server_start(struct ast_tcptls_session_args *desc)
This is a generic (re)start routine for a TCP server, which does the socket/bind/listen and starts a ...
int ast_tls_read_conf(struct ast_tls_config *tls_cfg, struct ast_tcptls_session_args *tls_desc, const char *varname, const char *value)
Used to parse conf files containing tls/ssl options.
Handy terminal functions for vt* terms.
char * term_color(char *outbuf, const char *inbuf, int fgcolor, int bgcolor, int maxout)
Colorize a specified string by adding terminal color codes.
char * term_strip(char *outbuf, const char *inbuf, int maxout)
Remove colorings from a specified string.
static struct aco_type item
Definitions to aid in the use of thread local storage.
#define AST_THREADSTORAGE(name)
Define a thread storage variable.
int64_t ast_tvdiff_sec(struct timeval end, struct timeval start)
Computes the difference (in seconds) between two struct timeval instances.
int ast_tvzero(const struct timeval t)
Returns true if the argument is 0,0.
struct timeval ast_tvsub(struct timeval a, struct timeval b)
Returns the difference of two timevals a - b.
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
Support for translation of data formats. translate.c.
const char * ast_translate_path_to_str(struct ast_trans_pvt *t, struct ast_str **str)
Puts a string representation of the translation path into outbuf.
int error(const char *format,...)
#define ast_test_flag(p, flag)
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
int ast_wait_for_input(int fd, int ms)
int ast_parse_digest(const char *digest, struct ast_http_digest *d, int request, int pedantic)
Parse digest authorization header.
long int ast_random(void)
#define ast_pthread_create_detached(a, b, c, d)
#define ast_set_flag(p, flag)
void ast_md5_hash(char *output, const char *input)
Produces MD5 hash based on input string.
struct ast_xml_doc_item * ast_xmldoc_build_list_responses(const char *type, const char *name, const char *module)
Generate the [list responses] tag based on type of node ('application', 'function' or 'agi') and name...
char * ast_xmldoc_build_description(const char *type, const char *name, const char *module)
Generate description documentation from XML.
char * ast_xmldoc_build_syntax(const char *type, const char *name, const char *module)
Get the syntax for a specified application or function.
char * ast_xmldoc_build_arguments(const char *type, const char *name, const char *module)
Generate the [arguments] tag based on type of node ('application', 'function' or 'agi') and name.
char * ast_xmldoc_build_synopsis(const char *type, const char *name, const char *module)
Generate synopsis documentation from XML.
struct ao2_container * ast_xmldoc_build_documentation(const char *type)
Build the documentation for a particular source type.
char * ast_xmldoc_build_seealso(const char *type, const char *name, const char *module)
Parse the <see-also> node content.
char * ast_xmldoc_printable(const char *bwinput, int withcolors)
Colorize and put delimiters (instead of tags) to the xmldoc output.
struct ast_xml_doc_item * ast_xmldoc_build_final_response(const char *type, const char *name, const char *module)
Generate the [final response] tag based on type of node ('application', 'function' or 'agi') and name...