Index: funcs/func_groupcount.c =================================================================== --- funcs/func_groupcount.c (revision 87019) +++ funcs/func_groupcount.c (working copy) @@ -42,11 +42,24 @@ { int count = -1; char group[80] = "", category[80] = ""; + struct ast_group_info *gi; - ast_app_group_split_group(data, group, sizeof(group), category, - sizeof(category)); + if (!ast_strlen_zero(data)) { + ast_app_group_split_group(data, group, sizeof(group), category, + sizeof(category)); + count = ast_app_group_get_count(group, category); + } else { + ast_app_group_list_rdlock(); + for (gi = ast_app_group_list_head(); gi; gi = AST_LIST_NEXT(gi, list)) { + if (gi->chan == chan) { + count = ast_app_group_get_count(gi->group, gi->category); + break; + } + } + ast_app_group_list_unlock(); + } - if ((count = ast_app_group_get_count(group, category)) == -1) + if (count == -1) ast_log(LOG_NOTICE, "No group could be found for channel '%s'\n", chan->name); else snprintf(buf, len, "%d", count);