mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
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: https://origsvn.digium.com/svn/asterisk/trunk@103171 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -2371,46 +2371,62 @@ static struct ast_rtp_protocol skinny_rtp = {
|
||||
.set_rtp_peer = skinny_set_rtp_peer,
|
||||
};
|
||||
|
||||
static char *handle_skinny_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||
static char *handle_skinny_set_debug_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||
{
|
||||
switch (cmd) {
|
||||
case CLI_INIT:
|
||||
e->command = "skinny set debug";
|
||||
e->command = "skinny set debug [off]";
|
||||
e->usage =
|
||||
"Usage: skinny set debug\n"
|
||||
" Enables dumping of Skinny packets for debugging purposes\n";
|
||||
"Usage: skinny set debug [off]\n"
|
||||
" Enables/Disables dumping of Skinny 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;
|
||||
|
||||
skinnydebug = 1;
|
||||
ast_cli(a->fd, "Skinny Debugging Enabled\n");
|
||||
return CLI_SUCCESS;
|
||||
if (a->argc == 3) {
|
||||
skinnydebug = 1;
|
||||
ast_cli(a->fd, "Skinny Debugging Enabled\n");
|
||||
return CLI_SUCCESS;
|
||||
} else if (!strncasecmp(a->argv[3], "off", 3)) {
|
||||
skinnydebug = 0;
|
||||
ast_cli(a->fd, "Skinny Debugging Disabled\n");
|
||||
return CLI_SUCCESS;
|
||||
} else {
|
||||
return CLI_SHOWUSAGE;
|
||||
}
|
||||
}
|
||||
|
||||
static char *handle_skinny_set_debug_off(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||
static char *handle_skinny_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||
{
|
||||
switch (cmd) {
|
||||
case CLI_INIT:
|
||||
e->command = "skinny set debug off";
|
||||
e->command = "skinny set debug {on|off}";
|
||||
e->usage =
|
||||
"Usage: skinny set debug off\n"
|
||||
" Disables dumping of Skinny packets for debugging purposes\n";
|
||||
"Usage: skinny set debug {on|off}\n"
|
||||
" Enables/Disables dumping of Skinny packets for debugging purposes\n";
|
||||
return NULL;
|
||||
case CLI_GENERATE:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (a->argc != 4)
|
||||
|
||||
if (a->argc != e->args)
|
||||
return CLI_SHOWUSAGE;
|
||||
|
||||
skinnydebug = 0;
|
||||
ast_cli(a->fd, "Skinny Debugging Disabled\n");
|
||||
return CLI_SUCCESS;
|
||||
if (!strncasecmp(a->argv[e->args - 1], "on", 2)) {
|
||||
skinnydebug = 1;
|
||||
ast_cli(a->fd, "Skinny Debugging Enabled\n");
|
||||
return CLI_SUCCESS;
|
||||
} else if (!strncasecmp(a->argv[e->args - 1], "off", 3)) {
|
||||
skinnydebug = 0;
|
||||
ast_cli(a->fd, "Skinny Debugging Disabled\n");
|
||||
return CLI_SUCCESS;
|
||||
} else {
|
||||
return CLI_SHOWUSAGE;
|
||||
}
|
||||
}
|
||||
|
||||
static char *complete_skinny_devices(const char *word, int state)
|
||||
@@ -2841,14 +2857,14 @@ static char *handle_skinny_show_settings(struct ast_cli_entry *e, int cmd, struc
|
||||
return CLI_SUCCESS;
|
||||
}
|
||||
|
||||
static struct ast_cli_entry cli_skinny_set_debug_deprecated = AST_CLI_DEFINE(handle_skinny_set_debug_deprecated, "Enable/Disable Skinny debugging");
|
||||
static struct ast_cli_entry cli_skinny[] = {
|
||||
AST_CLI_DEFINE(handle_skinny_show_devices, "List defined Skinny devices"),
|
||||
AST_CLI_DEFINE(handle_skinny_show_device, "List Skinny device information"),
|
||||
AST_CLI_DEFINE(handle_skinny_show_lines, "List defined Skinny lines per device"),
|
||||
AST_CLI_DEFINE(handle_skinny_show_line, "List Skinny line information"),
|
||||
AST_CLI_DEFINE(handle_skinny_show_settings, "List global Skinny settings"),
|
||||
AST_CLI_DEFINE(handle_skinny_set_debug, "Enable Skinny debugging"),
|
||||
AST_CLI_DEFINE(handle_skinny_set_debug_off, "Disable Skinny debugging"),
|
||||
AST_CLI_DEFINE(handle_skinny_set_debug, "Enable/Disable Skinny debugging", .deprecate_cmd = &cli_skinny_set_debug_deprecated),
|
||||
AST_CLI_DEFINE(handle_skinny_reset, "Reset Skinny device(s)"),
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user