aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_chanspy.c
diff options
context:
space:
mode:
authoranthm <anthm@f38db490-d61c-443f-a65b-d21fe96a405b>2005-03-29 17:46:37 +0000
committeranthm <anthm@f38db490-d61c-443f-a65b-d21fe96a405b>2005-03-29 17:46:37 +0000
commit7fd9ddbc394f5f5b0477a2190d20030b2dae375e (patch)
tree15ce40408457e7fe4c10ba889f9fdeb977c60923 /apps/app_chanspy.c
parenta09c488dab87749aeeae495ec2d6a55026316f1e (diff)
fix group and arg parsing bug
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5300 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_chanspy.c')
-rwxr-xr-xapps/app_chanspy.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c
index a4ced09ff..e966b3c0e 100755
--- a/apps/app_chanspy.c
+++ b/apps/app_chanspy.c
@@ -455,12 +455,13 @@ static int chanspy_exec(struct ast_channel *chan, void *data)
if (options) {
char *opts[2];
ast_parseoptions(chanspy_opts, &flags, opts, options);
- if (ast_test_flag(&flags, OPTION_GROUP))
- mygroup = opts[0];
+ if (ast_test_flag(&flags, OPTION_GROUP)) {
+ mygroup = opts[1];
+ }
silent = ast_test_flag(&flags, OPTION_QUIET);
bronly = ast_test_flag(&flags, OPTION_BRIDGED);
if (ast_test_flag(&flags, OPTION_VOLUME) && opts[1]) {
- if (sscanf(opts[1], "%d", &volfactor) != 1)
+ if (sscanf(opts[0], "%d", &volfactor) != 1)
ast_log(LOG_NOTICE, "volfactor must be a number between -4 and 4\n");
else {
volfactor = minmax(volfactor, 4);
@@ -490,19 +491,20 @@ static int chanspy_exec(struct ast_channel *chan, void *data)
while(peer) {
if (peer != chan) {
char *group = NULL;
+ int igrp = 1;
if (peer == prev) {
break;
}
-
- group = pbx_builtin_getvar_helper(chan, "SPYGROUP");
-
- if (mygroup && group && strcmp(group, mygroup)) {
- continue;
+ group = pbx_builtin_getvar_helper(peer, "SPYGROUP");
+ if (mygroup) {
+ if (!group || strcmp(mygroup, group)) {
+ igrp = 0;
+ }
}
- if (!spec || ((strlen(spec) < strlen(peer->name) &&
- !strncasecmp(peer->name, spec, strlen(spec))))) {
-
+
+ if (igrp && (!spec || ((strlen(spec) < strlen(peer->name) &&
+ !strncasecmp(peer->name, spec, strlen(spec)))))) {
if (peer && (!bronly || ast_bridged_channel(peer)) &&
!ast_check_hangup(peer) && !ast_test_flag(peer, AST_FLAG_SPYING)) {
int x = 0;