How to set up ChanSpy in Asterisk for Listen, Whisper, and Barge

Applies to: Asterisk (all versions), Softphone.Pro (all versions).

Logline: this article describes how to configure the ChanSpy module for Asterisk, which allows supervisors to listen to colleagues’ conversations, whisper hints, or even join the call and turn it into a conference.

Modern PBXs are not only about making calls — they also offer many advanced features. For example, you can connect to a colleague’s conversation with a client and listen to what they are talking about (Spy, Listen). You can also give your agents hints (Whisper), or even join the conversation and turn it into a conference call (Barge).

In this article we explain how to configure these features in Asterisk — a popular open-source PBX used by nearly half of our clients.


According to our statistics, clients use all versions of Asterisk: from 1.8 (1%) to Asterisk 22 (3%). The most common versions at the time of publication are Asterisk 16 (26%) and Asterisk 13 (33%). As the saying goes, an old ox makes straight furrows.


To configure the ChanSpy module (from the words Channel and Spy — essentially a “spy channel”), we used the Asterisk distribution from the official repository. We used version 20.6.0, but the commands and instructions below should work with other distributions as well — both newer and older ones.

1. Open your PBX dialplan configuration file /etc/asterisk/extensions.conf in any convenient text editor (we recommend Notepad++).

2. Based on the example below, create your own context for call listening, whispering, and conference modes.


Please note: XXX, YYY and ZZZ in the examples below represent dial codes and do not necessarily have to be three digits long. In a real dialplan you should use actual numbers — for example, 987, 6543, etc.

Listening (Spy) in Asterisk

[app-custom-chanspy]

exten => _XXX.,1,Macro(user-callerid,)

exten => _XXX.,n,ChanSpy(SIP/${EXTEN:3},q)

exten => _XXX.,n,Hangup


Possible situation #1
Client: So if I place the order now, there will be a discount…
Agent: Twenty percent!
Client: And the delivery will be…
Agent: As soon as tomorrow!
Supervisor (thinking): Everything seems fine here — I’ll listen to John for a while.

Whisper in Asterisk

[app-custom-chanspy]

exten => _YYY.,1,Macro(user-callerid,)

exten => _YYY.,n,ChanSpy(SIP/${EXTEN:3},w)

exten => _YYY.,n,Hangup


Possible situation #2
Client: Well… I still need to think about it…
Agent: Uh…
Supervisor (to the agent): Remember Leonardo DiCaprio…
Agent: This is the best option I’ve seen in the last six months!

Barge (Conference) in Asterisk

[app-custom-chanspy]

exten => _ZZZ.,1,Macro(user-callerid,)

exten => _ZZZ.,n,ChanSpy(SIP/${EXTEN:3},B)

exten => _ZZZ.,n,Hangup


Possible situation #3
Agent: Press the le…
Supervisor (to everyone): No, press the right button!


Wrong button!


This is, of course, an extraordinary situation… but sometimes a supervisor really needs to intervene to correct a mistake or prevent potential harm.


3. Add the following line to the end of the existing context (a section in the configuration file extensions.conf):

include => app-custom-chanspy

4. Save the changes and open the Asterisk console.

5. Run the following command in your PBX server’s SSH console:

asterisk -rx "dialplan reload"

If the command runs successfully, you will see the message Dialplan reloaded. This means Asterisk has reloaded the dialplan and applied your changes. Now there is nothing that stands in your way, and nothing is hid from thy sight ear :)


Keep in mind that agent’s and supervisor’s softphones should be both registered to the same PBX otherwise ChanSpy cannot run properly.

How to connect to calls using the Team service


Team is a convenient tool for administrators and supervisors: provisioning, monitoring, operator supervision, an online dashboard, and visual reports.


Team dashboard



Go to Settings (1), open the Softphone.Pro tab, click General settings (2), and enable the Centralized Settings Wizard (3):


Enable centralized settings wizard


Next, go to the Service numbers section and enter the codes you specified in the configuration file (see step 3 above). Click Save.

To connect to an agent’s conversation (remember that both softphones must be registered on the same PBX):

  • Go to the Online tab in your dashboard and hover over any agent who is currently on a call. Three vertical dots will appear next to their name.
  • Click the dots and choose the mode you want to connect with.

Conclusion

The ChanSpy module included in Asterisk provides supervisors with a practical tool to evaluate agent performance, guide conversations, suggest information when needed, and prevent mistakes — ultimately improving call efficiency and conversion.

ChanSpy configuration is straightforward and does not take much time. In the Softphone.Pro Team dashboard, supervisors can connect to agent calls with just a mouse click — without remembering or dialing special codes manually.

In addition, Team allows you not only to listen to conversations but also to monitor agents’ activity in real time and organize them into groups (departments).


Sign up for a Team account and get 2 weeks free.

YOU MAY ALSO LIKE

Blog How to set up ChanSpy on FreePBX

Blog FreePBX Softphone: 5 Incredibly Useful Features for Call Centers

Blog Issabel PBX: Top 3 Softphones (2021 Update)


Last Articles