[asterisk-commits] file: branch 1.4 r97152 - /branches/1.4/funcs/func_groupcount.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 8 13:53:52 CST 2008


Author: file
Date: Tue Jan  8 13:53:52 2008
New Revision: 97152

URL: http://svn.digium.com/view/asterisk?view=rev&rev=97152
Log:
If no group has been provided to the GROUP_COUNT dialplan function then use the first one specific to the channel.
(closes issue #11077)
Reported by: m4him

Modified:
    branches/1.4/funcs/func_groupcount.c

Modified: branches/1.4/funcs/func_groupcount.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/funcs/func_groupcount.c?view=diff&rev=97152&r1=97151&r2=97152
==============================================================================
--- branches/1.4/funcs/func_groupcount.c (original)
+++ branches/1.4/funcs/func_groupcount.c Tue Jan  8 13:53:52 2008
@@ -44,6 +44,24 @@
 
 	ast_app_group_split_group(data, group, sizeof(group), category,
 				  sizeof(category));
+
+	/* If no group has been provided let's find one */
+	if (ast_strlen_zero(group)) {
+		struct ast_group_info *gi = NULL;
+
+		ast_app_group_list_lock();
+		for (gi = ast_app_group_list_head(); gi; gi = AST_LIST_NEXT(gi, list)) {
+			if (gi->chan != chan)
+				continue;
+			if (ast_strlen_zero(category) || (!ast_strlen_zero(gi->category) && !strcasecmp(gi->category, category)))
+				break;
+		}
+		if (gi) {
+			ast_copy_string(group, gi->group, sizeof(group));
+			ast_copy_string(category, gi->category, sizeof(category));
+		}
+		ast_app_group_list_unlock();
+	}
 
 	if ((count = ast_app_group_get_count(group, category)) == -1)
 		ast_log(LOG_NOTICE, "No group could be found for channel '%s'\n", chan->name);




More information about the asterisk-commits mailing list