login | register
Wed 09 of Jul, 2008 [05:51 UTC]

voip-info.org

Discuss [4] History

Asterisk cmd ChanSpy

Created by: JustRumours,Last modification on Wed 23 of Apr, 2008 [20:02 UTC] by thelimit

ChanSpy

Synopsis

Listen in on a call. Useful in a call center to monitor agents on the phone.

Description

See bug 3836

This adds the ability to spy on any bridged call, this includes VoIP only calls where ZapScan/ZapBarge couldn't this can.

Chanspy([<scanspec>][|<options>])

Valid Options:
- b: Only spy on channels involved in a bridged call.
- g(grp): Match only channels where their ${SPYGROUP} variable is set to contain 'grp' in an optional : delimited list.
- q: Don't play a beep when beginning to spy on a channel, or speak the selected channel name.
- r[(basename)]: Record the session to the monitor spool directory. An optional base for the filename may be specified. The default is 'chanspy'.    
- v([value]): Adjust the initial volume in the range from -4 to 4. A negative value refers to a quieter setting.

Since 1.4:
- w Enable 'whisper' mode, so the spying channel can talk to the spied-on channel.
- W Enable 'private whisper' mode, so the spying channel can talk to the spied-on channel but cannot listen to that channel.

If <scanspec> is specified, only channel names *beginning* with that string will be scanned.
('all' or an empty string are also both valid <scanspec>)

While Spying:

Dialing # cycles the volume level.
Dialing * will stop spying and look for another channel to spy on.
Dialing a series of digits followed by # builds a channel name to append to <scanspec>
(e.g. run Chanspy(Agent) and dial 1234# while spying to jump to channel Agent/1234)

Update: Asterisk 1.4 include a 'whisper' feature as part of ChanSpy(): A third party may speak to only one of the two parties of a bridged call.

Attention

  • Up to and including Asterisk 1.4.17 ChanSpy can cause a crash/segfault if used together with Monitor or Asterisk cmd MixMonitor at the same time. 1.4.18 is supposed to attack this issue by using "audiohooks" that replaces the current ChanSpy approach.

Example

 exten => 556,1,ChanSpy(scan)

Note:

ChanSpy will not work if you are Record()-ing the spied channel; unless you add transmit_silence_during_record=yes to the options section in /etc/asterisk/asterisk.conf


See also


Version information

  • As of october 19 2004, ChanSpy is not included in the standard Asterisk distribution or the development CVS tree.
  • As of March 22 2005 this bug was reopened and can be viewed at above link.
  • On March 24 2005 ChanSpy was added into CVS HEAD


Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ


Comments

Comments Filter
222

333Creative solution for spying with console

by devil_slayer, Friday 30 of November, 2007 [21:59:57 UTC]

Well ChanSpy seems broken, as are alot of other apps in Asterisk. But, some apps actually work better than expected and we can use this to solve the problem in a creative way!

The problem I have with chanspy is that it just doesn't do what the description says it should. And if I want to spy and talk to the channel from console, it just doesn't work.

For my solution, I used two standard programs for playing and recording under Linux/ALSA: aplay and arecord:

1. create two FIFO files in a directory of your choice:
user@computer:/temp# mkfifo play.raw
user@computer:/temp# mkfifo record.raw
user@computer:/temp# ls -l
prw-r--r-- 1 user user 0 2007-11-30 22:36 play.raw
prw-r--r-- 1 user user 0 2007-11-30 22:36 record.raw

2. create the following context in your extensions.conf file and redirect incoming calls to it:
test
exten => s,1,MixMonitor(/home/lucas/WoZ/play.raw,a)
exten => s,n,PLAYBACK(/home/lucas/WoZ/record)
exten => s,n,Hangup

3. run the following two commands in the afforementioned directory:
user@computer:/temp# aplay -f S16_LE -r 8000 -c 1 play.raw > /dev/null &
user@computer:/temp# arecord -f S16_LE -r 8000 -c 1 > record.raw

4. Call and now you can listen to and talk to the call in progress. Change PLAYBACK to BACKGROUND to run sth else before hangup.


222

333SPYGROUP g option

by jon.webster, Friday 22 of September, 2006 [19:29:40 UTC]
SetVar is depriciated, use:
exten => _9X.,1,Set(SPYGROUP=10001)
222

333SPYGROUP g option

by FranklinWebb, Tuesday 29 of November, 2005 [23:29:47 UTC]
To use the g option use the following format:

exten => 1234,1,ChanSpy(|g(10001))
exten => 1234,2,Hangup

This would then allow you to spy on any call that set $SPYGROUP to "10001" like this:

exten => _9X.,1,SetVar(SPYGROUP=10001)

any calls with SPYGROUP set to another value would not be selected by ChanSpy even if the rest of the parameters matched.
222

333ChanSpy removed from Mantis?

by sergejf, Tuesday 22 of February, 2005 [17:52:34 UTC]
The link to bug 2379 doesn't work anymore. What happened to ChanSpy? Has it been removed because it was unstable? Has it been made part of the main Asterisk CVS? How to monitor calls without it on non-Zap channels?