[svn-commits] moy: branch moy/dahdi-tap-trunk r221968 - /team/moy/dahdi-tap-trunk/main/cli.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Fri Oct 2 10:03:21 CDT 2009
Author: moy
Date: Fri Oct 2 10:03:17 2009
New Revision: 221968
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=221968
Log:
this commit is unrelated to PRI monitorig, just adds a new CLI command in main/cli.c that is already in the bug tracker to be able to hangup all channels with a single command
Modified:
team/moy/dahdi-tap-trunk/main/cli.c
Modified: team/moy/dahdi-tap-trunk/main/cli.c
URL: http://svnview.digium.com/svn/asterisk/team/moy/dahdi-tap-trunk/main/cli.c?view=diff&rev=221968&r1=221967&r2=221968
==============================================================================
--- team/moy/dahdi-tap-trunk/main/cli.c (original)
+++ team/moy/dahdi-tap-trunk/main/cli.c Fri Oct 2 10:03:17 2009
@@ -919,9 +919,11 @@
case CLI_INIT:
e->command = "channel request hangup";
e->usage =
- "Usage: channel request hangup <channel>\n"
+ "Usage: channel request hangup <channel>|<all>\n"
" Request that a channel be hung up. The hangup takes effect\n"
- " the next time the driver reads or writes from the channel\n";
+ " the next time the driver reads or writes from the channel.\n"
+ " if 'all' is specified instead of a channel name, all channels\n"
+ " will see the hangup request.\n";
return NULL;
case CLI_GENERATE:
return ast_complete_channels(a->line, a->word, a->pos, a->n, e->args);
@@ -931,7 +933,19 @@
return CLI_SHOWUSAGE;
}
- if ((c = ast_channel_get_by_name(a->argv[3]))) {
+ if (!strcasecmp(a->argv[3], "all")) {
+ struct ast_channel_iterator *iter = NULL;
+ if (!(iter = ast_channel_iterator_all_new(0))) {
+ return CLI_FAILURE;
+ }
+ for (; iter && (c = ast_channel_iterator_next(iter)); ast_channel_unref(c)) {
+ ast_channel_lock(c);
+ ast_cli(a->fd, "Requested Hangup on channel '%s'\n", c->name);
+ ast_softhangup(c, AST_SOFTHANGUP_EXPLICIT);
+ ast_channel_unlock(c);
+ }
+ ast_channel_iterator_destroy(iter);
+ } else if ((c = ast_channel_get_by_name(a->argv[3]))) {
ast_channel_lock(c);
ast_cli(a->fd, "Requested Hangup on channel '%s'\n", c->name);
ast_softhangup(c, AST_SOFTHANGUP_EXPLICIT);
More information about the svn-commits
mailing list