diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-01-23 17:46:55 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-01-23 17:46:55 +0000 |
commit | cfc64ba71e64c45c60363a08e33c4091ed04915e (patch) | |
tree | f9f48527f706ebbacbaf38751347dd09d259bd34 /apps | |
parent | 8f016a62d0cb661bb01b78f1f5a9dd8de592d0c6 (diff) |
ChanSpy issues a beep when it starts at the beginning of a list of channels to
potentially spy on. However, if there were no matching channels, it would beep
at you over and over, which is pretty annoying. Now, it will only beep once in
the case that there are no channels to spy on, but it will still beep again once
it reaches the beginning of the channel list again.
(closes issue #11738, patched by me)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@99923 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_chanspy.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c index a99c03216..2d781fc77 100644 --- a/apps/app_chanspy.c +++ b/apps/app_chanspy.c @@ -377,6 +377,7 @@ static int common_exec(struct ast_channel *chan, const struct ast_flags *flags, int res; char *ptr; int num; + int num_spyed_upon = 1; if (chan->_state != AST_STATE_UP) ast_answer(chan); @@ -386,7 +387,7 @@ static int common_exec(struct ast_channel *chan, const struct ast_flags *flags, waitms = 100; for (;;) { - if (!ast_test_flag(flags, OPTION_QUIET)) { + if (!ast_test_flag(flags, OPTION_QUIET) && num_spyed_upon) { res = ast_streamfile(chan, "beep", chan->language); if (!res) res = ast_waitstream(chan, ""); @@ -405,6 +406,7 @@ static int common_exec(struct ast_channel *chan, const struct ast_flags *flags, /* reset for the next loop around, unless overridden later */ waitms = 100; peer = prev = next = NULL; + num_spyed_upon = 0; for (peer = next_channel(peer, spec, exten, context); peer; @@ -470,7 +472,8 @@ static int common_exec(struct ast_channel *chan, const struct ast_flags *flags, waitms = 5000; res = channel_spy(chan, peer, &volfactor, fd, flags); - + num_spyed_upon++; + if (res == -1) { break; } else if (res > 1 && spec) { |