How to set up ChanSpy in Asterisk for Listen, Whisper, and Barge
Applies to: Asterisk (all versions), Softphone.Pro (all versions).
Logline: how to configure ChanSpy, an Asterisk module that lets supervisors listen in on conversations, whisper hints to agents, or even join a call and turn it into a conference.
Modern PBXs are about much more than simply making calls. Among other things, they let you connect to a colleague’s conversation with a client and listen in (Spy, Listen), whisper useful information to the agent (Whisper), or even jump into the conversation and turn it into a conference call (Barge).
In this article, we’ll explain how to configure these features in Asterisk — a popular open-source PBX used by almost half of our clients.
According to our statistics, clients use all kinds of Asterisk versions: from 1.8 (1%) all the way to Asterisk 22 (3%). At the time of publication, the most common are Asterisk 16 (26%) and Asterisk 13 (33%). As the saying goes, there’s life in the old dog yet.
First we need ChanSpy. The name comes from Channel + Spy — a “spy channel,” if you will. We used Asterisk 20.6.0 from the official repository, but the commands and instructions below should also work with other versions, both newer and older.
1. Open your PBX dialplan configuration file (usually /etc/asterisk/extensions.conf) in any convenient text editor. We recommend Notepad++.
2. Based on the examples below, create your own context for Spy (Listen), Whisper (Help), and Barge (Conference) modes.
Please note: XXX, YYY, and ZZZ in the examples below represent numeric dial codes. They do not have to be three digits long. In a real dialplan, use actual numbers — for example, 987, 6543, etc.
Spy (Listen) 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 order now, the discount will be…
Agent: Twenty percent!
Client: And delivery will be…
Agent: As soon as tomorrow!
Supervisor (thinking): Everything’s fine here. Time to listen in on John.
Whisper (Help) 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 thiiink about it…
Agent: Uh…
Supervisor (to the agent): Leonardo DiCaprio…
Agent: This is the best option I’ve seen in 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!

This is, of course, an extraordinary situation… but sometimes a supervisor really does need to step in to correct a mistake or prevent potential harm.
3. Add the following line to the end of the existing context (a section in the extensions.conf configuration file):
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 everything goes well, you’ll see Dialplan reloaded. This means Asterisk has reloaded the dialplan and applied your changes. Now nothing stands in your way, and nothing will escape your eyes ears :)
Keep in mind that the agent’s and supervisor’s softphones must be registered on the same PBX. Otherwise, ChanSpy will not work correctly.
How to connect to calls using Team
Team is a practical tool for administrators and supervisors: provisioning, remote control, monitoring, an online dashboard, and clear, visual reports.

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

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 an agent who is currently on a call. Three vertical dots will appear next to the agent’s name.
- Click the dots and choose the mode you want to use to join the conversation.
Conclusion
The ChanSpy module built into Asterisk gives supervisors a practical way to evaluate agent skills, steer conversations, provide useful information when needed, and catch mistakes before they become problems — ultimately helping improve conversion.
ChanSpy is quick and straightforward to configure. In the Softphone.Pro Team dashboard, a supervisor can connect to an agent’s call with a mouse click, without memorizing service numbers or dialing them manually.
Team also lets you monitor agents’ activity in real time and organize them into groups (departments), in addition to listening to their conversations.
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)