116 #define AST_CLI_INITLEN 256 118 void ast_cli(
int fd,
const char *fmt, ...)
139 unsigned int res = 0;
143 if (!strcasecmp(ml->module, module)) {
156 unsigned int res = 0;
160 if (!strcasecmp(ml->module, module)) {
198 if (gid < 0 && uid < 0) {
204 if (user_perm->
gid != gid && user_perm->
uid != uid) {
208 if (strcasecmp(perm->
command,
"all") && strncasecmp(perm->
command, command, strlen(perm->
command))) {
210 ispattern = !regcomp(®exbuf, perm->
command, REG_EXTENDED | REG_NOSUB | REG_ICASE);
211 if (ispattern && regexec(®exbuf, command, 0,
NULL, 0)) {
220 if (user_perm->
uid == uid) {
247 "Usage: module load <module name>\n" 248 " Loads the specified module into Asterisk.\n";
276 "Usage: module reload [module ...]\n" 277 " Reloads configuration files for all listed modules which support\n" 278 " reloading, or for all supported modules if none are listed.\n";
288 for (x = e->
args; x < a->argc; x++) {
295 ast_cli(a->
fd,
"The module '%s' does not support reloads\n", a->
argv[x]);
298 ast_cli(a->
fd,
"Asterisk cannot reload a module yet; request queued\n");
301 ast_cli(a->
fd,
"The module '%s' reported a reload failure\n", a->
argv[x]);
304 ast_cli(a->
fd,
"A module reload request is already in progress; please be patient\n");
307 ast_cli(a->
fd,
"The module '%s' was not properly initialized. Before reloading" 308 " the module, you must run \"module load %s\" and fix whatever is" 309 " preventing the module from being initialized.\n", a->
argv[x], a->
argv[x]);
312 ast_cli(a->
fd,
"Module '%s' reloaded successfully.\n", a->
argv[x]);
325 "Usage: core reload\n" 326 " Execute a global reload.\n";
356 if (!strcasecmp(ml->module, module))
366 unsigned int prospective[2];
367 unsigned int part = strtoul(partial,
NULL, 10);
370 if (part < min || part > max) {
374 for (i = 0; i < 21; i++) {
376 prospective[0] = prospective[1] = part;
380 prospective[0] = prospective[1] = part * 10 + (i - 1);
382 prospective[0] = (part * 10 + (i - 11)) * 10;
383 prospective[1] = prospective[0] + 9;
385 if (i < 11 && (prospective[0] < min || prospective[0] > max)) {
387 }
else if (prospective[1] < min || prospective[0] > max) {
393 snprintf(next,
sizeof(next),
"%u", prospective[0]);
395 snprintf(next,
sizeof(next),
"%u...", prospective[0] / 10);
403 #define DEBUG_HANDLER 0 404 #define TRACE_HANDLER 1 405 #define VERBOSE_HANDLER 2 411 const char *what =
"";
421 what =
"Console verbose";
426 snprintf(was_buf,
sizeof(was_buf),
"%d", old_val);
432 if (old_val == cur_val) {
433 ast_cli(a->
fd,
"%s is still %s.\n", what, was);
439 snprintf(now_buf,
sizeof(now_buf),
"%d", cur_val);
445 ast_cli(a->
fd,
"%s was %s and is now %s.\n", what, was, now);
456 unsigned int module_option;
458 const char *handler_name;
468 handler_name =
"debug";
473 handler_name =
"trace";
479 if (!strcasecmp(a->
argv[e->
args],
"atleast")) {
487 if (sscanf(a->
argv[e->
args + atleast],
"%30d", &newlevel) != 1) {
491 if (a->
argc == e->
args + atleast + 2) {
494 int mod_len = strlen(mod);
496 if (3 < mod_len && !strcasecmp(mod + mod_len - 3,
".so")) {
497 mod[mod_len - 3] =
'\0';
507 ast_cli(a->
fd,
"Core %s is still 0 for '%s'.\n", handler_name, mod);
515 ast_cli(a->
fd,
"Core %s was %u and has been set to 0 for '%s'.\n", handler_name,
522 if ((atleast && newlevel < ml->level) || ml->
level == newlevel) {
523 ast_cli(a->
fd,
"Core %s is still %u for '%s'.\n", handler_name, ml->
level, mod);
528 ml->
level = newlevel;
530 ml =
ast_calloc(1,
sizeof(*ml) + strlen(mod) + 1);
536 ml->
level = newlevel;
537 strcpy(ml->module, mod);
542 ast_cli(a->
fd,
"Core %s was %d and has been set to %u for '%s'.\n", handler_name,
543 oldval, ml->
level, ml->module);
561 oldval = *core_option;
562 if (!atleast || newlevel > *core_option) {
563 *core_option = newlevel;
575 const char *argv3 = a->
argv ?
S_OR(a->
argv[3],
"") :
"";
581 "Usage: core set debug [atleast] <level> [module]\n" 582 " core set debug off\n" 584 " Sets level of debug messages to be displayed or\n" 585 " sets a module name to display debug messages from.\n" 586 " 0 or off means no messages should be displayed.\n" 587 " Equivalent to -d[d[...]] on startup\n";
591 if (!strcasecmp(argv3,
"category")) {
595 if (!strcasecmp(argv3,
"atleast")) {
598 if (a->
pos == 3 || (a->
pos == 4 && atleast)) {
599 const char *pos = a->
pos == 3 ? argv3 :
S_OR(a->
argv[4],
"");
600 int numbermatch = (
ast_strlen_zero(pos) || strchr(
"123456789", pos[0])) ? 0 : 21;
602 if (a->
n < 21 && numbermatch == 0) {
604 }
else if (pos[0] ==
'0') {
608 }
else if (a->
n == (21 - numbermatch)) {
609 if (a->
pos == 3 && !strncasecmp(argv3,
"off", strlen(argv3))) {
611 }
else if (a->
pos == 3 && !strncasecmp(argv3,
"atleast", strlen(argv3))) {
617 }
else if ((a->
pos == 4 && !atleast && strcasecmp(argv3,
"off") && strcasecmp(argv3,
"channel"))
618 || (a->
pos == 5 && atleast)) {
633 const char *argv3 = a->
argv ?
S_OR(a->
argv[3],
"") :
"";
639 "Usage: core set trace [atleast] <level> [module]\n" 640 " core set trace off\n" 642 " Sets level of trace messages to be displayed or\n" 643 " sets a module name to display trace messages from.\n" 644 " 0 or off means no messages should be displayed.\n";
648 if (!strcasecmp(argv3,
"atleast")) {
651 if (a->
pos == 3 || (a->
pos == 4 && atleast)) {
652 const char *pos = a->
pos == 3 ? argv3 :
S_OR(a->
argv[4],
"");
653 int numbermatch = (
ast_strlen_zero(pos) || strchr(
"123456789", pos[0])) ? 0 : 21;
655 if (a->
n < 21 && numbermatch == 0) {
657 }
else if (pos[0] ==
'0') {
661 }
else if (a->
n == (21 - numbermatch)) {
662 if (a->
pos == 3 && !strncasecmp(argv3,
"off", strlen(argv3))) {
664 }
else if (a->
pos == 3 && !strncasecmp(argv3,
"atleast", strlen(argv3))) {
670 }
else if ((a->
pos == 4 && !atleast && strcasecmp(argv3,
"off") && strcasecmp(argv3,
"channel"))
671 || (a->
pos == 5 && atleast)) {
689 const char *argv3 = a->
argv ?
S_OR(a->
argv[3],
"") :
"";
693 e->
command =
"core set verbose";
695 "Usage: core set verbose [atleast] <level> [silent]\n" 696 " core set verbose off\n" 698 " Sets level of verbose messages to be displayed.\n" 699 " 0 or off means no verbose messages should be displayed.\n" 700 " The silent option means the command does not report what\n" 701 " happened to the verbose level.\n" 702 " Equivalent to -v[v[...]] on startup\n";
706 if (!strcasecmp(argv3,
"atleast")) {
709 if (a->
pos == 3 || (a->
pos == 4 && atleast)) {
710 const char *pos = a->
pos == 3 ? argv3 :
S_OR(a->
argv[4],
"");
711 int numbermatch = (
ast_strlen_zero(pos) || strchr(
"123456789", pos[0])) ? 0 : 21;
713 if (a->
n < 21 && numbermatch == 0) {
715 }
else if (pos[0] ==
'0') {
719 }
else if (a->
n == (21 - numbermatch)) {
720 if (a->
pos == 3 && !strncasecmp(argv3,
"off", strlen(argv3))) {
722 }
else if (a->
pos == 3 && !strncasecmp(argv3,
"atleast", strlen(argv3))) {
728 }
else if ((a->
pos == 4 && !atleast && strcasecmp(argv3,
"off"))
729 || (a->
pos == 5 && atleast)) {
732 if (a->
n == 0 && !strncasecmp(pos,
"silent", strlen(pos))) {
749 if (!strcasecmp(a->
argv[e->
args],
"atleast")) {
752 if (a->
argc == e->
args + atleast + 2
753 && !strcasecmp(a->
argv[e->
args + atleast + 1],
"silent")) {
756 if (a->
argc != e->
args + atleast + silent + 1) {
759 if (sscanf(a->
argv[e->
args + atleast],
"%30d", &newlevel) != 1) {
766 if (!atleast || newlevel > oldval) {
789 "Usage: logger mute\n" 790 " Disables logging output to the current console, making it possible to\n" 791 " gather information without being disturbed by scrolling lines.\n";
800 if (a->
argc == 3 && !strcasecmp(a->
argv[2],
"silent"))
819 "Usage: module unload [-f|-h] <module_1> [<module_2> ... ]\n" 820 " Unloads the specified module from Asterisk. The -f\n" 821 " option causes the module to be unloaded even if it is\n" 822 " in use (may cause a crash) and the -h module causes the\n" 823 " module to be unloaded even if the module says it cannot, \n" 824 " which almost always will cause a crash.\n";
837 else if (s[1] ==
'h')
846 for (; x < a->
argc; x++) {
848 ast_cli(a->
fd,
"Unable to unload resource %s\n", a->
argv[x]);
857 #define MODLIST_FORMAT "%-30s %-40.40s %-10d %-11s %13s\n" 858 #define MODLIST_FORMAT2 "%-30s %-40.40s %-10s %-11s %13s\n" 882 #define MINUTE (SECOND*60) 883 #define HOUR (MINUTE*60) 884 #define DAY (HOUR*24) 886 #define YEAR (DAY*365) 887 #define NEEDCOMMA(x) ((x) ? ", " : "") 888 if (timeval.tv_sec < 0)
892 ast_cli(fd,
"%s%lu\n", prefix, (u_long)timeval.tv_sec);
896 if (timeval.tv_sec >
YEAR) {
897 x = (timeval.tv_sec /
YEAR);
898 timeval.tv_sec -= (x *
YEAR);
901 if (timeval.tv_sec >
WEEK) {
902 x = (timeval.tv_sec /
WEEK);
903 timeval.tv_sec -= (x *
WEEK);
906 if (timeval.tv_sec >
DAY) {
907 x = (timeval.tv_sec /
DAY);
908 timeval.tv_sec -= (x *
DAY);
911 if (timeval.tv_sec >
HOUR) {
912 x = (timeval.tv_sec /
HOUR);
913 timeval.tv_sec -= (x *
HOUR);
916 if (timeval.tv_sec >
MINUTE) {
917 x = (timeval.tv_sec /
MINUTE);
918 timeval.tv_sec -= (x *
MINUTE);
945 e->
command =
"core show uptime [seconds]";
947 "Usage: core show uptime [seconds]\n" 948 " Shows Asterisk uptime information.\n" 949 " The seconds word returns the uptime in seconds only.\n";
977 e->
command =
"module show [like]";
979 "Usage: module show [like keyword]\n" 980 " Shows Asterisk modules currently in use, and usage statistics.\n";
995 else if (a->
argc == e->
args + 1 && !strcasecmp(a->
argv[e->
args-1],
"like") )
1008 #undef MODLIST_FORMAT 1009 #undef MODLIST_FORMAT2 1013 static const char *
const completions[] = {
"seconds",
NULL };
1015 int showuptime, printsec;
1019 e->
command =
"core show calls [uptime]";
1021 "Usage: core show calls [uptime [seconds]]\n" 1022 " Lists number of currently active calls and total number of calls\n" 1023 " processed through PBX since last restart. If 'uptime' is specified\n" 1024 " the system uptime is also displayed. If 'seconds' is specified in\n" 1025 " addition to 'uptime', the system uptime is displayed in seconds.\n";
1051 ast_cli(a->
fd,
"%d of %d max active call%s (%5.2f%% of capacity)\n",
1069 #define FORMAT_STRING "%-20.20s %-20.20s %-7.7s %-30.30s\n" 1070 #define FORMAT_STRING2 "%-20.20s %-20.20s %-7.7s %-30.30s\n" 1071 #define CONCISE_FORMAT_STRING "%s!%s!%s!%d!%s!%s!%s!%s!%s!%s!%d!%s!%s!%s\n" 1072 #define VERBOSE_FORMAT_STRING "%-20.20s %-20.20s %-16.16s %4d %-7.7s %-12.12s %-25.25s %-15.15s %8.8s %-11.11s %-11.11s %-20.20s\n" 1073 #define VERBOSE_FORMAT_STRING2 "%-20.20s %-20.20s %-16.16s %-4.4s %-7.7s %-12.12s %-25.25s %-15.15s %8.8s %-11.11s %-11.11s %-20.20s\n" 1078 int numchans = 0, concise = 0, verbose = 0, count = 0;
1082 e->
command =
"core show channels [concise|verbose|count]";
1084 "Usage: core show channels [concise|verbose|count]\n" 1085 " Lists currently defined channels and some information about them. If\n" 1086 " 'concise' is specified, the format is abridged and in a more easily\n" 1087 " machine parsable format. If 'verbose' is specified, the output includes\n" 1088 " more and longer fields. If 'count' is specified only the channel and call\n" 1089 " count is output.\n" 1090 " The 'concise' option is deprecated and will be removed from future versions\n" 1099 if (!strcasecmp(a->
argv[e->
args-1],
"concise"))
1101 else if (!strcasecmp(a->
argv[e->
args-1],
"verbose"))
1103 else if (!strcasecmp(a->
argv[e->
args-1],
"count"))
1113 if (!concise && !verbose)
1117 "CallerID",
"Duration",
"Accountcode",
"PeerAccount",
"BridgeID");
1122 char durbuf[16] =
"-";
1128 int durh = duration / 3600;
1129 int durm = (duration % 3600) / 60;
1130 int durs = duration % 60;
1131 snprintf(durbuf,
sizeof(durbuf),
"%02d:%02d:%02d", durh, durm, durs);
1133 snprintf(durbuf,
sizeof(durbuf),
"%d", duration);
1147 }
else if (verbose) {
1157 char locbuf[40] =
"(None)";
1158 char appdata[40] =
"(None)";
1174 ast_cli(a->
fd,
"%d active channel%s\n", numchans,
ESS(numchans));
1176 ast_cli(a->
fd,
"%d of %d max active call%s (%5.2f%% of capacity)\n",
1188 #undef FORMAT_STRING 1189 #undef FORMAT_STRING2 1190 #undef CONCISE_FORMAT_STRING 1191 #undef VERBOSE_FORMAT_STRING 1192 #undef VERBOSE_FORMAT_STRING2 1198 static const char *
const completions[] = {
"all",
NULL };
1203 e->
command =
"channel request hangup";
1205 "Usage: channel request hangup <channel>|<all>\n" 1206 " Request that a channel be hung up. The hangup takes effect\n" 1207 " the next time the driver reads or writes from the channel.\n" 1208 " If 'all' is specified instead of a channel name, all channels\n" 1209 " will see the hangup request.\n";
1226 if (!strcasecmp(a->
argv[3],
"all")) {
1256 struct passwd *pw =
NULL;
1261 e->
command =
"cli show permissions";
1263 "Usage: cli show permissions\n" 1264 " Shows CLI configured permissions.\n";
1273 pw = getpwuid(cp->
uid);
1275 ast_cli(a->
fd,
"user: %s [uid=%d]\n", pw->pw_name, cp->
uid);
1278 gr = getgrgid(cp->
gid);
1280 ast_cli(a->
fd,
"group: %s [gid=%d]\n", gr->gr_name, cp->
gid);
1301 e->
command =
"cli reload permissions";
1303 "Usage: cli reload permissions\n" 1304 " Reload the 'cli_permissions.conf' file.\n";
1318 struct passwd *pw =
NULL;
1320 int gid = -1, uid = -1;
1328 e->
command =
"cli check permissions";
1330 "Usage: cli check permissions {<username>|@<groupname>|<username>@<groupname>} [<command>]\n" 1331 " Check permissions config for a user@group or list the allowed commands for the specified user.\n" 1332 " The username or the groupname may be omitted.\n";
1346 group = strchr(tmp,
'@');
1348 gr = getgrnam(&group[1]);
1350 ast_cli(a->
fd,
"Unknown group '%s'\n", &group[1]);
1358 ast_cli(a->
fd,
"You didn't supply a username\n");
1360 ast_cli(a->
fd,
"Unknown user '%s'\n", tmp);
1378 ast_cli(a->
fd,
"You are not allowed to run any command on Asterisk\n");
1382 ast_cli(a->
fd,
"%s '%s%s%s' is %s to run command: '%s'\n", uid >= 0 ?
"User" :
"Group", tmp,
1383 group && uid >= 0 ?
"@" :
"",
1384 group ? &group[1] :
"",
1403 e->
command =
"_command matchesarray";
1405 "Usage: _command matchesarray \"<line>\" text \n" 1406 " This function is used internally to help with command completion and should.\n" 1407 " never be called by the user directly.\n";
1420 for (x=0; matches[x]; x++) {
1421 matchlen = strlen(matches[x]) + 1;
1422 if (len + matchlen >= buflen) {
1423 buflen += matchlen * 3;
1430 len += sprintf( buf + len,
"%s ", matches[x]);
1467 ast_cli(args->
fd,
"Debugging %s on channel %s\n", args->
is_off ?
"disabled" :
"enabled",
1479 static const char *
const completions_all[] = {
"all",
NULL };
1480 static const char *
const completions_off[] = {
"off",
NULL };
1487 e->
command =
"core set debug channel";
1489 "Usage: core set debug channel <all|channel> [off]\n" 1490 " Enables/disables debugging on all or on a specific channel.\n";
1499 }
else if (a->
pos == 5) {
1509 }
else if (a->
argc == e->
args + 2) {
1511 if (!strcasecmp(a->
argv[e->
args + 1],
"off"))
1515 }
else if (a->
argc != e->
args + 1) {
1519 if (!strcasecmp(
"all", a->
argv[e->
args])) {
1537 ast_cli(a->
fd,
"Debugging on new channels is %s\n", args.
is_off ?
"disabled" :
"enabled");
1544 const char *argv4 = a->
argv ?
S_OR(a->
argv[4],
"") :
"";
1545 int offset = strncasecmp(argv4,
"off", strlen(argv4)) ? 0 : 1;
1549 e->
command =
"core set debug category";
1551 "Usage: core set debug category <category>[:<sublevel>] [category[:<sublevel] ...]\n" 1552 " core set debug category off [<category> [<category>] ...]\n\n" 1553 " Allows enabling and disabling debug logging categories.\n" 1554 " When a category is enabled all relevant debug messages are logged\n" 1555 " for a given category. However, if a sublevel is specified only\n" 1556 " those categorized messages at or below the coded debug sublevel\n" 1565 if (a->
pos == 4 && offset) {
1589 e->
command =
"no debug channel";
1617 long elapsed_seconds=0;
1618 int hour=0,
min=0, sec=0;
1625 char callid_buf[32];
1630 e->
command =
"core show channel";
1632 "Usage: core show channel <channel>\n" 1633 " Shows lots of information about the specified channel.\n";
1667 hour = elapsed_seconds / 3600;
1668 min = (elapsed_seconds % 3600) / 60;
1669 sec = elapsed_seconds % 60;
1670 snprintf(cdrtime,
sizeof(cdrtime),
"%dh%dm%ds", hour,
min, sec);
1672 strcpy(cdrtime,
"N/A");
1679 callid_buf[0] =
'\0';
1692 " Caller ID Name: %s\n" 1693 "Connected Line ID: %s\n" 1694 "Connected Line ID Name: %s\n" 1695 "Eff. Connected Line ID: %s\n" 1696 "Eff. Connected Line ID Name: %s\n" 1697 " DNID Digits: %s\n" 1700 " NativeFormats: %s\n" 1701 " WriteFormat: %s\n" 1703 " WriteTranscode: %s %s\n" 1704 " ReadTranscode: %s %s\n" 1705 " Time to Hangup: %ld\n" 1706 " Elapsed Time: %s\n" 1712 " Call Group: %llu\n" 1713 " Pickup Group: %llu\n" 1714 " Application: %s\n" 1716 " Call Identifer: %s\n",
1746 bridge ? bridge->
uniqueid :
"(Not bridged)",
1754 S_OR(callid_buf,
"(None)")
1789 for(v = metadata; v; v = v->
next) {
1813 int i, which = 0,
len;
1816 for (i = 0; choices[i]; i++) {
1817 if ((!
len || !strncasecmp(word, choices[i],
len)) && ++which > state) {
1832 int wordlen = strlen(word), which = 0;
1846 if (!strncasecmp(word, snapshot->
base->
name, wordlen) && (++which >
state)) {
1867 #define FORMAT_STRING "%-25s %-20s %-20s\n" 1872 int havepattern = 0;
1876 e->
command =
"group show channels";
1878 "Usage: group show channels [pattern]\n" 1879 " Lists all currently active channels with channel group(s) specified.\n" 1880 " Optional regular expression pattern is matched to group names for each\n" 1891 if (regcomp(®exbuf, a->
argv[3], REG_EXTENDED | REG_NOSUB))
1902 if (!havepattern || !regexec(®exbuf, gi->
group, 0,
NULL, 0)) {
1914 ast_cli(a->
fd,
"%d active channel%s\n", numchans,
ESS(numchans));
1916 #undef FORMAT_STRING 1923 e->
command =
"core waitfullybooted";
1925 "Usage: core waitfullybooted\n" 1926 " Wait until Asterisk has fully booted.\n";
1936 ast_cli(a->
fd,
"Asterisk has fully booted.\n");
1942 #ifdef HAVE_MALLOC_TRIM 1958 extern int malloc_trim(
size_t __pad) __THROW;
1964 "Usage: malloc trim\n" 1965 " Try to give excess memory back to the OS.\n";
1971 if (malloc_trim(0)) {
1972 ast_cli(a->
fd,
"Returned some memory to the OS.\n");
1974 ast_cli(a->
fd,
"No memory returned to the OS.\n");
2031 #ifdef HAVE_MALLOC_TRIM 2058 for (i = 0; e->
cmda[i]; i++)
2093 ast_log(
LOG_NOTICE,
"You must wait until last 'cli reload permissions' command finish\n");
2110 if (!strcasecmp(cat,
"general")) {
2113 if (!strcasecmp(v->
name,
"default_perm")) {
2122 if (cat[0] ==
'@') {
2124 gr = getgrnam(&cat[1]);
2141 if ((pw && cp_entry->
uid == pw->pw_uid) || (gr && cp_entry->
gid == gr->gr_gid)) {
2144 user_group = cp_entry;
2152 user_group =
ast_calloc(1,
sizeof(*user_group));
2156 user_group->
uid = (pw ? pw->pw_uid : -1);
2157 user_group->
gid = (gr ? gr->gr_gid : -1);
2159 if (!user_group->
perms) {
2170 if (!strcasecmp(v->
name,
"permit")) {
2176 }
else if (!strcasecmp(v->
name,
"deny")) {
2234 if (!strchr(
cli_rsvd, cli_word[0]))
2235 return (strcasecmp(cmd, cli_word) == 0) ? 1 : -1;
2238 if (l > 0 && cli_word[0] ==
'%') {
2251 if (pos != cli_word && strchr(
cli_rsvd, pos[-1]) && strchr(
cli_rsvd, pos[l])) {
2267 int pos,
int *actual)
2281 if (strncasecmp(token, word, lw))
2294 if (strncasecmp(s, word, lw))
2323 const char *
const *src = cmds;
2324 const char *
const *dst = e->cmda;
2326 for (;; dst++, src += n) {
2336 if (match_type != 0)
2351 if (src - cmds > matchlen) {
2352 matchlen = src - cmds;
2357 return e ? e : cand;
2362 static char cmdline[80];
2368 for (x = 0; argv[x]; x++) {
2369 myargv[x] = argv[x];
2374 ast_join(cmdline,
sizeof(cmdline), myargv);
2411 memset(cmda,
'\0',
sizeof(e->
cmda));
2423 int i, lf, ret = -1;
2426 char **dst = (
char **)e->
cmda;
2438 memset(&a,
'\0',
sizeof(a));
2458 ast_log(
LOG_WARNING,
"Command '%s' already registered (or something close enough)\n",
2501 for (i = 0; i <
len; i++) {
2512 for (i = 0; i <
len; i++)
2524 char matchstr[80] =
"";
2530 ast_join(matchstr,
sizeof(matchstr), match);
2531 len = strlen(matchstr);
2539 if (match && strncasecmp(matchstr, e->
_full_cmd, len))
2547 if (!found && matchstr[0])
2548 ast_cli(fd,
"No such command '%s'.\n", matchstr);
2559 e->
command =
"core show help";
2561 "Usage: core show help [topic]\n" 2562 " When called with a topic as an argument, displays usage\n" 2563 " information on the given command. If called without a\n" 2564 " topic, it provides a list of commands.\n";
2569 int l = strlen(a->
line);
2592 ast_cli(a->
fd,
"No help text available for '%s'.\n", fullcmd);
2598 static char *
parse_args(
const char *s,
int *argc,
const char *argv[],
int max,
int *trailingwhitespace)
2600 char *duplicate, *cur;
2607 if (trailingwhitespace ==
NULL)
2608 trailingwhitespace = &
dummy;
2609 *trailingwhitespace = 0;
2619 while (isspace(*s)) {
2630 if (*s ==
'"' && !escaped) {
2632 if (quoted && whitespace) {
2637 }
else if ((*s ==
' ' || *s ==
'\t') && !(quoted || escaped)) {
2646 }
else if (*s ==
'\\' && !escaped) {
2666 *trailingwhitespace = whitespace;
2733 char *retstr, *prevstr;
2736 struct ast_vector_string *vec =
ast_calloc(1,
sizeof(*vec));
2746 ast_log(
LOG_ERROR,
"Failed to initialize threadstorage for completion.\n");
2756 goto vector_cleanup;
2771 max_equal = strlen(prevstr);
2782 if (!strcasecmp(prevstr, retstr)) {
2789 while (i < max_equal && toupper(prevstr[i]) == toupper(retstr[i])) {
2803 goto vector_cleanup;
2819 for (i = 0; dst[i]; i++) {
2820 if (dst[i][0] !=
'[')
2833 int x = 0, argindex, matchlen;
2836 char matchstr[80] =
"";
2848 ast_join(matchstr,
sizeof(matchstr)-1, argv);
2849 matchlen = strlen(matchstr);
2851 strcat(matchstr,
" ");
2859 int src = 0, dst = 0, n = 0;
2868 for (;src < argindex; dst++, src += n) {
2876 ret =
is_prefix(argv[src], e->
cmda[dst], state - matchnum, &n);
2883 if (matchnum > state)
2897 .n = state - matchnum,
2948 .
fd =
fd, .argc = x, .argv = args+1 };
2950 if (duplicate ==
NULL)
2962 ast_cli(fd,
"No such command '%s' (type 'core show help %s' for other possible commands)\n", s,
find_best(args + 1));
2967 ast_cli(fd,
"Command '%s' cannot be run during shutdown\n", s);
2971 ast_join(tmp,
sizeof(tmp), args + 1);
2974 ast_cli(fd,
"You don't have permissions to run '%s' command\n", tmp);
2982 args[0] = (
char *)e;
2991 ast_cli(fd,
"%s",
S_OR(e->
usage,
"Invalid usage, but no usage information available.\n"));
2993 ast_cli(fd,
"Command '%s' failed.\n", s);
3007 int x, y = 0, count = 0;
3009 for (x = 0; x < size; x++) {
char * ast_cli_generator(const char *text, const char *word, int state)
Readline madness Useful for readline, that's about it.
static AST_VECTOR(struct ast_cli_entry *)
int __ast_cli_register_multiple(struct ast_cli_entry *e, int len, struct ast_module *module)
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
static char * handle_cli_malloc_trim(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define AST_VECTOR_FREE(vec)
Deallocates this vector.
struct ast_variable * next
struct ao2_container * ast_channel_cache_by_name(void)
Secondary channel cache, indexed by name.
#define AST_THREADSTORAGE(name)
Define a thread storage variable.
static char * handle_cli_wait_fullybooted(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
const ast_string_field data
enum sip_cc_notify_state state
static struct module_level_list debug_modules
char * ast_complete_channels(const char *line, const char *word, int pos, int state, int rpos)
Command completion for the list of active channels.
#define ast_rwlock_rdlock(a)
#define ast_channel_lock(chan)
static struct module_level * find_module_level(const char *module, struct module_level_list *mll)
Find the module level setting.
Main Channel structure associated with a channel.
static ast_mutex_t climodentrylock
#define AST_CLI_DEFINE(fn, txt,...)
#define AST_VECTOR_ADD_SORTED(vec, elem, cmp)
Add an element into a sorted vector.
static void cli_shutdown(void)
struct ast_channel_snapshot_base * base
Asterisk locking-related definitions:
struct ast_channel * ast_channel_iterator_next(struct ast_channel_iterator *i)
Get the next channel for a channel iterator.
Asterisk main include file. File version handling, generic pbx functions.
int ast_shutting_down(void)
#define AST_VECTOR_REMOVE_ELEM_UNORDERED(vec, elem, cleanup)
Remove an element from a vector.
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
const ast_string_field uniqueid
#define ast_realloc(p, len)
A wrapper for realloc()
#define AST_RWLOCK_DEFINE_STATIC(rwlock)
char * ast_module_helper(const char *line, const char *word, int pos, int state, int rpos, enum ast_module_helper_type type)
Match modules names for the Asterisk cli.
int ast_active_calls(void)
Retrieve the number of active calls.
#define AST_CLI_COMPLETE_EOF
enum ast_module_load_result ast_load_resource(const char *resource_name)
Load a module.
#define AST_RWLIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a read/write list of specified type, statically initialized...
struct ast_stream_topology * ast_channel_get_stream_topology(const struct ast_channel *chan)
Retrieve the topology of streams on a channel.
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
#define ast_join(s, len, w)
int ast_stream_get_group(const struct ast_stream *stream)
Get the stream group that a stream is part of.
struct ast_group_info * ast_app_group_list_head(void)
Get the head of the group count list.
#define ast_channel_unref(c)
Decrease channel reference count.
static void print_uptimestr(int fd, struct timeval timeval, const char *prefix, int printsec)
#define ast_test_flag(p, flag)
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
unsigned int ast_channel_fout(const struct ast_channel *chan)
Support for translation of data formats. translate.c.
const char * ast_var_value(const struct ast_var_t *var)
static int channel_set_debug(void *obj, void *arg, void *data, int flags)
static int cli_is_registered(struct ast_cli_entry *e)
int ast_carefulwrite(int fd, char *s, int len, int timeoutms)
Try to write string, but wait no more than ms milliseconds before timing out.
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
const char * ast_var_name(const struct ast_var_t *var)
enum ast_media_type ast_stream_get_type(const struct ast_stream *stream)
Get the media type of a stream.
#define ast_set_flag(p, flag)
enum ast_module_reload_result ast_module_reload(const char *name)
Reload asterisk modules.
ast_module_reload_result
Possible return types for ast_module_reload.
descriptor for a cli entry.
const char * ast_module_support_level_to_string(enum ast_module_support_level support_level)
int ast_verb_console_get(void)
Get this thread's console verbosity level.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
static void dummy(char *unused,...)
#define VERBOSE_FORMAT_STRING2
static char * handle_modlist(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
#define AST_RWLIST_HEAD_INIT_VALUE
Defines initial values for a declaration of AST_RWLIST_HEAD.
const char * ast_codec_media_type2str(enum ast_media_type type)
Conversion function to take a media type and turn it into a string.
struct ast_config * ast_config_load2(const char *filename, const char *who_asked, struct ast_flags flags)
Load a config file.
static ast_mutex_t permsconfiglock
mutex used to prevent a user from running the 'cli reload permissions' command while it is already ru...
Structure for variables, used for configurations and for channel variables.
#define AST_VECTOR_APPEND(vec, elem)
Append an element to a vector, growing the vector if needed.
Structure representing a snapshot of channel state.
static int more_words(const char *const *dst)
returns true if there are more words to match
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.
int ast_tvzero(const struct timeval t)
Returns true if the argument is 0,0.
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
static int cli_completion_vector_add(struct ast_vector_string *vec, char *value)
ast_channel_state
ast_channel states
const ast_string_field accountcode
static const char perms_config[]
CLI permissions config file.
unsigned long global_fout
static char * handle_core_set_debug_channel(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
const ast_string_field uniqueid
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
#define ast_cli_register_multiple(e, len)
Register multiple commands.
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
static char * help1(int fd, const char *const match[], int locked)
helper for final part of handle_help if locked = 1, assume the list is already locked ...
char * ast_debug_category_complete(const char *const *argv, int argc, const char *word, int state)
Add a unique (no duplicates) result to a request for completion for debug categories.
int ast_cli_unregister(struct ast_cli_entry *e)
Unregisters a command or an array of commands.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
int ast_debug_category_set_sublevels(const char *const *names, size_t size, int default_sublevel)
Set one or more debug category's sublevel.
#define ast_mutex_lock(a)
static int match(struct ast_sockaddr *addr, unsigned short callno, unsigned short dcallno, const struct chan_iax2_pvt *cur, int check_dcallno)
#define ast_str_alloca(init_len)
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
map a debug or verbose level to a module name
#define ast_strdup(str)
A wrapper for strdup()
struct varshead * ast_channel_varshead(struct ast_channel *chan)
const char * ast_state2str(enum ast_channel_state)
Gives the string form of a given channel state.
char * ast_category_browse(struct ast_config *config, const char *prev_name)
Browse categories.
struct ast_stream * ast_stream_topology_get_stream(const struct ast_stream_topology *topology, unsigned int position)
Get a specific stream from the topology.
Definitions to aid in the use of thread local storage.
void ast_cli(int fd, const char *fmt,...)
#define ast_rwlock_unlock(a)
int ast_channel_priority(const struct ast_channel *chan)
static char * handle_softhangup(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
struct ast_channel_snapshot_dialplan * dialplan
struct ast_trans_pvt * ast_channel_readtrans(const struct ast_channel *chan)
const char * ast_channel_linkedid(const struct ast_channel *chan)
char * ast_skip_nonblanks(const char *str)
Gets a pointer to first whitespace character in a string.
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return the previous value of *p.
void ast_console_toggle_mute(int fd, int silent)
mute or unmute a console from logging
static int allowed_on_shutdown(struct ast_cli_entry *e)
static char * handle_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
int args
This gets set in ast_cli_register()
#define ast_module_unref(mod)
Release a reference to the module.
#define ast_strlen_zero(foo)
struct timeval * ast_channel_whentohangup(struct ast_channel *chan)
static char * handle_debug_or_trace(int handler, struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
struct ast_format * ast_channel_readformat(struct ast_channel *chan)
static int cli_default_perm
Default permissions value 1=Permit 0=Deny.
static char * handle_commandmatchesarray(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * __ast_cli_generator(const char *text, const char *word, int state, int lock)
unsigned int ast_trace_get_by_module(const char *module)
Get the trace level for a module.
const ast_string_field context
#define AST_RWLIST_RDLOCK(head)
Read locks a list.
struct ast_bridge * ast_channel_get_bridge(const struct ast_channel *chan)
Get the bridge associated with a channel.
unsigned int ast_channel_fin(const struct ast_channel *chan)
#define AST_VECTOR_INIT(vec, size)
Initialize a vector.
General Asterisk PBX channel definitions.
int ast_register_cleanup(void(*func)(void))
Register a function to be executed before Asterisk gracefully exits.
Asterisk file paths, configured in asterisk.conf.
char *(* handler)(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
int ast_threadstorage_set_ptr(struct ast_threadstorage *ts, void *ptr)
Set a raw pointer from threadstorage.
#define ast_mutex_trylock(a)
const ast_string_field appl
#define AST_VECTOR_ELEM_CLEANUP_NOOP(elem)
Vector element cleanup that does nothing.
struct ast_trans_pvt * ast_channel_writetrans(const struct ast_channel *chan)
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
struct ast_party_connected_line * ast_channel_connected(struct ast_channel *chan)
int ast_cli_allow_at_shutdown(struct ast_cli_entry *e)
struct cli_perm_head * perms
static char * handle_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
struct ast_variable * ast_stream_get_metadata_list(const struct ast_stream *stream)
Get all stream metadata keys.
#define ao2_ref(o, delta)
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
int ast_softhangup(struct ast_channel *chan, int reason)
Softly hangup up a channel.
void ast_config_destroy(struct ast_config *config)
Destroys a config.
const ast_string_field exten
struct timeval creationtime
#define ast_strdupa(s)
duplicate a string in memory from the stack
struct timeval ast_lastreloadtime
A set of macros to manage forward-linked lists.
#define ast_malloc(len)
A wrapper for malloc()
#define AST_VECTOR_STEAL_ELEMENTS(vec)
Steal the elements from a vector and reinitialize.
#define CONCISE_FORMAT_STRING
void ast_cli_print_timestr_fromseconds(int fd, int seconds, const char *prefix)
Print on cli a duration in seconds in format s year(s), s week(s), s day(s), s hour(s), s second(s)
static struct channel_usage channels
static char * handle_showuptime(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define AST_RWLIST_INSERT_BEFORE_CURRENT
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
const struct ast_format_cap * ast_stream_get_formats(const struct ast_stream *stream)
Get the current negotiated formats of a stream.
AST_LIST_HEAD_NOLOCK(contactliststruct, contact)
static char * handle_trace(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * handle_cli_reload_permissions(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
handles CLI command 'cli reload permissions'
Channels with this particular technology are an implementation detail of Asterisk and should generall...
static char * handle_cli_show_permissions(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
handles CLI command 'cli show permissions'
const char * ast_channel_exten(const struct ast_channel *chan)
struct ao2_container * ast_channel_cache_all(void)
Core PBX routines and definitions.
static struct ast_threadstorage ast_cli_buf
static void remove_shutdown_command(struct ast_cli_entry *e)
#define AST_RWLIST_TRAVERSE_SAFE_BEGIN
struct ast_channel * chan
struct ast_channel * ast_channel_callback(ao2_callback_data_fn *cb_fn, void *arg, void *data, int ao2_flags)
Call a function with every active channel.
#define CONFIG_STATUS_FILEUNCHANGED
List of restrictions per user.
const char * ast_channel_uniqueid(const struct ast_channel *chan)
struct ast_channel_snapshot_caller * caller
static struct ast_cli_entry * find_cli(const char *const cmds[], int match_type)
static char * handle_core_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * handle_unload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * parse_args(const char *s, int *argc, const char *argv[], int max, int *trailingwhitespace)
Structure that contains information about a bridge.
struct ast_vector_string * ast_cli_completion_vector(const char *text, const char *word)
Generates a vector of strings for CLI completion.
int ast_processed_calls(void)
Retrieve the total number of calls processed through the PBX since last restart.
static int modlist_modentry(const char *module, const char *description, int usecnt, const char *status, const char *like, enum ast_module_support_level support_level)
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
list of users to apply restrictions.
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
struct ast_party_id ast_channel_connected_effective_id(struct ast_channel *chan)
static char * handle_help(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define AST_LOG_CATEGORY_DISABLED
static struct module_level_list trace_modules
int __ast_cli_register(struct ast_cli_entry *e, struct ast_module *module)
static char * handle_nodebugchan_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
void ast_callid_strnprint(char *buffer, size_t buffer_size, ast_callid callid)
copy a string representation of the callid into a target string
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
int ast_unload_resource(const char *resource_name, enum ast_module_unload_mode)
Unload a module.
static char * handle_cli_check_permissions(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
handles CLI command 'cli check permissions'
static struct ast_cli_entry cli_cli[]
struct ast_party_dialed * ast_channel_dialed(struct ast_channel *chan)
char * ast_skip_blanks(const char *str)
Gets a pointer to the first non-whitespace character in a string.
#define ast_strndup(str, len)
A wrapper for strndup()
void ast_channel_fout_set(struct ast_channel *chan, unsigned int value)
#define ao2_iterator_next(iter)
struct timeval ast_channel_creationtime(struct ast_channel *chan)
char ** ast_cli_completion_matches(const char *text, const char *word)
Generates a NULL-terminated array of strings that 1) begin with the string in the second parameter...
char * strcasestr(const char *, const char *)
const char * ast_channel_appl(const struct ast_channel *chan)
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
int ast_app_group_list_unlock(void)
Unlock the group count list.
#define ast_channel_unlock(chan)
#define ast_calloc(num, len)
A wrapper for calloc()
struct cli_perm::@371 list
char * ast_cli_complete(const char *word, const char *const choices[], int state)
#define AST_RWLIST_REMOVE_HEAD
Prototypes for public functions only of internal interest,.
Vector container support.
enum ast_channel_state state
void * ast_threadstorage_get_ptr(struct ast_threadstorage *ts)
Retrieve a raw pointer from threadstorage.
static ast_rwlock_t shutdown_commands_lock
int ast_stream_topology_get_count(const struct ast_stream_topology *topology)
Get the number of streams in a topology.
#define AST_VECTOR_PTR_FREE(vec)
Deallocates this vector pointer.
Structure used to handle boolean flags.
#define ast_clear_flag(p, flag)
static char * handle_debug_category(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
struct ast_format_cap * ast_channel_nativeformats(const struct ast_channel *chan)
static char * handle_verbose(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
unsigned int ast_debug_get_by_module(const char *module)
Get the debug level for a module.
const char * ast_channel_data(const struct ast_channel *chan)
#define ast_rwlock_wrlock(a)
#define ast_module_running_ref(mod)
Hold a reference to the module if it is running.
struct timeval ast_startuptime
int ast_cli_command_multiple_full(int uid, int gid, int fd, size_t size, const char *s)
Executes multiple CLI commands Interpret strings separated by NULL and execute each one...
size_t ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
#define AST_RWLIST_INSERT_TAIL
#define AST_VECTOR_GET(vec, idx)
Get an element from a vector.
struct ast_flags ast_options
char * strsep(char **str, const char *delims)
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.
static const char cli_rsvd[]
const char *const summary
int ast_app_group_list_rdlock(void)
Read Lock the group count list.
static char * is_prefix(const char *word, const char *token, int pos, int *actual)
if word is a valid prefix for token, returns the pos-th match as a malloced string, or NULL otherwise. Always tell in *actual how many matches we got.
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Standard Command Line Interface.
int ast_cli_command_full(int uid, int gid, int fd, const char *s)
Interprets a command Interpret a command s, sending output to fd if uid:gid has permissions to run th...
const ast_string_field number
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one...
struct timeval ast_tv(ast_time_t sec, ast_suseconds_t usec)
Returns a timeval from sec, usec.
const char * ast_channel_name(const struct ast_channel *chan)
void ast_verb_console_set(int verb_level)
Set this thread's console verbosity level.
struct ast_channel_snapshot_bridge * bridge
struct ast_channel_iterator * ast_channel_iterator_destroy(struct ast_channel_iterator *i)
Destroy a channel iterator.
const char * ast_stream_state2str(enum ast_stream_state state)
Convert the state of a stream into a string.
static void handler(const char *name, int response_code, struct ast_variable *get_params, struct ast_variable *path_vars, struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
int ast_cli_perms_init(int reload)
int ast_cdr_serialize_variables(const char *channel_name, struct ast_str **buf, char delim, char sep)
Serializes all the data and variables for a current CDR record.
List of users and permissions.
const char * ast_channel_language(const struct ast_channel *chan)
static char * complete_number(const char *partial, unsigned int min, unsigned int max, int n)
static char * handle_showcalls(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define AST_VECTOR_INSERT_AT(vec, idx, elem)
Insert an element at a specific position in a vector, growing the vector if needed.
ast_group_t ast_channel_pickupgroup(const struct ast_channel *chan)
#define AST_RWLIST_REMOVE
static int word_match(const char *cmd, const char *cli_word)
const char * ast_channel_context(const struct ast_channel *chan)
struct timeval ast_tvsub(struct timeval a, struct timeval b)
Returns the difference of two timevals a - b.
static char * group_show_channels(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define VERBOSE_FORMAT_STRING
struct ast_str * ast_str_thread_get(struct ast_threadstorage *ts, size_t init_len)
Retrieve a thread locally stored dynamic string.
ast_group_t ast_channel_callgroup(const struct ast_channel *chan)
#define AST_LOG_CATEGORY_ENABLED
struct ast_channel_iterator * ast_channel_iterator_all_new(void)
Create a new channel iterator.
void ast_channel_fin_set(struct ast_channel *chan, unsigned int value)
struct ast_channel_snapshot_peer * peer
void ast_builtins_init(void)
initialize the _full_cmd string in * each of the builtins.
const char * ast_stream_get_name(const struct ast_stream *stream)
Get the name of a stream.
static char * handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
struct ast_group_info::@248 group_list
struct ast_channel * ast_channel_get_by_name(const char *name)
Find a channel by name.
#define AST_VECTOR_REMOVE(vec, idx, preserve_ordered)
Remove an element from a vector by index.
const char *const cmda[AST_MAX_CMD_LEN]
Asterisk module definitions.
struct ast_format * ast_channel_writeformat(struct ast_channel *chan)
static void destroy_user_perms(void)
cleanup (free) cli_perms linkedlist.
int ast_active_channels(void)
returns number of active/allocated channels
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
static char * handle_logger_mute(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int cli_has_permissions(int uid, int gid, const char *command)
const struct ast_channel_tech * ast_channel_tech(const struct ast_channel *chan)
ast_callid ast_channel_callid(const struct ast_channel *chan)
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
static char * handle_load(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define AST_RWLIST_TRAVERSE_SAFE_END
static char * find_best(const char *argv[])
static void status_debug_verbose(struct ast_cli_args *a, int handler, int old_val, int cur_val)
static char * handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
enum ast_stream_state ast_stream_get_state(const struct ast_stream *stream)
Get the current state of a stream.
static int set_full_cmd(struct ast_cli_entry *e)
#define AST_VECTOR_SIZE(vec)
Get the number of elements in a vector.
struct ast_module * module
#define AST_MUTEX_DEFINE_STATIC(mutex)
AST_THREADSTORAGE_RAW(completion_storage)
int ast_update_module_list(int(*modentry)(const char *module, const char *description, int usecnt, const char *status, const char *like, enum ast_module_support_level support_level), const char *like)
Ask for a list of modules, descriptions, use counts and status.
#define AST_RWLIST_HEAD(name, type)
Defines a structure to be used to hold a read/write list of specified type.
#define AST_VECTOR_CALLBACK_VOID(vec, callback,...)
Execute a callback on every element in a vector disregarding callback return.
const ast_string_field name
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
int ast_cli_completion_add(char *value)
Add a result to a request for completion options.
#define ast_mutex_unlock(a)
static char prefix[MAX_PREFIX]
static struct ast_cli_entry * cli_next(struct ast_cli_entry *e)