[asterisk-commits] trunk r24636 - in /trunk: apps/app_chanspy.c doc/channelvariables.txt

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed May 3 15:25:09 MST 2006


Author: bweschke
Date: Wed May  3 17:25:08 2006
New Revision: 24636

URL: http://svn.digium.com/view/asterisk?rev=24636&view=rev
Log:
Allow channels in ChanSpy to belong to mutiple spygroups #7072 (anthm)



Modified:
    trunk/apps/app_chanspy.c
    trunk/doc/channelvariables.txt

Modified: trunk/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_chanspy.c?rev=24636&r1=24635&r2=24636&view=diff
==============================================================================
--- trunk/apps/app_chanspy.c (original)
+++ trunk/apps/app_chanspy.c Wed May  3 17:25:08 2006
@@ -73,7 +73,7 @@
 "  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"
-"             'grp'.\n"
+"             contain 'grp' in an optional : delimited list.\n"
 "    q - Don't play a beep when beginning to spy on a channel.\n"
 "    r[(basename)] - Record the session to the monitor spool directory. An\n"
 "                    optional base for the filename may be specified. The\n"
@@ -414,7 +414,7 @@
 			spec = NULL;
 		}
 	}
-	
+
 	if (options) {
 		char *opts[OPT_ARG_ARRAY_SIZE];
 		ast_app_parse_options(chanspy_opts, &flags, opts, options);
@@ -471,18 +471,34 @@
 			if (peer != chan) {
 				const char *group = NULL;
 				int igrp = 1;
-
+				char *groups[25] = {0};
+				int num_groups = 0;
+				char *dup_group;
+				
 				if (peer == prev && !chosen) {
 					break;
 				}
 				chosen = 0;
-				group = pbx_builtin_getvar_helper(peer, "SPYGROUP");
+
 				if (mygroup) {
-					if (!group || strcmp(mygroup, group)) {
-						igrp = 0;
+					int x;
+
+					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]));
 					}
+
+					igrp = 0;
+					if (num_groups) {
+						for (x = 0; x < num_groups; x++) {
+							if (!strcmp(mygroup, groups[x])) {
+								igrp = 1;
+								break;
+							}
+						}
+					} 
 				}
-				
+
 				if (igrp && (!spec || ((strlen(spec) <= strlen(peer->name) &&
 							!strncasecmp(peer->name, spec, strlen(spec)))))) {
 					if (peer && (!bronly || ast_bridged_channel(peer)) &&

Modified: trunk/doc/channelvariables.txt
URL: http://svn.digium.com/view/asterisk/trunk/doc/channelvariables.txt?rev=24636&r1=24635&r2=24636&view=diff
==============================================================================
--- trunk/doc/channelvariables.txt (original)
+++ trunk/doc/channelvariables.txt Wed May  3 17:25:08 2006
@@ -755,6 +755,11 @@
 ${MACRO_PRIORITY}	* The calling priority
 ${MACRO_OFFSET}		Offset to add to priority at return from macro
 
+The ChanSpy() application uses the following variables:
+---------------------------------------------------------
+${SPYGROUP}		* A ':' (colon) separated list of group names.
+			  (To be set on spied on channel and matched against the g(grp) option)
+
 If you compile with OSP support, these variables are used:
 ---------------------------------------------------------
 ${OSPINHANDLE}		OSP handle of in_bound call



More information about the asterisk-commits mailing list