aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_agi.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-09-18 19:54:18 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-09-18 19:54:18 +0000
commit5aacb6a82d4cf625774fa1ea39ca193a3be73b35 (patch)
treecf63baa167f81c95d3dbf417f83681851decad80 /res/res_agi.c
parent4de5810a0530bca0665eadcfb06ef06fd2e86758 (diff)
merge qwell's CLI verbification work
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43212 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_agi.c')
-rw-r--r--res/res_agi.c70
1 files changed, 47 insertions, 23 deletions
diff --git a/res/res_agi.c b/res/res_agi.c
index edcda4e60..7794449aa 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -1302,7 +1302,7 @@ static char debug_usage[] =
" Enables dumping of AGI transactions for debugging purposes\n";
static char no_debug_usage[] =
-"Usage: agi no debug\n"
+"Usage: agi nodebug\n"
" Disables dumping of AGI transactions for debugging purposes\n";
static int agi_do_debug(int fd, int argc, char *argv[])
@@ -1314,7 +1314,7 @@ static int agi_do_debug(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
-static int agi_no_debug(int fd, int argc, char *argv[])
+static int agi_no_debug_deprecated(int fd, int argc, char *argv[])
{
if (argc != 3)
return RESULT_SHOWUSAGE;
@@ -1323,11 +1323,14 @@ static int agi_no_debug(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
-static struct ast_cli_entry cli_debug =
- { { "agi", "debug", NULL }, agi_do_debug, "Enable AGI debugging", debug_usage };
-
-static struct ast_cli_entry cli_no_debug =
- { { "agi", "no", "debug", NULL }, agi_no_debug, "Disable AGI debugging", no_debug_usage };
+static int agi_no_debug(int fd, int argc, char *argv[])
+{
+ if (argc != 2)
+ return RESULT_SHOWUSAGE;
+ agidebug = 0;
+ ast_cli(fd, "AGI Debugging Disabled\n");
+ return RESULT_SUCCESS;
+}
static int handle_noop(struct ast_channel *chan, AGI *agi, int arg, char *argv[])
{
@@ -1924,7 +1927,7 @@ static int handle_showagi(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
-static int handle_dumpagihtml(int fd, int argc, char *argv[])
+static int handle_agidumphtml(int fd, int argc, char *argv[])
{
struct agi_command *e;
char fullcmd[80];
@@ -2080,29 +2083,53 @@ static int deadagi_exec(struct ast_channel *chan, void *data)
}
static char showagi_help[] =
-"Usage: show agi [topic]\n"
+"Usage: agi list [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";
static char dumpagihtml_help[] =
-"Usage: dump agihtml <filename>\n"
+"Usage: agi dumphtml <filename>\n"
" Dumps the agi command list in html format to given filename\n";
-static struct ast_cli_entry showagi =
-{ { "show", "agi", NULL }, handle_showagi, "Show AGI commands or specific help", showagi_help };
-
-static struct ast_cli_entry dumpagihtml =
-{ { "dump", "agihtml", NULL }, handle_dumpagihtml, "Dumps a list of agi command in html format", dumpagihtml_help };
+static struct ast_cli_entry cli_show_agi_deprecated = {
+ { "show", "agi", NULL },
+ handle_showagi, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_dump_agihtml_deprecated = {
+ { "dump", "agihtml", NULL },
+ handle_agidumphtml, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_agi_no_debug_deprecated = {
+ { "agi", "no", "debug", NULL },
+ agi_no_debug_deprecated, NULL,
+ NULL };
+
+static struct ast_cli_entry cli_agi[] = {
+ { { "agi", "debug", NULL },
+ agi_do_debug, "Enable AGI debugging",
+ debug_usage },
+
+ { { "agi", "nodebug", NULL },
+ agi_no_debug, "Disable AGI debugging",
+ no_debug_usage, NULL, &cli_agi_no_debug_deprecated },
+
+ { { "agi", "list", NULL },
+ handle_showagi, "List AGI commands or specific help",
+ showagi_help, NULL, &cli_show_agi_deprecated },
+
+ { { "agi", "dumphtml", NULL },
+ handle_agidumphtml, "Dumps a list of agi commands in html format",
+ dumpagihtml_help, NULL, &cli_dump_agihtml_deprecated },
+};
static int unload_module(void)
{
ast_module_user_hangup_all();
- ast_cli_unregister(&showagi);
- ast_cli_unregister(&dumpagihtml);
- ast_cli_unregister(&cli_debug);
- ast_cli_unregister(&cli_no_debug);
+ ast_cli_unregister_multiple(cli_agi, sizeof(cli_agi) / sizeof(struct ast_cli_entry));
ast_unregister_application(eapp);
ast_unregister_application(deadapp);
return ast_unregister_application(app);
@@ -2110,10 +2137,7 @@ static int unload_module(void)
static int load_module(void)
{
- ast_cli_register(&showagi);
- ast_cli_register(&dumpagihtml);
- ast_cli_register(&cli_debug);
- ast_cli_register(&cli_no_debug);
+ ast_cli_register_multiple(cli_agi, sizeof(cli_agi) / sizeof(struct ast_cli_entry));
ast_register_application(deadapp, deadagi_exec, deadsynopsis, descrip);
ast_register_application(eapp, eagi_exec, esynopsis, descrip);
return ast_register_application(app, agi_exec, synopsis, descrip);