aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_mixmonitor.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-10-11 19:03:06 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-10-11 19:03:06 +0000
commit13b9c5237c9f5b8b3d72634d575665b1d1147ba3 (patch)
tree44dcb2c14abed6932db4f248b17626a01a38f59b /apps/app_mixmonitor.c
parenta8506328befc2a11643cea88772609610ec11c33 (diff)
Merge a ton of NEW_CLI conversions. Thanks to everyone that helped out! :)
(closes issue #10724) Reported by: eliel Patches: chan_skinny.c.patch uploaded by eliel (license 64) chan_oss.c.patch uploaded by eliel (license 64) chan_mgcp.c.patch2 uploaded by eliel (license 64) pbx_config.c.patch uploaded by seanbright (license 71) iax2-provision.c.patch uploaded by eliel (license 64) chan_gtalk.c.patch uploaded by eliel (license 64) pbx_ael.c.patch uploaded by seanbright (license 71) file.c.patch uploaded by seanbright (license 71) image.c.patch uploaded by seanbright (license 71) cli.c.patch uploaded by moy (license 222) astobj2.c.patch uploaded by moy (license 222) asterisk.c.patch uploaded by moy (license 222) res_limit.c.patch uploaded by seanbright (license 71) res_convert.c.patch uploaded by seanbright (license 71) res_crypto.c.patch uploaded by seanbright (license 71) app_osplookup.c.patch uploaded by seanbright (license 71) app_rpt.c.patch uploaded by seanbright (license 71) app_mixmonitor.c.patch uploaded by seanbright (license 71) channel.c.patch uploaded by seanbright (license 71) translate.c.patch uploaded by seanbright (license 71) udptl.c.patch uploaded by seanbright (license 71) threadstorage.c.patch uploaded by seanbright (license 71) db.c.patch uploaded by seanbright (license 71) cdr.c.patch uploaded by moy (license 222) pbd_dundi.c.patch uploaded by moy (license 222) app_osplookup-rev83558.patch uploaded by moy (license 222) res_clioriginate.c.patch uploaded by moy (license 222) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@85460 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_mixmonitor.c')
-rw-r--r--apps/app_mixmonitor.c48
1 files changed, 23 insertions, 25 deletions
diff --git a/apps/app_mixmonitor.c b/apps/app_mixmonitor.c
index 614adcba1..ca775f163 100644
--- a/apps/app_mixmonitor.c
+++ b/apps/app_mixmonitor.c
@@ -362,46 +362,44 @@ static int stop_mixmonitor_exec(struct ast_channel *chan, void *data)
return 0;
}
-static int mixmonitor_cli(int fd, int argc, char **argv)
+static char *handle_cli_mixmonitor(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct ast_channel *chan;
- if (argc < 3)
- return RESULT_SHOWUSAGE;
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "mixmonitor [start|stop]";
+ e->usage =
+ "Usage: mixmonitor <start|stop> <chan_name> [args]\n"
+ " The optional arguments are passed to the MixMonitor\n"
+ " application when the 'start' command is used.\n";
+ return NULL;
+ case CLI_GENERATE:
+ return ast_complete_channels(a->line, a->word, a->pos, a->n, 2);
+ }
+
+ if (a->argc < 3)
+ return CLI_SHOWUSAGE;
- if (!(chan = ast_get_channel_by_name_prefix_locked(argv[2], strlen(argv[2])))) {
- ast_cli(fd, "No channel matching '%s' found.\n", argv[2]);
- return RESULT_SUCCESS;
+ if (!(chan = ast_get_channel_by_name_prefix_locked(a->argv[2], strlen(a->argv[2])))) {
+ ast_cli(a->fd, "No channel matching '%s' found.\n", a->argv[2]);
+ /* Technically this is a failure, but we don't want 2 errors printing out */
+ return CLI_SUCCESS;
}
- if (!strcasecmp(argv[1], "start")) {
- mixmonitor_exec(chan, argv[3]);
+ if (!strcasecmp(a->argv[1], "start")) {
+ mixmonitor_exec(chan, a->argv[3]);
ast_channel_unlock(chan);
} else {
ast_channel_unlock(chan);
ast_audiohook_detach_source(chan, mixmonitor_spy_type);
}
- return RESULT_SUCCESS;
-}
-
-static char *complete_mixmonitor_cli(const char *line, const char *word, int pos, int state)
-{
- char *options[] = {"start", "stop", NULL};
-
- if (pos == 1)
- return ast_cli_complete (word, options, state);
-
- return ast_complete_channels(line, word, pos, state, 2);
+ return CLI_SUCCESS;
}
static struct ast_cli_entry cli_mixmonitor[] = {
- { { "mixmonitor", NULL, NULL },
- mixmonitor_cli, "Execute a MixMonitor command.",
- "mixmonitor <start|stop> <chan_name> [args]\n\n"
- "The optional arguments are passed to the\n"
- "MixMonitor application when the 'start' command is used.\n",
- complete_mixmonitor_cli },
+ NEW_CLI(handle_cli_mixmonitor, "Execute a MixMonitor command")
};
static int unload_module(void)