aboutsummaryrefslogtreecommitdiffstats
path: root/main/cli.c
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-04-25 19:27:42 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-04-25 19:27:42 +0000
commitec529b6fa3aea0532ffb5043ec261f020187d0b7 (patch)
treeed6ec8f5e250d0dbcf7b06317f5e74301c1b033c /main/cli.c
parent6f4a7aa6e9302e6d1a3ea9395a2b95592cc80370 (diff)
Merged revisions 61805 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ................ r61805 | file | 2007-04-25 15:21:54 -0400 (Wed, 25 Apr 2007) | 10 lines Merged revisions 61804 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r61804 | file | 2007-04-25 14:52:50 -0400 (Wed, 25 Apr 2007) | 2 lines Merge rewritten group counting support. No more storing data on the variable list of the channels. That was bad, mmmk? (issue #7497 reported by sabbathbh) ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@61806 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/cli.c')
-rw-r--r--main/cli.c34
1 files changed, 13 insertions, 21 deletions
diff --git a/main/cli.c b/main/cli.c
index b84739984..1f0d063f7 100644
--- a/main/cli.c
+++ b/main/cli.c
@@ -905,10 +905,8 @@ static int group_show_channels(int fd, int argc, char *argv[])
{
#define FORMAT_STRING "%-25s %-20s %-20s\n"
- struct ast_channel *c = NULL;
+ struct ast_group_info *gi = NULL;
int numchans = 0;
- struct ast_var_t *current;
- struct varshead *headp;
regex_t regexbuf;
int havepattern = 0;
@@ -922,26 +920,20 @@ static int group_show_channels(int fd, int argc, char *argv[])
}
ast_cli(fd, FORMAT_STRING, "Channel", "Group", "Category");
- while ( (c = ast_channel_walk_locked(c)) != NULL) {
- headp=&c->varshead;
- AST_LIST_TRAVERSE(headp,current,entries) {
- if (!strncmp(ast_var_name(current), GROUP_CATEGORY_PREFIX "_", strlen(GROUP_CATEGORY_PREFIX) + 1)) {
- if (!havepattern || !regexec(&regexbuf, ast_var_value(current), 0, NULL, 0)) {
- ast_cli(fd, FORMAT_STRING, c->name, ast_var_value(current),
- (ast_var_name(current) + strlen(GROUP_CATEGORY_PREFIX) + 1));
- numchans++;
- }
- } else if (!strcmp(ast_var_name(current), GROUP_CATEGORY_PREFIX)) {
- if (!havepattern || !regexec(&regexbuf, ast_var_value(current), 0, NULL, 0)) {
- ast_cli(fd, FORMAT_STRING, c->name, ast_var_value(current), "(default)");
- numchans++;
- }
- }
+
+ ast_app_group_list_lock();
+
+ gi = ast_app_group_list_head();
+ while (gi) {
+ if (!havepattern || !regexec(&regexbuf, gi->group, 0, NULL, 0)) {
+ ast_cli(fd, FORMAT_STRING, gi->chan->name, gi->group, (ast_strlen_zero(gi->category) ? "(default)" : gi->category));
+ numchans++;
}
- numchans++;
- ast_channel_unlock(c);
+ gi = AST_LIST_NEXT(gi, list);
}
-
+
+ ast_app_group_list_unlock();
+
if (havepattern)
regfree(&regexbuf);