Chapter 3. Audio Manipulation

Introduction

The recipes in this chapter are designed to help you with the injection of audio into and the monitoring of channels in your Asterisk environment. Many of the recipes focus on a particular aspect but can be built up or modified using the skills learned in other recipes in this book.

Monitoring and Barging into Live Calls

Problem

As the manager of a call center, you need to be able to listen in on calls to help with training new employees.

Solution

The most simple solution is to simply connect to any active channel using the ChanSpy() application, which then provides you the ability to flip through active channels using DTMF. The b option means to only listen to actively bridged calls:

[CallCenterTraining]
exten => 500,1,Verbose(2,Listening to live agents)
   same => n,ChanSpy(,b)

If you only want to spy on certain channels, you can use the chanprefix option to control which types of channels you want to listen to. So, if we just want to listen to SIP channels involved in bridged calls, we would do this:

[CallCenterTraining]
exten => 500,1,Verbose(2,Listening to live agents)
   same => n,ChanSpy(SIP,b)

Discussion

The default DTMF keys for controlling ChanSpy() are as follows:

#

Cycles through the volume level

*

Stop listening to the current channel and find another one to listen to

There are a lot more options for ChanSpy() and ways to use it in your dialplan. With some creativity, ChanSpy() can be used in many situations it wasn’t necessarily designed for (see ...

Get Asterisk Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.