Asterisk Call Recording Macro

romanlutsk
Joined: Mon 05 of Sep, 2005

Asterisk Call Recording Macro

Posted:Tue 03 of Feb, 2009 (22:44 UTC)
Hi,
I'm trying to create a macro to record (MixMonitor) all incoming calls automatically.

I use the example from
http://www.voip-info.org/wiki/view/Asterisk+config+features.conf:

*********
One Touch Recording (applicationmap) with WAV to MP3 Conversion Macro. 

extensions.conf : 

[macro-apprecord] 
exten => s,1,GotoIf($["${XAD}" = "0" | "${XAD}" = ""]?startrec:stoprec) 
exten => s,n(startrec),Playback(startmonitor) 
exten => s,n,Set(XAD=1) 
exten => s,n,Set(FILENAME=${TIMESTAMP}-OUT${CALLERID(number)}-^-${UNIQUEID}) 
exten => s,n,Set(MONITOR_EXEC_ARGS=&& nice -n 19 /usr/local/bin/lame -b 96 -t -F -m m --bitwidth 16 --quiet "/var/spool/asterisk/monitor/${FILENAME}.wav" "/var/spool/asterisk/monitor/${FILENAME}.mp3" && rm -f "/var/spool/asterisk/monitor/${FILENAME}.wav") 
exten => s,n,Monitor(wav,${FILENAME},m) 
exten => s,n,MacroExit 
exten => s,n(stoprec),StopMonitor 
exten => s,n,Set(XAD=0) 
exten => s,n,Playback(stopmonitor) 
exten => s,n,MacroExit 

features.conf : 

apps => *9,caller,Macro,apprecord 
**********


After hours of playing around, I still cannot figure out how to call that macro directly from a dialplan to start/stop recording and convert wav to mp3:
exten => s,n,Macro(apprecord,1) ; start recording
exten => s,n,Macro(apprecord, 0) ; stop recording

Any ideas how to do it correctly, please?

Thanks a lot,
Roman