mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-24 05:38:11 +00:00
Change "show parkedcalls" to "parkedcalls show" and mark the previous command
as deprecated. Also, convert the CLI command to the new style. (issue #9861, patch from eliel) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@67697 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -2398,42 +2398,60 @@ static char showfeatures_help[] =
|
||||
"Usage: feature list\n"
|
||||
" Lists currently configured features.\n";
|
||||
|
||||
static int handle_parkedcalls(int fd, int argc, char *argv[])
|
||||
static char *handle_parkedcalls(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||
{
|
||||
struct parkeduser *cur;
|
||||
int numparked = 0;
|
||||
|
||||
ast_cli(fd, "%4s %25s (%-15s %-12s %-4s) %-6s \n", "Num", "Channel"
|
||||
switch (cmd) {
|
||||
case CLI_INIT:
|
||||
e->command = "parkedcalls show";
|
||||
e->usage =
|
||||
"Usage: parkedcalls show\n"
|
||||
" List currently parked calls\n";
|
||||
return NULL;
|
||||
case CLI_GENERATE:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (a->argc > e->args)
|
||||
return CLI_SHOWUSAGE;
|
||||
|
||||
ast_cli(a->fd, "%4s %25s (%-15s %-12s %-4s) %-6s \n", "Num", "Channel"
|
||||
, "Context", "Extension", "Pri", "Timeout");
|
||||
|
||||
ast_mutex_lock(&parking_lock);
|
||||
|
||||
for (cur = parkinglot; cur; cur = cur->next) {
|
||||
ast_cli(fd, "%-10.10s %25s (%-15s %-12s %-4d) %6lds\n"
|
||||
ast_cli(a->fd, "%-10.10s %25s (%-15s %-12s %-4d) %6lds\n"
|
||||
,cur->parkingexten, cur->chan->name, cur->context, cur->exten
|
||||
,cur->priority, cur->start.tv_sec + (cur->parkingtime/1000) - time(NULL));
|
||||
|
||||
numparked++;
|
||||
}
|
||||
ast_mutex_unlock(&parking_lock);
|
||||
ast_cli(fd, "%d parked call%s.\n", numparked, ESS(numparked));
|
||||
ast_cli(a->fd, "%d parked call%s.\n", numparked, ESS(numparked));
|
||||
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
return CLI_SUCCESS;
|
||||
}
|
||||
|
||||
static char showparked_help[] =
|
||||
"Usage: show parkedcalls\n"
|
||||
" Lists currently parked calls.\n";
|
||||
static char *handle_parkedcalls_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||
{
|
||||
char *res = handle_parkedcalls(e, cmd, a);
|
||||
if (cmd == CLI_INIT)
|
||||
e->command = "show parkedcalls";
|
||||
return res;
|
||||
}
|
||||
|
||||
static struct ast_cli_entry cli_show_parkedcalls_deprecated = NEW_CLI(handle_parkedcalls_deprecated, "List currently parked calls.");
|
||||
|
||||
static struct ast_cli_entry cli_features[] = {
|
||||
{ { "feature", "show", NULL },
|
||||
handle_showfeatures, "Lists configured features",
|
||||
showfeatures_help },
|
||||
|
||||
{ { "show", "parkedcalls", NULL },
|
||||
handle_parkedcalls, "Lists parked calls",
|
||||
showparked_help },
|
||||
NEW_CLI(handle_parkedcalls, "List currently parked calls", .deprecate_cmd = &cli_show_parkedcalls_deprecated),
|
||||
};
|
||||
|
||||
/*! \brief Dump lot status */
|
||||
|
||||
Reference in New Issue
Block a user