Index: apps/app_chanspy.c =================================================================== --- apps/app_chanspy.c (revision 114594) +++ apps/app_chanspy.c (working copy) @@ -70,8 +70,12 @@ " and a digit sequence.\n" " Options:\n" " b - Only spy on channels involved in a bridged call.\n" -" g(grp) - Match only channels where their SPYGROUP variable is set to\n" -" contain 'grp' in an optional : delimited list.\n" +" g(grp) - Only spy on channels in which one or more of the groups \n" +" listed in 'grp' matches one or more groups from the\n" +" SPYGROUP variable set on the channel to be spied upon.\n" +" Note that both 'grp' and SPYGROUP can contain either a\n" +" single group or a colon-delimited list of groups, such\n" +" as 'sales:support:accounting'.\n" " q - Don't play a beep when beginning to spy on a channel, or speak the\n" " selected channel name.\n" " r[(basename)] - Record the session to the monitor spool directory. An\n" @@ -112,8 +116,12 @@ " exit to it.\n" " Options:\n" " b - Only spy on channels involved in a bridged call.\n" -" g(grp) - Match only channels where their ${SPYGROUP} variable is set to\n" -" contain 'grp' in an optional : delimited list.\n" +" g(grp) - Only spy on channels in which one or more of the groups \n" +" listed in 'grp' matches one or more groups from the\n" +" SPYGROUP variable set on the channel to be spied upon.\n" +" Note that both 'grp' and SPYGROUP can contain either a\n" +" single group or a colon-delimited list of groups, such\n" +" as 'sales:support:accounting'.\n" " q - Don't play a beep when beginning to spy on a channel, or speak the\n" " selected channel name.\n" " r[(basename)] - Record the session to the monitor spool directory. An\n" @@ -611,9 +619,13 @@ const char *group; int igrp = !mygroup; char *groups[25]; + char *mygroups[25]; int num_groups = 0; char *dup_group; + int num_mygroups = 0; + char *dup_mygroup; int x; + int y; char *s; char *buffer; char *end; @@ -648,16 +660,22 @@ } if (mygroup) { + dup_mygroup = ast_strdupa(mygroup); + num_mygroups = ast_app_separate_args(dup_mygroup, ':', mygroups, + sizeof(mygroups) / sizeof(mygroups[0])); + if ((group = pbx_builtin_getvar_helper(peer, "SPYGROUP"))) { dup_group = ast_strdupa(group); num_groups = ast_app_separate_args(dup_group, ':', groups, sizeof(groups) / sizeof(groups[0])); } - for (x = 0; x < num_groups; x++) { - if (!strcmp(mygroup, groups[x])) { - igrp = 1; - break; + for (y = 0; y < num_mygroups; y++) { + for (x = 0; x < num_groups; x++) { + if (!strcmp(mygroups[y], groups[x])) { + igrp = 1; + break; + } } } }