Recording calls with Asterisk

Here’s how you can record calls to mp3 files with Asterisk.

Insert these to extensions.conf:

1
2
3
4
5
6
7
8
9
[globals]
MONITOR_EXEC=/usr/local/bin/asterisk-wav2mp3

[macro-record]
exten => s,1,Set(CALLFILENAME=${STRFTIME(${EPOCH},,%Y%m%d%H%M%S)}-${MACRO_CONTEXT}-${DIALEDPEERNUMBER})
exten => s,n,Set(POSTFIX=$["${CALLFILENAME}" =~ "\/([0-9a-zA-Z#_\-]+)$"])
exten => s,n,Set(CALLFILENAME=$["${CALLFILENAME}" : "([0-9a-zA-Z#_\-]+)"]${IF($[${LEN(${POSTFIX})}=0]?:
_${POSTFIX})})
exten => s,n,Monitor(wav,${CALLFILENAME},m)

Recording start example:
exten => 555,1,Dial(SIP/1234,,M(record))

The script asterisk-wav2mp3 can be downloaded here. Make sure it’s runnable (chmod +x asterisk-wav2mp3). This script creates a stereo mp3 out of two mono wav files. You’ll need SOX and Lame encoder for this to work.

Victor 2016-04-19 15:48:03

Hey Nonoo!

Thanks for the description! But my upgraded SOX not include mp3 codec and I can’t start converting wav record. How can I fix this issue?

Thx, Victor

Koszi a leirasert! A SOX nekem nem tartalmaz mp3 codecet es nem kezdi el atkonvertalni. Jelenleg van ket feloldalas wav fileom. Hogy tudnam kijavitani a SOX codecet? Mar a legfrisseb van fent.

Koszi, Victor

Nonoo 2016-04-19 16:55:32

You have to recompile SOX from sources.

 
 
Victor 2016-04-20 14:50:05

Still not working.

 
Victor 2016-04-22 14:28:10

I figured out, Thanks!

 
Name (required)
E-mail (required - never shown publicly)
Webpage URL
Comment:
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> in your comment.

Trackback responses to this post

About me

Nonoo
I'm Nonoo. This is my blog about music, sounds, filmmaking, amateur radio, computers, programming, electronics and other things I'm obsessed with. ... »

Twitter

Listening now

My favorite artists