Asterisk call monitoring 
It can be useful or mandatory to save voice calls in order to be able to listen those afterwards. This is the often the case in call centres and in trading rooms, either for quality tracking or legal issues. Asterisk proposes for a long time now to save calls in sound files, this is called the monitoring.
Starting in release 1.2, we now have a new way to monitor call using the MixMonitor application. The main advantage is the automatic combining of both call directions in a single file without any post call processing, putting stress on the Asterisk server. Based on the file extension, Asterisk convert the call to the appropriate format, regardless of the codec used. Since call monitoring is for specific usage targeting legal issues or training, the quality could be reduced in order to limit file size1.
The easiest approach to monitoring is by including MixMonitor in the dialing plan (extensions.conf). For example, the following shows how to monitor calls and organize files per date and time:
exten => _901.,1,Set(DIRNAME=${CALLERID(num)}/${STRFTIME(${EPOCH},,%Y%m/%d)})
exten => _901.,2,Set(FILENAME=${DIRNAME}/${STRFTIME(${EPOCH},,%H%M%S)}-${EXTEN:2})
exten => _901.,3,System(/bin/mkdir -p /var/spool/asterisk/monitor/${DIRNAME})
exten => _901.,4,MixMonitor(${FILENAME}.gsm,b)
exten => _901.,5,Dial(SIP/${EXTEN:2},20)
Once the target directory build, we monitor the call and save it in a file with GSM codec. The path is split in directory in order to limit inode shortage and improve performances. The proposed solution is an explicit monitoring, each call should be prefixed by 90. This solution is perfect for testing purposes or to monitor all calls arriving to a specific extension (call centre for example).
The file would be available in a format like:
/var/spool/asterisk/monitor/16/200705/20/174019-15.gsm
for extension 16 calling 15 on 20/05/2007 at 17:40:19.
Another approach is possible: through Asterisk console by specifying an engaged call. The application command is also called MixMonitor but takes some arguments: the action (start or stop), the channel to monitor (see show channels) and the name of the target file where the call would be saved. For example:
mixmonitor start SIP/15-0846aa88 training.gsm
Since call monitoring should see the voice in transit, any call already engaged by outside the bridge will be send a new INVITE message in order to reroute the RTP flow in the Asterisk. By the way, this is a great feature available in Asterisk to be able to manipulate an engaged call through INVITE message, even if this is only supported by enhanced phones with a complete SIP stack.
We will see in a future article how to listen an already monitored call at the agent desk or a specific listening desk.
Note that some regulatory issues exist in many countries, for France the CNIL2 is the regulatory organisation.
|
Posted by: Alexandre Chauvin-Hameau, on 05/21/2007 Trackback | Popularity: 18% tagged 1.4, asterisk, codec, extensions.conf, RTP and security |
|





