summaryrefslogtreecommitdiff
path: root/apps
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 /apps
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
Diffstat (limited to 'apps')
-rw-r--r--apps/app_meetme.c63
-rw-r--r--apps/app_mixmonitor.c2
-rw-r--r--apps/app_queue.c8
3 files changed, 59 insertions, 14 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: