summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichiel van Baak <michiel@vanbaak.info>2008-09-28 23:32:14 +0000
committerMichiel van Baak <michiel@vanbaak.info>2008-09-28 23:32:14 +0000
commit90751b16caec323d90ddf7d41db4a25085a3bd76 (patch)
treed5167b9db2e6c55e56def0e52038799c477d3e3d
parent434c69b7fde58f0613afa8477d5a21e4dc76bf0d (diff)
Merge the cli_cleanup branch.
This work is done by lmadsen, junky and mvanbaak during AstriDevCon. This is the second audit the CLI got, and this time lmadsen made sure he had _ALL_ modules loaded that have CLI commands in them. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@145121 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--apps/app_meetme.c63
-rw-r--r--apps/app_mixmonitor.c2
-rw-r--r--apps/app_queue.c8
-rw-r--r--channels/chan_console.c14
-rw-r--r--channels/chan_dahdi.c194
-rw-r--r--channels/chan_features.c4
-rw-r--r--channels/chan_h323.c16
-rw-r--r--channels/chan_misdn.c14
-rw-r--r--channels/chan_oss.c16
-rw-r--r--channels/chan_unistim.c24
-rw-r--r--main/astobj2.c6
-rw-r--r--main/cli.c8
-rw-r--r--main/manager.c12
-rw-r--r--main/taskprocessor.c4
-rw-r--r--res/ais/clm.c4
-rw-r--r--res/ais/evt.c4
-rw-r--r--res/res_agi.c6
-rw-r--r--res/res_clioriginate.c22
-rw-r--r--res/res_config_ldap.c4
-rw-r--r--res/res_config_pgsql.c22
-rw-r--r--res/res_limit.c69
21 files changed, 233 insertions, 283 deletions
diff --git a/apps/app_meetme.c b/apps/app_meetme.c
index 9ca81eb08..78bc881a3 100644
--- a/apps/app_meetme.c
+++ b/apps/app_meetme.c
@@ -883,7 +883,6 @@ cnfout:
return cnf;
}
-
static char *complete_meetmecmd(const char *line, const char *word, int pos, int state)
{
static char *cmds[] = {"concise", "lock", "unlock", "mute", "unmute", "kick", "list", NULL};
@@ -946,11 +945,10 @@ static char *complete_meetmecmd(const char *line, const char *word, int pos, int
return NULL;
}
-static char *meetme_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+static char *meetme_show_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
/* Process the command */
struct ast_conference *cnf;
- struct ast_conf_user *user;
int hr, min, sec;
int i = 0, total = 0;
time_t now;
@@ -960,17 +958,15 @@ static char *meetme_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a
switch (cmd) {
case CLI_INIT:
- e->command = "meetme";
+ e->command = "meetme list [concise]";
e->usage =
- "Usage: meetme (un)lock|(un)mute|kick|list [concise] <confno> <usernumber>\n"
- " Executes a command for the conference or on a conferee\n";
+ "Usage: meetme list [concise] <confno> \n"
+ " List all or a specific conference.\n";
return NULL;
case CLI_GENERATE:
return complete_meetmecmd(a->line, a->word, a->pos, a->n);
}
- if (a->argc > 8)
- ast_cli(a->fd, "Invalid Arguments.\n");
/* Check for length so no buffer will overflow... */
for (i = 0; i < a->argc; i++) {
if (strlen(a->argv[i]) > 100)
@@ -1028,7 +1024,55 @@ static char *meetme_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a
ast_free(cmdline);
return CLI_SUCCESS;
}
- if (a->argc < 3) {
+ if (a->argc < 2) {
+ ast_free(cmdline);
+ return CLI_SHOWUSAGE;
+ }
+
+ ast_debug(1, "Cmdline: %s\n", cmdline->str);
+
+ admin_exec(NULL, cmdline->str);
+ ast_free(cmdline);
+
+ return CLI_SUCCESS;
+}
+
+
+static char *meetme_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+ /* Process the command */
+ struct ast_conference *cnf;
+ struct ast_conf_user *user;
+ int hr, min, sec;
+ int i = 0;
+ time_t now;
+ struct ast_str *cmdline = NULL;
+
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "meetme {lock|unlock|mute|unmute|kick}";
+ e->usage =
+ "Usage: meetme (un)lock|(un)mute|kick <confno> <usernumber>\n"
+ " Executes a command for the conference or on a conferee\n";
+ return NULL;
+ case CLI_GENERATE:
+ return complete_meetmecmd(a->line, a->word, a->pos, a->n);
+ }
+
+ if (a->argc > 8)
+ ast_cli(a->fd, "Invalid Arguments.\n");
+ /* Check for length so no buffer will overflow... */
+ for (i = 0; i < a->argc; i++) {
+ if (strlen(a->argv[i]) > 100)
+ ast_cli(a->fd, "Invalid Arguments.\n");
+ }
+
+ /* Max confno length */
+ if (!(cmdline = ast_str_create(MAX_CONFNUM))) {
+ return CLI_FAILURE;
+ }
+
+ if (a->argc < 1) {
ast_free(cmdline);
return CLI_SHOWUSAGE;
}
@@ -1307,6 +1351,7 @@ static char *sla_show_stations(struct ast_cli_entry *e, int cmd, struct ast_cli_
static struct ast_cli_entry cli_meetme[] = {
AST_CLI_DEFINE(meetme_cmd, "Execute a command on a conference or conferee"),
+ AST_CLI_DEFINE(meetme_show_cmd, "List all or one conference"),
AST_CLI_DEFINE(sla_show_trunks, "Show SLA Trunks"),
AST_CLI_DEFINE(sla_show_stations, "Show SLA Stations"),
};
diff --git a/apps/app_mixmonitor.c b/apps/app_mixmonitor.c
index 066103b3b..1a5922bec 100644
--- a/apps/app_mixmonitor.c
+++ b/apps/app_mixmonitor.c
@@ -365,7 +365,7 @@ static char *handle_cli_mixmonitor(struct ast_cli_entry *e, int cmd, struct ast_
switch (cmd) {
case CLI_INIT:
- e->command = "mixmonitor [start|stop]";
+ e->command = "mixmonitor {start|stop} {<chan_name>} [args]";
e->usage =
"Usage: mixmonitor <start|stop> <chan_name> [args]\n"
" The optional arguments are passed to the MixMonitor\n"
diff --git a/apps/app_queue.c b/apps/app_queue.c
index f4289d323..a4704bcc9 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -6264,9 +6264,9 @@ static char *handle_queue_rule_show(struct ast_cli_entry *e, int cmd, struct ast
struct penalty_rule *pr_iter;
switch (cmd) {
case CLI_INIT:
- e->command = "queue rules show";
+ e->command = "queue show rules";
e->usage =
- "Usage: queue rules show [rulename]\n"
+ "Usage: queue show rules [rulename]\n"
"Show the list of rules associated with rulename. If no\n"
"rulename is specified, list all rules defined in queuerules.conf\n";
return NULL;
@@ -6295,9 +6295,9 @@ static char *handle_queue_rule_reload(struct ast_cli_entry *e, int cmd, struct a
{
switch (cmd) {
case CLI_INIT:
- e->command = "queue rules reload";
+ e->command = "queue reload rules";
e->usage =
- "Usage: queue rules reload\n"
+ "Usage: queue reload rules\n"
"Reloads rules defined in queuerules.conf\n";
return NULL;
case CLI_GENERATE:
diff --git a/channels/chan_console.c b/channels/chan_console.c
index 3511e0bac..c7090a160 100644
--- a/channels/chan_console.c
+++ b/channels/chan_console.c
@@ -694,9 +694,9 @@ static char *cli_console_autoanswer(struct ast_cli_entry *e, int cmd,
switch (cmd) {
case CLI_INIT:
- e->command = "console set autoanswer [on|off]";
+ e->command = "console {set|show} autoanswer [on|off]";
e->usage =
- "Usage: console set autoanswer [on|off]\n"
+ "Usage: console {set|show} autoanswer [on|off]\n"
" Enables or disables autoanswer feature. If used without\n"
" argument, displays the current on/off status of autoanswer.\n"
" The default value of autoanswer is in 'oss.conf'.\n";
@@ -1154,12 +1154,10 @@ static char *cli_console_active(struct ast_cli_entry *e, int cmd, struct ast_cli
switch (cmd) {
case CLI_INIT:
- e->command = "console active";
+ e->command = "console {set|show} active [<device>]";
e->usage =
- "Usage: console active [device]\n"
- " If no device is specified. The active console device will be shown.\n"
- "Otherwise, the specified device will become the console device active for\n"
- "the Asterisk CLI.\n";
+ "Usage: console {set|show} active [<device>]\n"
+ " Set or show the active console device for the Asterisk CLI.\n";
return NULL;
case CLI_GENERATE:
if (a->pos == e->args) {
@@ -1181,7 +1179,7 @@ static char *cli_console_active(struct ast_cli_entry *e, int cmd, struct ast_cli
if (a->argc < e->args)
return CLI_SHOWUSAGE;
- if (a->argc == e->args) {
+ if (a->argc == 3) {
pvt = get_active_pvt();
if (!pvt)
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index f6e37cb65..db24a6d1c 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -11604,32 +11604,6 @@ static char *complete_span_4(const char *line, const char *word, int pos, int st
return complete_span_helper(line,word,pos,state,3);
}
-static char *complete_span_5(const char *line, const char *word, int pos, int state)
-{
- return complete_span_helper(line,word,pos,state,4);
-}
-
-static char *handle_pri_unset_debug_file(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
-{
- switch (cmd) {
- case CLI_INIT:
- e->command = "pri unset debug file";
- e->usage = "Usage: pri unset debug file\n"
- " Stop sending debug output to the previously \n"
- " specified file\n";
- return NULL;
- case CLI_GENERATE:
- return NULL;
- }
- /* Assume it is unset */
- ast_mutex_lock(&pridebugfdlock);
- close(pridebugfd);
- pridebugfd = -1;
- ast_cli(a->fd, "PRI debug output to file disabled\n");
- ast_mutex_unlock(&pridebugfdlock);
- return CLI_SUCCESS;
-}
-
static char *handle_pri_set_debug_file(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
int myfd;
@@ -11670,92 +11644,29 @@ static char *handle_pri_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_a
{
int span;
int x;
+ int level = 0;
switch (cmd) {
case CLI_INIT:
- e->command = "pri debug span";
+ e->command = "pri set debug {<level>|on|off} span";
e->usage =
- "Usage: pri debug span <span>\n"
+ "Usage: pri set debug <level|on|off> span <span>\n"
" Enables debugging on a given PRI span\n";
return NULL;
case CLI_GENERATE:
return complete_span_4(a->line, a->word, a->pos, a->n);
}
- if (a->argc < 4) {
- return CLI_SHOWUSAGE;
- }
- span = atoi(a->argv[3]);
- if ((span < 1) || (span > NUM_SPANS)) {
- ast_cli(a->fd, "Invalid span %s. Should be a number %d to %d\n", a->argv[3], 1, NUM_SPANS);
- return CLI_SUCCESS;
- }
- if (!pris[span-1].pri) {
- ast_cli(a->fd, "No PRI running on span %d\n", span);
- return CLI_SUCCESS;
- }
- for (x = 0; x < NUM_DCHANS; x++) {
- if (pris[span-1].dchans[x])
- pri_set_debug(pris[span-1].dchans[x], PRI_DEBUG_APDU |
- PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q931_STATE |
- PRI_DEBUG_Q921_STATE);
- }
- ast_cli(a->fd, "Enabled debugging on span %d\n", span);
- return CLI_SUCCESS;
-}
-
-
-
-static char *handle_pri_no_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
-{
- int span;
- int x;
- switch (cmd) {
- case CLI_INIT:
- e->command = "pri no debug span";
- e->usage =
- "Usage: pri no debug span <span>\n"
- " Disables debugging on a given PRI span\n";
- return NULL;
- case CLI_GENERATE:
- return complete_span_5(a->line, a->word, a->pos, a->n);
- }
- if (a->argc < 5)
+ if (a->argc < 6) {
return CLI_SHOWUSAGE;
-
- span = atoi(a->argv[4]);
- if ((span < 1) || (span > NUM_SPANS)) {
- ast_cli(a->fd, "Invalid span %s. Should be a number %d to %d\n", a->argv[4], 1, NUM_SPANS);
- return CLI_SUCCESS;
- }
- if (!pris[span-1].pri) {
- ast_cli(a->fd, "No PRI running on span %d\n", span);
- return CLI_SUCCESS;
- }
- for (x = 0; x < NUM_DCHANS; x++) {
- if (pris[span-1].dchans[x])
- pri_set_debug(pris[span-1].dchans[x], 0);
}
- ast_cli(a->fd, "Disabled debugging on span %d\n", span);
- return CLI_SUCCESS;
-}
-static char *handle_pri_really_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
-{
- int span;
- int x;
- switch (cmd) {
- case CLI_INIT:
- e->command = "pri intensive debug span";
- e->usage =
- "Usage: pri intensive debug span <span>\n"
- " Enables debugging down to the Q.921 level\n";
- return NULL;
- case CLI_GENERATE:
- return complete_span_5(a->line, a->word, a->pos, a->n);
+ if (!strcasecmp(a->argv[4], "on")) {
+ level = 1;
+ } else if (!strcasecmp(a->argv[4], "off")) {
+ level = 0;
+ } else {
+ level = atoi(a->argv[4]);
}
-
- if (a->argc < 5)
- return CLI_SHOWUSAGE;
- span = atoi(a->argv[4]);
+ span = atoi(a->argv[5]);
if ((span < 1) || (span > NUM_SPANS)) {
ast_cli(a->fd, "Invalid span %s. Should be a number %d to %d\n", a->argv[4], 1, NUM_SPANS);
return CLI_SUCCESS;
@@ -11765,12 +11676,28 @@ static char *handle_pri_really_debug(struct ast_cli_entry *e, int cmd, struct as
return CLI_SUCCESS;
}
for (x = 0; x < NUM_DCHANS; x++) {
- if (pris[span-1].dchans[x])
- pri_set_debug(pris[span-1].dchans[x], PRI_DEBUG_APDU |
- PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q931_STATE |
- PRI_DEBUG_Q921_RAW | PRI_DEBUG_Q921_DUMP | PRI_DEBUG_Q921_STATE);
+ if (pris[span-1].dchans[x]) {
+ if (level == 1) {
+ pri_set_debug(pris[span-1].dchans[x], PRI_DEBUG_APDU |
+ PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q931_STATE |
+ PRI_DEBUG_Q921_STATE);
+ ast_cli(a->fd, "Enabled debugging on span %d\n", span);
+ } else if (level == 0) {
+ pri_set_debug(pris[span-1].dchans[x], 0);
+ //close the file if it's set
+ ast_mutex_lock(&pridebugfdlock);
+ close(pridebugfd);
+ pridebugfd = -1;
+ ast_cli(a->fd, "PRI debug output to file disabled\n");
+ ast_mutex_unlock(&pridebugfdlock);
+ } else {
+ pri_set_debug(pris[span-1].dchans[x], PRI_DEBUG_APDU |
+ PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q931_STATE |
+ PRI_DEBUG_Q921_RAW | PRI_DEBUG_Q921_DUMP | PRI_DEBUG_Q921_STATE);
+ ast_cli(a->fd, "Enabled debugging on span %d\n", span);
+ }
+ }
}
- ast_cli(a->fd, "Enabled EXTENSIVE debugging on span %d\n", span);
return CLI_SUCCESS;
}
@@ -11935,13 +11862,10 @@ static char *handle_pri_version(struct ast_cli_entry *e, int cmd, struct ast_cli
static struct ast_cli_entry dahdi_pri_cli[] = {
AST_CLI_DEFINE(handle_pri_debug, "Enables PRI debugging on a span"),
- AST_CLI_DEFINE(handle_pri_no_debug, "Disables PRI debugging on a span"),
- AST_CLI_DEFINE(handle_pri_really_debug, "Enables REALLY INTENSE PRI debugging"),
AST_CLI_DEFINE(handle_pri_show_spans, "Displays PRI Information"),
AST_CLI_DEFINE(handle_pri_show_span, "Displays PRI Information"),
AST_CLI_DEFINE(handle_pri_show_debug, "Displays current PRI debug settings"),
AST_CLI_DEFINE(handle_pri_set_debug_file, "Sends PRI debug output to the specified file"),
- AST_CLI_DEFINE(handle_pri_unset_debug_file, "Ends PRI debug output to file"),
AST_CLI_DEFINE(handle_pri_version, "Displays libpri version"),
};
@@ -13151,65 +13075,40 @@ static int linkset_addsigchan(int sigchan)
return 0;
}
-static char *handle_ss7_no_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
-{
- int span;
- switch (cmd) {
- case CLI_INIT:
- e->command = "ss7 no debug linkset";
- e->usage =
- "Usage: ss7 no debug linkset <span>\n"
- " Disables debugging on a given SS7 linkset\n";
- return NULL;
- case CLI_GENERATE:
- return NULL;
- }
- if (a->argc < 5)
- return CLI_SHOWUSAGE;
- span = atoi(a->argv[4]);
- if ((span < 1) || (span > NUM_SPANS)) {
- ast_cli(a->fd, "Invalid linkset %s. Should be a number from %d to %d\n", a->argv[4], 1, NUM_SPANS);
- return CLI_SUCCESS;
- }
- if (!linksets[span-1].ss7) {
- ast_cli(a->fd, "No SS7 running on linkset %d\n", span);
- return CLI_SUCCESS;
- }
- if (linksets[span-1].ss7)
- ss7_set_debug(linksets[span-1].ss7, 0);
-
- ast_cli(a->fd, "Disabled debugging on linkset %d\n", span);
- return CLI_SUCCESS;
-}
-
static char *handle_ss7_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
int span;
switch (cmd) {
case CLI_INIT:
- e->command = "ss7 debug linkset";
+ e->command = "ss7 set debug {on|off} linkset";
e->usage =
- "Usage: ss7 debug linkset <linkset>\n"
+ "Usage: ss7 set debug {on|off} linkset <linkset>\n"
" Enables debugging on a given SS7 linkset\n";
return NULL;
case CLI_GENERATE:
return NULL;
}
- if (a->argc < 4)
+ if (a->argc < 6)
return CLI_SHOWUSAGE;
- span = atoi(a->argv[3]);
+ span = atoi(a->argv[5]);
if ((span < 1) || (span > NUM_SPANS)) {
- ast_cli(a->fd, "Invalid linkset %s. Should be a number from %d to %d\n", a->argv[3], 1, NUM_SPANS);
+ ast_cli(a->fd, "Invalid linkset %s. Should be a number from %d to %d\n", a->argv[5], 1, NUM_SPANS);
return CLI_SUCCESS;
}
if (!linksets[span-1].ss7) {
ast_cli(a->fd, "No SS7 running on linkset %d\n", span);
return CLI_SUCCESS;
}
- if (linksets[span-1].ss7)
- ss7_set_debug(linksets[span-1].ss7, SS7_DEBUG_MTP2 | SS7_DEBUG_MTP3 | SS7_DEBUG_ISUP);
+ if (linksets[span-1].ss7) {
+ if (strcasecmp(a->argv[4], "on")) {
+ ss7_set_debug(linksets[span-1].ss7, SS7_DEBUG_MTP2 | SS7_DEBUG_MTP3 | SS7_DEBUG_ISUP);
+ ast_cli(a->fd, "Enabled debugging on linkset %d\n", span);
+ } else {
+ ss7_set_debug(linksets[span-1].ss7, 0);
+ ast_cli(a->fd, "Disabled debugging on linkset %d\n", span);
+ }
+ }
- ast_cli(a->fd, "Enabled debugging on linkset %d\n", span);
return CLI_SUCCESS;
}
@@ -13470,7 +13369,6 @@ static char *handle_ss7_version(struct ast_cli_entry *e, int cmd, struct ast_cli
static struct ast_cli_entry dahdi_ss7_cli[] = {
AST_CLI_DEFINE(handle_ss7_debug, "Enables SS7 debugging on a linkset"),
- AST_CLI_DEFINE(handle_ss7_no_debug, "Disables SS7 debugging on a linkset"),
AST_CLI_DEFINE(handle_ss7_block_cic, "Blocks the given CIC"),
AST_CLI_DEFINE(handle_ss7_unblock_cic, "Unblocks the given CIC"),
AST_CLI_DEFINE(handle_ss7_block_linkset, "Blocks all CICs on a linkset"),
diff --git a/channels/chan_features.c b/channels/chan_features.c
index 3c41eb73e..5da503f4c 100644
--- a/channels/chan_features.c
+++ b/channels/chan_features.c
@@ -501,9 +501,9 @@ static char *features_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args
switch (cmd) {
case CLI_INIT:
- e->command = "feature show channels";
+ e->command = "features show channels";
e->usage =
- "Usage: feature show channels\n"
+ "Usage: features show channels\n"
" Provides summary information on feature channels.\n";
return NULL;
case CLI_GENERATE:
diff --git a/channels/chan_h323.c b/channels/chan_h323.c
index 36f8cd5eb..b374aff0f 100644
--- a/channels/chan_h323.c
+++ b/channels/chan_h323.c
@@ -2619,16 +2619,16 @@ static char *handle_cli_h323_set_trace(struct ast_cli_entry *e, int cmd, struct
{
switch (cmd) {
case CLI_INIT:
- e->command = "h323 set trace [off]";
+ e->command = "h323 set trace [on|off]";
e->usage =
- "Usage: h323 set trace (off|<trace level>)\n"
+ "Usage: h323 set trace (on|off|<trace level>)\n"
" Enable/Disable H.323 stack tracing for debugging purposes\n";
return NULL;
case CLI_GENERATE:
return NULL;
}
- if (a->argc != 4)
+ if (a->argc != e->args)
return CLI_SHOWUSAGE;
if (!strcasecmp(a->argv[3], "off")) {
h323_debug(0, 0);
@@ -2645,21 +2645,21 @@ static char *handle_cli_h323_set_debug(struct ast_cli_entry *e, int cmd, struct
{
switch (cmd) {
case CLI_INIT:
- e->command = "h323 set debug [off]";
+ e->command = "h323 set debug [on|off]";
e->usage =
- "Usage: h323 set debug [off]\n"
+ "Usage: h323 set debug [on|off]\n"
" Enable/Disable H.323 debugging output\n";
return NULL;
case CLI_GENERATE:
return NULL;
}
- if (a->argc < 3 || a->argc > 4)
+ if (a->argc != e->args)
return CLI_SHOWUSAGE;
- if (a->argc == 4 && strcasecmp(a->argv[3], "off"))
+ if (strcasecmp(a->argv[3], "on") && strcasecmp(a->argv[3], "off"))
return CLI_SHOWUSAGE;
- h323debug = (a->argc == 3) ? 1 : 0;
+ h323debug = (strcasecmp(a->argv[3], "on")) ? 0 : 1;
ast_cli(a->fd, "H.323 Debugging %s\n", h323debug ? "Enabled" : "Disabled");
return CLI_SUCCESS;
}
diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c
index 5cec653cb..3d3da0c42 100644
--- a/channels/chan_misdn.c
+++ b/channels/chan_misdn.c
@@ -736,9 +736,9 @@ static char *handle_cli_misdn_set_debug(struct ast_cli_entry *e, int cmd, struct
switch (cmd) {
case CLI_INIT:
- e->command = "misdn set debug";
+ e->command = "misdn set debug {on|off|<level>}";
e->usage =
- "Usage: misdn set debug <level> [only] | [port <port> [only]]\n"
+ "Usage: misdn set debug {on|off|<level>} [only] | [port <port> [only]]\n"
" Set the debug level of the mISDN channel.\n";
return NULL;
case CLI_GENERATE:
@@ -747,8 +747,14 @@ static char *handle_cli_misdn_set_debug(struct ast_cli_entry *e, int cmd, struct
if (a->argc < 4 || a->argc > 7)
return CLI_SHOWUSAGE;
-
- level = atoi(a->argv[3]);
+
+ if (!strcasecmp(a->argv[3], "on")) {
+ level = 1;
+ } else if (!strcasecmp(a->argv[3], "off")) {
+ level = 0;
+ } else {
+ level = atoi(a->argv[3]);
+ }
switch (a->argc) {
case 4:
diff --git a/channels/chan_oss.c b/channels/chan_oss.c
index 20be029d3..ae4137c64 100644
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -911,9 +911,9 @@ static char *console_autoanswer(struct ast_cli_entry *e, int cmd, struct ast_cli
switch (cmd) {
case CLI_INIT:
- e->command = "console autoanswer [on|off]";
+ e->command = "console {set|show} autoanswer [on|off]";
e->usage =
- "Usage: console autoanswer [on|off]\n"
+ "Usage: console {set|show} autoanswer [on|off]\n"
" Enables or disables autoanswer feature. If used without\n"
" argument, displays the current on/off status of autoanswer.\n"
" The default value of autoanswer is in 'oss.conf'.\n";
@@ -1200,7 +1200,7 @@ static char *console_active(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
{
switch (cmd) {
case CLI_INIT:
- e->command = "console active";
+ e->command = "console {set|show} active [<device>]";
e->usage =
"Usage: console active [device]\n"
" If used without a parameter, displays which device is the current\n"
@@ -1211,20 +1211,20 @@ static char *console_active(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
return NULL;
}
- if (a->argc == 2)
+ if (a->argc == 3)
ast_cli(a->fd, "active console is [%s]\n", oss_active);
- else if (a->argc != 3)
+ else if (a->argc != 4)
return CLI_SHOWUSAGE;
else {
struct chan_oss_pvt *o;
- if (strcmp(a->argv[2], "show") == 0) {
+ if (strcmp(a->argv[3], "show") == 0) {
for (o = oss_default.next; o; o = o->next)
ast_cli(a->fd, "device [%s] exists\n", o->name);
return CLI_SUCCESS;
}
- o = find_desc(a->argv[2]);
+ o = find_desc(a->argv[3]);
if (o == NULL)
- ast_cli(a->fd, "No device [%s] exists\n", a->argv[2]);
+ ast_cli(a->fd, "No device [%s] exists\n", a->argv[3]);
else
oss_active = o->name;
}
diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c
index 48a41fc7a..bd15f2896 100644
--- a/channels/chan_unistim.c
+++ b/channels/chan_unistim.c
@@ -4682,9 +4682,9 @@ static char *unistim_info(struct ast_cli_entry *e, int cmd, struct ast_cli_args
switch (cmd) {
case CLI_INIT:
- e->command = "unistim info";
+ e->command = "unistim show info";
e->usage =
- "Usage: unistim info\n"
+ "Usage: unistim show info\n"
" Dump internal structures.\n";
return NULL;
@@ -4751,27 +4751,27 @@ static char *unistim_sp(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a
switch (cmd) {
case CLI_INIT:
- e->command = "unistim sp";
+ e->command = "unistim send packet";
e->usage =
- "Usage: unistim sp USTM/line@name hexa\n"
- " unistim sp USTM/1000@hans 19040004\n";
+ "Usage: unistim send packet USTM/line@name hexa\n"
+ " unistim send packet USTM/1000@hans 19040004\n";
return NULL;
case CLI_GENERATE:
return NULL; /* no completion */
}
- if (a->argc < 4)
+ if (a->argc < 5)
return CLI_SHOWUSAGE;
- if (strlen(a->argv[2]) < 9)
+ if (strlen(a->argv[3]) < 9)
return CLI_SHOWUSAGE;
- len = strlen(a->argv[3]);
+ len = strlen(a->argv[4]);
if (len % 2)
return CLI_SHOWUSAGE;
- ast_copy_string(tmp, a->argv[2] + 5, sizeof(tmp));
+ ast_copy_string(tmp, a->argv[3] + 5, sizeof(tmp));
sub = find_subchannel_by_name(tmp);
if (!sub) {
ast_cli(a->fd, "Can't find '%s'\n", tmp);
@@ -4781,15 +4781,15 @@ static char *unistim_sp(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a
ast_cli(a->fd, "'%s' is not connected\n", tmp);
return CLI_SUCCESS;
}
- ast_cli(a->fd, "Sending '%s' to %s (%p)\n", a->argv[3], tmp, sub->parent->parent->session);
+ ast_cli(a->fd, "Sending '%s' to %s (%p)\n", a->argv[4], tmp, sub->parent->parent->session);
for (i = 0; i < len; i++) {
- c = a->argv[3][i];
+ c = a->argv[4][i];
if (c >= 'a')
c -= 'a' - 10;
else
c -= '0';
i++;
- cc = a->argv[3][i];
+ cc = a->argv[4][i];
if (cc >= 'a')
cc -= 'a' - 10;
else
diff --git a/main/astobj2.c b/main/astobj2.c
index c66501068..b80c407d0 100644
--- a/main/astobj2.c
+++ b/main/astobj2.c
@@ -862,9 +862,9 @@ static char *handle_astobj2_stats(struct ast_cli_entry *e, int cmd, struct ast_c
{
switch (cmd) {
case CLI_INIT:
- e->command = "astobj2 stats";
- e->usage = "Usage: astobj2 stats\n"
- " Show astobj2 stats\n";
+ e->command = "astobj2 show stats";
+ e->usage = "Usage: astobj2 show stats\n"
+ " Show astobj2 show stats\n";
return NULL;
case CLI_GENERATE:
return NULL;
diff --git a/main/cli.c b/main/cli.c
index f07d8b015..be62352b0 100644
--- a/main/cli.c
+++ b/main/cli.c
@@ -756,18 +756,18 @@ static char *handle_softhangup(struct ast_cli_entry *e, int cmd, struct ast_cli_
switch (cmd) {
case CLI_INIT:
- e->command = "soft hangup";
+ e->command = "channel request hangup";
e->usage =
- "Usage: soft hangup <channel>\n"
+ "Usage: channel request hangup <channel>\n"
" Request that a channel be hung up. The hangup takes effect\n"
" the next time the driver reads or writes from the channel\n";
return NULL;
case CLI_GENERATE:
return ast_complete_channels(a->line, a->word, a->pos, a->n, 2);
}
- if (a->argc != 3)
+ if (a->argc != 4)
return CLI_SHOWUSAGE;
- c = ast_get_channel_by_name_locked(a->argv[2]);
+ c = ast_get_channel_by_name_locked(a->argv[3]);
if (c) {
ast_cli(a->fd, "Requested Hangup on channel '%s'\n", c->name);
ast_softhangup(c, AST_SOFTHANGUP_EXPLICIT);
diff --git a/main/manager.c b/main/manager.c
index 7d57eb673..ee93dad36 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -519,18 +519,18 @@ static char *handle_mandebug(struct ast_cli_entry *e, int cmd, struct ast_cli_ar
{
switch (cmd) {
case CLI_INIT:
- e->command = "manager debug [on|off]";
- e->usage = "Usage: manager debug [on|off]\n Show, enable, disable debugging of the manager code.\n";
+ e->command = "manager set debug [on|off]";
+ e->usage = "Usage: manager set debug [on|off]\n Show, enable, disable debugging of the manager code.\n";
return NULL;
case CLI_GENERATE:
return NULL;
}
- if (a->argc == 2)
+ if (a->argc == 3)
ast_cli(a->fd, "manager debug is %s\n", manager_debug? "on" : "off");
- else if (a->argc == 3) {
- if (!strcasecmp(a->argv[2], "on"))
+ else if (a->argc == 4) {
+ if (!strcasecmp(a->argv[3], "on"))
manager_debug = 1;
- else if (!strcasecmp(a->argv[2], "off"))
+ else if (!strcasecmp(a->argv[3], "off"))
manager_debug = 0;
else
return CLI_SHOWUSAGE;
diff --git a/main/taskprocessor.c b/main/taskprocessor.c
index 450d579c1..6ed939b45 100644
--- a/main/taskprocessor.c
+++ b/main/taskprocessor.c
@@ -196,9 +196,9 @@ static char *cli_tps_ping(struct ast_cli_entry *e, int cmd, struct ast_cli_args
switch (cmd) {
case CLI_INIT:
- e->command = "core taskprocessor ping";
+ e->command = "core ping taskprocessor";
e->usage =
- "Usage: core taskprocessor ping <taskprocessor>\n"
+ "Usage: core ping taskprocessor <taskprocessor>\n"
" Displays the time required for a task to be processed\n";
return NULL;
case CLI_GENERATE:
diff --git a/res/ais/clm.c b/res/ais/clm.c
index 5d7a356be..9788c263f 100644
--- a/res/ais/clm.c
+++ b/res/ais/clm.c
@@ -78,9 +78,9 @@ static char *ais_clm_show_members(struct ast_cli_entry *e, int cmd, struct ast_c
switch (cmd) {
case CLI_INIT:
- e->command = "ais clm show members";
+ e->command = "ais show clm members";
e->usage =
- "Usage: ais clm show members\n"
+ "Usage: ais show clm members\n"
" List members of the cluster using the CLM (Cluster Membership) service.\n";
return NULL;
diff --git a/res/ais/evt.c b/res/ais/evt.c
index 0057f0481..2965df0e3 100644
--- a/res/ais/evt.c
+++ b/res/ais/evt.c
@@ -271,9 +271,9 @@ static char *ais_evt_show_event_channels(struct ast_cli_entry *e, int cmd, struc
switch (cmd) {
case CLI_INIT:
- e->command = "ais evt show event channels";
+ e->command = "ais show evt event channels";
e->usage =
- "Usage: ais evt show event channels\n"
+ "Usage: ais show evt event channels\n"
" List configured event channels for the (EVT) Eventing service.\n";
return NULL;
diff --git a/res/res_agi.c b/res/res_agi.c
index 02b666c38..d5cd0961f 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -86,7 +86,7 @@ static char *descrip =
"AGISIGHUP channel variable to \"no\" before executing the AGI application.\n"
" Using 'EAGI' provides enhanced AGI, with incoming audio available out of band\n"
"on file descriptor 3.\n\n"
-" Use the CLI command 'agi show' to list available agi commands.\n"
+" Use the CLI command 'agi show commnands' to list available agi commands.\n"
" This application sets the following channel variable upon completion:\n"
" AGISTATUS The status of the attempt to the run the AGI script\n"
" text string, one of SUCCESS | FAILURE | NOTFOUND | HANGUP\n";
@@ -2727,9 +2727,9 @@ static char *handle_cli_agi_show(struct ast_cli_entry *e, int cmd, struct ast_cl
switch (cmd) {
case CLI_INIT:
- e->command = "agi show";
+ e->command = "agi show commands [topic]";
e->usage =
- "Usage: agi show [topic]\n"
+ "Usage: agi show commands [topic]\n"
" When called with a topic as an argument, displays usage\n"
" information on the given command. If called without a\n"
" topic, it provides a list of AGI commands.\n";
diff --git a/res/res_clioriginate.c b/res/res_clioriginate.c
index 6a6371972..1052888dc 100644
--- a/res/res_clioriginate.c
+++ b/res/res_clioriginate.c
@@ -122,26 +122,26 @@ static char *handle_orig(struct ast_cli_entry *e, int cmd, struct ast_cli_args *
char *res;
switch (cmd) {
case CLI_INIT:
- e->command = "originate";
+ e->command = "channel originate";
e->usage =
" There are two ways to use this command. A call can be originated between a\n"
"channel and a specific application, or between a channel and an extension in\n"
"the dialplan. This is similar to call files or the manager originate action.\n"
"Calls originated with this command are given a timeout of 30 seconds.\n\n"
- "Usage1: originate <tech/data> application <appname> [appdata]\n"
+ "Usage1: channel originate <tech/data> application <appname> [appdata]\n"
" This will originate a call between the specified channel tech/data and the\n"
"given application. Arguments to the application are optional. If the given\n"
"arguments to the application include spaces, all of the arguments to the\n"
"application need to be placed in quotation marks.\n\n"
- "Usage2: originate <tech/data> extension [exten@][context]\n"
+ "Usage2: channel originate <tech/data> extension [exten@][context]\n"
" This will originate a call between the specified channel tech/data and the\n"
"given extension. If no context is specified, the 'default' context will be\n"
"used. If no extension is given, the 's' extension will be used.\n";
return NULL;
case CLI_GENERATE:
- if (a->pos != 2)
+ if (a->pos != 3)
return NULL;
/* ugly, can be removed when CLI entries have ast_module pointers */
@@ -152,18 +152,20 @@ static char *handle_orig(struct ast_cli_entry *e, int cmd, struct ast_cli_args *
return res;
}
- if (ast_strlen_zero(a->argv[1]) || ast_strlen_zero(a->argv[2]))
+ if (ast_strlen_zero(a->argv[2]) || ast_strlen_zero(a->argv[3]))
return CLI_SHOWUSAGE;
/* ugly, can be removed when CLI entries have ast_module pointers */
ast_module_ref(ast_module_info->self);
- if (!strcasecmp("application", a->argv[2])) {
- res = orig_app(a->fd, a->argv[1], a->argv[3], a->argv[4]);
- } else if (!strcasecmp("extension", a->argv[2])) {
- res = orig_exten(a->fd, a->argv[1], a->argv[3]);
- } else
+ if (!strcasecmp("application", a->argv[3])) {
+ res = orig_app(a->fd, a->argv[2], a->argv[4], a->argv[5]);
+ } else if (!strcasecmp("extension", a->argv[3])) {
+ res = orig_exten(a->fd, a->argv[2], a->argv[4]);
+ } else {
+ ast_log(LOG_WARNING, "else");
res = CLI_SHOWUSAGE;
+ }
ast_module_unref(ast_module_info->self);
diff --git a/res/res_config_ldap.c b/res/res_config_ldap.c
index 916ce8fe7..966da9eea 100644
--- a/res/res_config_ldap.c
+++ b/res/res_config_ldap.c
@@ -1529,9 +1529,9 @@ static char *realtime_ldap_status(struct ast_cli_entry *e, int cmd, struct ast_c
switch (cmd) {
case CLI_INIT:
- e->command = "realtime ldap status";
+ e->command = "realtime show ldap status";
e->usage =
- "Usage: realtime ldap status\n"
+ "Usage: realtime show ldap status\n"
" Shows connection information for the LDAP RealTime driver\n";
return NULL;
case CLI_GENERATE:
diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c
index 5ef6cf67b..f7c1f3a6a 100644
--- a/res/res_config_pgsql.c
+++ b/res/res_config_pgsql.c
@@ -1315,13 +1315,13 @@ static char *handle_cli_realtime_pgsql_cache(struct ast_cli_entry *e, int cmd, s
switch (cmd) {
case CLI_INIT:
- e->command = "realtime pgsql cache";
+ e->command = "realtime show pgsql cache";
e->usage =
- "Usage: realtime pgsql cache [<table>]\n"
+ "Usage: realtime show pgsql cache [<table>]\n"
" Shows table cache for the PostgreSQL RealTime driver\n";
return NULL;
case CLI_GENERATE:
- if (a->argc != 3) {
+ if (a->argc != 4) {
return NULL;
}
l = strlen(a->word);
@@ -1337,25 +1337,25 @@ static char *handle_cli_realtime_pgsql_cache(struct ast_cli_entry *e, int cmd, s
return ret;
}
- if (a->argc == 3) {
+ if (a->argc == 4) {
/* List of tables */
AST_LIST_LOCK(&psql_tables);
AST_LIST_TRAVERSE(&psql_tables, cur, list) {
ast_cli(a->fd, "%s\n", cur->name);
}
AST_LIST_UNLOCK(&psql_tables);
- } else if (a->argc == 4) {
+ } else if (a->argc == 5) {
/* List of columns */
- if ((cur = find_table(a->argv[3]))) {
+ if ((cur = find_table(a->argv[4]))) {
struct columns *col;
- ast_cli(a->fd, "Columns for Table Cache '%s':\n", a->argv[3]);
+ ast_cli(a->fd, "Columns for Table Cache '%s':\n", a->argv[4]);
ast_cli(a->fd, "%-20.20s %-20.20s %-3.3s %-8.8s\n", "Name", "Type", "Len", "Nullable");
AST_LIST_TRAVERSE(&cur->columns, col, list) {
ast_cli(a->fd, "%-20.20s %-20.20s %3d %-8.8s\n", col->name, col->type, col->len, col->notnull ? "NOT NULL" : "");
}
ast_mutex_unlock(&cur->lock);
} else {
- ast_cli(a->fd, "No such table '%s'\n", a->argv[3]);
+ ast_cli(a->fd, "No such table '%s'\n", a->argv[4]);
}
}
return 0;
@@ -1368,16 +1368,16 @@ static char *handle_cli_realtime_pgsql_status(struct ast_cli_entry *e, int cmd,
switch (cmd) {
case CLI_INIT:
- e->command = "realtime pgsql status";
+ e->command = "realtime show pgsql status";
e->usage =
- "Usage: realtime pgsql status\n"
+ "Usage: realtime show pgsql status\n"
" Shows connection information for the PostgreSQL RealTime driver\n";
return NULL;
case CLI_GENERATE:
return NULL;
}
- if (a->argc != 3)
+ if (a->argc != 4)
return CLI_SHOWUSAGE;
if (pgsqlConn && PQstatus(pgsqlConn) == CONNECTION_OK) {
diff --git a/res/res_limit.c b/res/res_limit.c
index b1cf025b0..35bd9d3dc 100644
--- a/res/res_limit.c
+++ b/res/res_limit.c
@@ -44,22 +44,23 @@ static struct limits {
int resource;
char limit[3];
char desc[40];
+ char clicmd[15];
} limits[] = {
- { RLIMIT_CPU, "-t", "cpu time" },
- { RLIMIT_FSIZE, "-f", "file size" },
- { RLIMIT_DATA, "-d", "program data segment" },
- { RLIMIT_STACK, "-s", "program stack size" },
- { RLIMIT_CORE, "-c", "core file size" },
+ { RLIMIT_CPU, "-t", "cpu time", "time" },
+ { RLIMIT_FSIZE, "-f", "file size" , "file" },
+ { RLIMIT_DATA, "-d", "program data segment", "data" },
+ { RLIMIT_STACK, "-s", "program stack size", "stack" },
+ { RLIMIT_CORE, "-c", "core file size", "core" },
#ifdef RLIMIT_RSS
- { RLIMIT_RSS, "-m", "resident memory" },
- { RLIMIT_MEMLOCK, "-l", "amount of memory locked into RAM" },
+ { RLIMIT_RSS, "-m", "resident memory", "memory" },
+ { RLIMIT_MEMLOCK, "-l", "amount of memory locked into RAM", "locked" },
#endif
#ifdef RLIMIT_NPROC
- { RLIMIT_NPROC, "-u", "number of processes" },
+ { RLIMIT_NPROC, "-u", "number of processes", "processes" },
#endif
- { RLIMIT_NOFILE, "-n", "number of file descriptors" },
+ { RLIMIT_NOFILE, "-n", "number of file descriptors", "descriptors" },
#ifdef VMEM_DEF
- { VMEM_DEF, "-v", "virtual memory" },
+ { VMEM_DEF, "-v", "virtual memory", "virtual" },
#endif
};
@@ -67,7 +68,7 @@ static int str2limit(const char *string)
{
size_t i;
for (i = 0; i < ARRAY_LEN(limits); i++) {
- if (!strcasecmp(string, limits[i].limit))
+ if (!strcasecmp(string, limits[i].clicmd))
return limits[i].resource;
}
return -1;
@@ -77,7 +78,7 @@ static const char *str2desc(const char *string)
{
size_t i;
for (i = 0; i < ARRAY_LEN(limits); i++) {
- if (!strcmp(string, limits[i].limit))
+ if (!strcmp(string, limits[i].clicmd))
return limits[i].desc;
}
return "<unknown>";
@@ -91,9 +92,9 @@ static char *complete_ulimit(struct ast_cli_args *a)
if (a->pos > 1)
return NULL;
for (i = 0; i < ARRAY_LEN(limits); i++) {
- if (!strncasecmp(limits[i].limit, a->word, wordlen)) {
+ if (!strncasecmp(limits[i].clicmd, a->word, wordlen)) {
if (++which > a->n)
- return ast_strdup(limits[i].limit);
+ return ast_strdup(limits[i].clicmd);
}
}
return NULL;
@@ -108,41 +109,41 @@ static char *handle_cli_ulimit(struct ast_cli_entry *e, int cmd, struct ast_cli_
case CLI_INIT:
e->command = "ulimit";
e->usage =
- "Usage: ulimit {-d|"
+ "Usage: ulimit {data|"
#ifdef RLIMIT_RSS
- "-l|"
+ "limit|"
#endif
- "-f|"
+ "file|"
#ifdef RLIMIT_RSS
- "-m|"
+ "memory|"
#endif
- "-s|-t|"
+ "stack|time|"
#ifdef RLIMIT_NPROC
- "-u|"
+ "processes|"
#endif
#ifdef VMEM_DEF
- "-v|"
+ "virtual|"
#endif
- "-c|-n} [<num>]\n"
+ "core|descriptors} [<num>]\n"
" Shows or sets the corresponding resource limit.\n"
- " -d Process data segment [readonly]\n"
+ " data Process data segment [readonly]\n"
#ifdef RLIMIT_RSS
- " -l Memory lock size [readonly]\n"
+ " lock Memory lock size [readonly]\n"
#endif
- " -f File size\n"
+ " file File size\n"
#ifdef RLIMIT_RSS
- " -m Process resident memory [readonly]\n"
+ " memory Process resident memory [readonly]\n"
#endif
- " -s Process stack size [readonly]\n"
- " -t CPU usage [readonly]\n"
+ " stack Process stack size [readonly]\n"
+ " time CPU usage [readonly]\n"
#ifdef RLIMIT_NPROC
- " -u Child processes\n"
+ " processes Child processes\n"
#endif
#ifdef VMEM_DEF
- " -v Process virtual memory [readonly]\n"
+ " virtual Process virtual memory [readonly]\n"
#endif
- " -c Core dump file size\n"
- " -n Number of file descriptors\n";
+ " core Core dump file size\n"
+ " descriptors Number of file descriptors\n";
return NULL;
case CLI_GENERATE:
return complete_ulimit(a);
@@ -152,11 +153,11 @@ static char *handle_cli_ulimit(struct ast_cli_entry *e, int cmd, struct ast_cli_
return CLI_SHOWUSAGE;
if (a->argc == 1) {
- char arg2[3];
+ char arg2[15];
char *newargv[2] = { "ulimit", arg2 };
for (resource = 0; resource < ARRAY_LEN(limits); resource++) {
struct ast_cli_args newArgs = { .argv = newargv, .argc = 2 };
- ast_copy_string(arg2, limits[resource].limit, sizeof(arg2));
+ ast_copy_string(arg2, limits[resource].clicmd, sizeof(arg2));
handle_cli_ulimit(e, CLI_HANDLER, &newArgs);
}
return CLI_SUCCESS;