The Problem : Record calls from selected Call Manager (CUCM) phones.
The Solution : Setup a recording server that will receive copies of calls from these handsets.

Details : Since call recording isn’t built into Cisco Call Manager, we’ll need a secondary server to send a copy of each call to. We’ll then use the Call Manager built in bridge to fork calls to this new server. Since call recording is built into the open source PBX Asterisk, we’ll be using that as our recording server.

The built-in-bridge is a feature of Call Manager 7 and up that allows a modern IP phone to fork it’s audio – essentially send a separate copy of the phone call to a third party recording server.

To get started, you’ll need to configure the Asterisk server, and and The Call Manager. Install of an Asterisk server and UCUM is outside the scope of this tutorial.

On the Asterisk Server

FYI, this article applies to an Asterisk server running on Centos 6.4.

Configure an extension on the Asterisk server to be recorded. In this case we used extension 1111200, which will be auto answered by the Asterisk server, and recorded.  You’ll need a DN that works with your dial plan (we use 7 digits)

You’ll need to create the folders:
/var/spool/asterisk/monitor/active-calls
/var/spool/asterisk/monitor/completed-calls

the edit /etc/asterisk/extensions_custom.conf

Once this is completed, you should be able to call the extension from your cisco phone and see files being generated in the /var/spool/asterisk/monitor/active-calls/ folder of the asterisk server. You’ll notice that there are two files generated for each call, this is because Asterisk records each side of the conversation as a separate wave file. We use a linux command line program called lame to mix these two files together. I use a special version that includes mp3 support (be aware that mp3 support was pulled from the main version of lame for licensing issues).

Install repository with Lame, then install lame using yum. Lame will be used to convert the wav files produced by Asterisk

Now, we’ll need to make a script to combine the two wav files into one, then use lame and convert to MP3. This script is also setup to copy the files out to another reporting server, Then delete the local files – if you don’t want that, you’ll need to remove the final IF statement.

So, from command line:

and paste this script

Recording Crontab – you’ll need to add a cron job on the Asterisk server to process the files (join, and copy offbox if requested). Here I’ve go one running every 5 minutes. If there is any output (errors) they will be appended to the file /var/spool/asterisk/monitor/merge.log

At the command prompt type:
crontab -e

then add this:

Setup NTP on all servers (Call Manager, Asterisk, and any other servers). Since these calls are linked to records by timestamp, it’s important that everyone have the same time. You’ve likely already setup NTP on your Call Manager (it’s required during install), so this should do the trick for then Asterisk and reporting servers:

Type the following command to install ntp

Turn on service

Synchronize the system clock with 0.pool.ntp.org server (or better yet, the same server used by CUCM)

Start the NTP:

On the CUCM server:

  1. You’ll need to configure a SIP trunk to the Asterisk server
  2. You’ll need to configure a Route Pattern that points a DN to the Asterisk SIP trunk.  Once this is done you should be able to call that DN from your phone, and have Asterisk answer and record the call.
  3. Create a Recording Profile (Device -> Device Settings -> Recording Profile).  Sepcify the DN from step 2 as the Recording Destination Address.
  4. On each line that you want to record (you add this to the line, not the device) you’ll need to change the Recording Option to always (or automatic), and choose the Asterisk Recording Profile.

Some things to keep in mind:

  • When asterisk writes the recording files, the internal phone that is sending the audio to asterisk is always seen as the caller, and the second number is referred to as the remote phone.  The end result is that your files will be in the format internal_remote_date-time_randomNumber-channel.wav.

 

My thoughts:

This is a pretty labor intensive solution, and not for the faint of heart.  At the end of this exercise you’ll have a directory full of recordings that will continue to grow, so you’ll need to prune this directory occasionally.  I used these recordings to pull into an in-house CDR tool that I developed, but you may just want to keep recordings for some sort of compliance.  Be sure to check your local laws to make sure that recording calls is allowed.

Recording Call Manager using Asterisk

2 thoughts on “Recording Call Manager using Asterisk

  • January 21, 2015 at 7:41 am
    Permalink

    Very useful Article. Only one question about this. How do you know who makes the call and who receive in the Asterisk? I need to know who is the caller and who is the called. Sometimes the SIPCALLID are different, then the mix fails. The SOX is used to mix and LAME is used to convert to mp3.

    • August 9, 2016 at 3:36 am
      Permalink

      Hi Cahzca, I’ve used the same script (with some changes to update the content of CDR and use the native web report) and never found issue on retrieving the caller and called informations. I’m in a tuning operation of my recording appliance (Vmware VM), I can share with you if you want as I’m happy to test it on other environment.

Leave a Reply