Welcome to FOSSLC
FOSSLC is a non-profit corporation dedicated to education, community, and business development involving open source technologies. Read more about FOSSLC
This is the third in our series on Asterisk. This article will cover enabling asterisk to record calls. You may want this to interview people over the phone, podcast, or some other purpose. Read on.
The series so far are available at the following articles:
Step by step - how to set up your own phone system using Asterisk
Step by step: running and managing your phone system using asterisk
In features.conf, under:
[featuremap]
uncomment the line that looks like this:
automixmon => *3 ; One Touch Record a.k.a. Touch MixMonitor -- Make sure to set the X and/or x option in the Dial() or Queue() app call!Then, enable the X option for Dial() in your dialplan in extensions.conf:
PLEASE NOTE: your dial rule make look very different from my macro below. Adjust accordingly as it should be clear as to the minor change you need to make - add the X.
exten => s,n,Dial(SIP/${ARG1}@SIPNUMBER,60)make it this instead:
exten => s,n,Dial(SIP/${ARG1}@SIPNUMBER,60,X)The X is what tells Asterisk to allow callers to dial *3 during a call to enable or disable recording.
From the asterisk console (run asterisk -r), you should see a line like this appear when the user starts a recording:
-- User hit '*3' to record call. filename: auto-1265669650-EXTENSION-DIALEDNUMBER
When the recording ends, under /var/spool/asterisk/monitor, you should see a file that looks like this:
auto-1265669650-EXTENSION-DIALEDNUMBER.wav
You can have asterisk transcode the file automatically if you like. It is generally a good idea to not do this to conserve precious CPU during the call. Most likely you're hurting more for CPU than disk space. You can always transcode the file afterwards.
You can transcode this to what ever codec you like. Say for instance if you want an mp3, you could do:
ffmpeg -i auto-1265669650-EXTENSION-DIALEDNUMBER.wav -vn -ab 40k auto-1265669650-EXTENSION-DIALEDNUMBER.mp3
Just as an example. you can step the bitrate down if you like with the -ab parameter. Or choose other codecs.
Where EXTENSION is the extension of the caller. DIALEDNUMBER is the number the called called. SIPNUMBER is the SIP phone number used in this example to call the outside world.
Enjoy!



