Skip to content

AstLinux Record Phone Calls to External USB Flash Drive Part 2

by Jon on July 31st, 2014

In part 1 of this post I showed you how to format and mount an external USB drive. Next I will show you how to set up call recording for inbound and outbound phone calls in your Asterisk dialplan.

1. Open extensions.conf to edit and find in the dialplan where inbound calls are directed. I am going to use the example DID number of 8885551234 and use the mixmonitor Asterisk command. See the dialplan below to record an inbound phone call.

exten => 8885551234,1,Answer
exten => 8885551234,n,Set(CDR(userfield)=ib_${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}_${EXTEN}_${CALLERID(num)})
exten => 8885551234,n,MixMonitor(ib_${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}_${EXTEN}_${CALLERID(num)}.wav)
exten => 8885551234,n,Dial(SIP/100,24,trwW)
exten => 8885551234,n,Voicemail(100,su)
exten => 8885551234,n,Hangup

The most important step here is MixMonitor where you give the recording a filename and format. I choose to use the dialplan destination as well as the caller id number in the filename for future reference and stored it in a wave format.

2. Next let’s do call recording for outbound phone calls, now you need to find that section in the Asterisk dialplan.

exten => _NXXNXXXXXX,1,Set(CDR(userfield)=ob_${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}_${EXTEN}_${CALLERID(num)})
exten => _NXXNXXXXXX,n,MixMonitor(ob_${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}_${EXTEN}_${CALLERID(num)}.wav)
exten => _NXXNXXXXXX,n,Dial(SIP/${EXTEN}@sip-outbound,60,trwW)
exten => _NXXNXXXXXX,n,Hangup

Above you can see I used the same Asterisk command MixMonitor to create the recording. Again I urge you to check your local laws about recording phone calls.

Now that Asterisk is recording the phone calls we need to make sure the phone calls get stored on the USB drive. In the next part I will show you how to direct the recorded phone calls to the USB drive connected to the PBX.

From → Linux, VOIP

No comments yet

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS

%d bloggers like this: