aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorautomerge <automerge@f38db490-d61c-443f-a65b-d21fe96a405b>2007-04-25 20:26:05 +0000
committerautomerge <automerge@f38db490-d61c-443f-a65b-d21fe96a405b>2007-04-25 20:26:05 +0000
commit37bc33e7aacafcc1394a68ef92ddc15e320b4c2f (patch)
treecd70384416ea562ee9fe605d2326bc41162be575 /apps
parent8911e9f7c38901c3495b409f62b8f99b29837c9e (diff)
automerge commit
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2-netsec@61861 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_groupcount.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/apps/app_groupcount.c b/apps/app_groupcount.c
index 87d313209..496f62b8f 100644
--- a/apps/app_groupcount.c
+++ b/apps/app_groupcount.c
@@ -201,10 +201,8 @@ static int group_show_channels(int fd, int argc, char *argv[])
{
#define FORMAT_STRING "%-25s %-20s %-20s\n"
- struct ast_channel *c = NULL;
int numchans = 0;
- struct ast_var_t *current;
- struct varshead *headp;
+ struct ast_group_info *gi = NULL;
regex_t regexbuf;
int havepattern = 0;
@@ -218,26 +216,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_mutex_unlock(&c->lock);
+ gi = AST_LIST_NEXT(gi, list);
}
+ ast_app_group_list_unlock();
+
if (havepattern)
regfree(&regexbuf);