aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_mgcp.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-02-08 21:26:32 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-02-08 21:26:32 +0000
commite9d6c2ff9b22167c463b055b65e8351dc0a4cc0c (patch)
tree425b3dafd75451669e2311d091127fe03d3c9693 /channels/chan_mgcp.c
parent381f0dce1439f8c5344300a846760ea930987ed3 (diff)
Merge changes from team/mvanbaak/cli-command-audit
(closes issue #8925) About a year ago, as Leif Madsen and Jim van Meggelen were going over the CLI commands in Asterisk 1.4 for the next version of their book, they documented a lot of inconsistencies. This set of changes addresses all of these issues and has been reviewed by Leif. While this does introduce even more changes to the CLI command structure, it makes everything consistent, which is the most important thing. Thanks to all that helped with this one! git-svn-id: http://svn.digium.com/svn/asterisk/trunk@103171 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_mgcp.c')
-rw-r--r--channels/chan_mgcp.c45
1 files changed, 29 insertions, 16 deletions
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index de7c624be..f4ce2ce6a 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -1139,51 +1139,64 @@ static char *handle_mgcp_audit_endpoint(struct ast_cli_entry *e, int cmd, struct
return CLI_SUCCESS;
}
-static char *handle_mgcp_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+static char *handle_mgcp_set_debug_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
switch (cmd) {
case CLI_INIT:
- e->command = "mgcp set debug";
+ e->command = "mgcp set debug [off]";
e->usage =
- "Usage: mgcp set debug\n"
- " Enables dumping of MGCP packets for debugging purposes\n";
+ "Usage: mgcp set debug [off]\n"
+ " Enables/Disables dumping of MGCP packets for debugging purposes\n";
return NULL;
case CLI_GENERATE:
return NULL;
}
- if (a->argc != 3)
+ if (a->argc < 3 || a->argc > 4)
return CLI_SHOWUSAGE;
- mgcpdebug = 1;
- ast_cli(a->fd, "MGCP Debugging Enabled\n");
+ if (a->argc == 3) {
+ mgcpdebug = 1;
+ ast_cli(a->fd, "MGCP Debugging Enabled\n");
+ } else if (!strncasecmp(a->argv[3], "off", 3)) {
+ mgcpdebug = 0;
+ ast_cli(a->fd, "MGCP Debugging Disabled\n");
+ }
return CLI_SUCCESS;
}
-static char *handle_mgcp_set_debug_off(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+static char *handle_mgcp_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
switch (cmd) {
case CLI_INIT:
- e->command = "mgcp set debug off";
+ e->command = "mgcp set debug {on|off}";
e->usage =
- "Usage: mgcp set debug off\n"
- " Disables dumping of MGCP packets for debugging purposes\n";
+ "Usage: mgcp set debug {on|off}\n"
+ " Enables/Disables dumping of MGCP packets for debugging purposes\n";
return NULL;
case CLI_GENERATE:
return NULL;
}
- if (a->argc != 4)
+ if (a->argc != e->args)
return CLI_SHOWUSAGE;
- mgcpdebug = 0;
- ast_cli(a->fd, "MGCP Debugging Disabled\n");
+
+ if (!strncasecmp(a->argv[e->args - 1], "on", 2)) {
+ mgcpdebug = 1;
+ ast_cli(a->fd, "MGCP Debugging Enabled\n");
+ } else if (!strncasecmp(a->argv[3], "off", 3)) {
+ mgcpdebug = 0;
+ ast_cli(a->fd, "MGCP Debugging Disabled\n");
+ } else {
+ return CLI_SHOWUSAGE;
+ }
return CLI_SUCCESS;
}
+static struct ast_cli_entry cli_mgcp_set_debug_deprecated = AST_CLI_DEFINE(handle_mgcp_set_debug_deprecated, "Enable/Disable MGCP debugging");
static struct ast_cli_entry cli_mgcp[] = {
AST_CLI_DEFINE(handle_mgcp_audit_endpoint, "Audit specified MGCP endpoint"),
AST_CLI_DEFINE(handle_mgcp_show_endpoints, "List defined MGCP endpoints"),
- AST_CLI_DEFINE(handle_mgcp_set_debug, "Enable MGCP debugging"),
- AST_CLI_DEFINE(handle_mgcp_set_debug_off, "Disable MGCP debugging"),
+ AST_CLI_DEFINE(handle_mgcp_set_debug, "Enable/Disable MGCP debugging", .deprecate_cmd = &cli_mgcp_set_debug_deprecated),
AST_CLI_DEFINE(mgcp_reload, "Reload MGCP configuration"),
};