Monitoring Calls in Asterisk/FreePBX

The ability to monitor (listen in on) phone calls can be useful for purposes such as training or the monitoring of employees by company management. Using ChanSpy is one way to accomplish call monitoring with Asterisk. The ChanSpy feature has been included in Asterisk for years and is also supported by FreePBX. Later versions of Asterisk also allow the listener to optionally speak to just the local side of a call, greatly enhancing its usefulness and flexibility in training environments.

ChanSpy’s syntax is quite simple: Chanspy([<chanprefix>][|<options>]. The list of available options varies somewhat between Asterisk versions. Trying Chanspy is as simple as adding

exten => 555,1,Chanspy(‘all’|qb)

to your dialplan. Then simply dial 555 and use the # key to scan through and monitor any available channels.

To enable ChanSpy system-wide without restriction may be unwise however, because then anyone who is aware of the feature would have the ability to monitor any call and possibly obtain sensitive personal information such as credit card numbers. One easy way to solve this problem is to require a password:

exten => 555,1,Authenticate(1234)
exten => 555,n,Chanspy(‘all’|qb)
If you now dial 555, the system will ask for a password (1234 in this example) which must be entered correctly before the ability to listen is granted. Many versions of FreePBX come with ChanSpy enabled by default on extension 555 with no authentication needed! If you use FreePBX, check now by dialing 555.

Detailed explanations of all of ChanSpy’s features are readily available online, for example at http://www.voip-info.org/wiki/view/Asterisk+cmd+ChanSpy. By combining ChanSpy’s features with Asterisk’s extensive dialplan capabilities, an Asterisk administrator can easily make use of this great feature while maintaining tight control over which calls may be monitored and by which users.