[asterisk-users] can anyone tell me how to set asterisk to record all phonecall

Jeremy Kister asterisk-01 at jeremykister.com
Fri Mar 4 22:37:33 CST 2011


On 3/4/2011 9:49 PM, John Wu wrote:
> I need to use asterisk to record all phonecall I have test using
> mixmonitor to record a call.

this is one way it can be done

make sure you have 'lame' installed.

- in your extensions.conf:

[global]
VSA=/var/spool/asterisk

[outbound-or-wherever-you-dial]
exten => _XXX,1,Macro(Snoop,${EXTEN})
exten => _XXX,n,Dial(SIP/${EXTEN},${TIMEOUT})
exten => _XXX,n,StopMixMonitor
; above in case you're in some loop & Dial fails,
; e.g., swift+monitor crash asterisk


[macro-Snoop]
; ${ARG1} channel
exten => s,1,GotoIf($["${SNOOPING}" = "1"]?snooping)
exten => s,n,Set(SNOOPING=1)
exten => s,n,Set(YYYY=${STRFTIME(${EPOCH},,%Y)})
exten => s,n,Set(MM=${STRFTIME(${EPOCH},,%m)})
exten => s,n,Set(DD=${STRFTIME(${EPOCH},,%d)})
exten => s,n,Set(HMS=${STRFTIME(${EPOCH},,%H%M%S)})
exten => s,n,Set(FILENAME=${HMS}-${CALLERID(num)}-${ARG1}-${UNIQUEID})
exten => s,n,Set(MIXMON_ARGS=mkdir -p ${VSA}/monitor/${YYYY}/${MM}/${DD} 
&& nice -n 19 /usr/local/bin/lame --silent --resample 11.025 -b 16 -t -m 
m ${VSA}/monitor/${FILENAME}.wav 
${VSA}/monitor/${YYYY}/${MM}/${DD}/${FILENAME}.mp3 && rm -f 
${VSA}/monitor/${FILENAME}.wav)
exten => s,n,MixMonitor(${FILENAME}.wav,,${MIXMON_ARGS})
exten => s,n(snooping),NoOp(snooping on ${CHANNEL})



that'll end up putting a mp3 of the call in 
/var/spool/asterisk/monitor/YYYY/MM/DD/HHMMSS-CALLERID.mp3

don't forget any legal issues you might have to work around, recording 
the fact that you declared the message is being recorded.


-- 

Jeremy Kister
http://jeremy.kister.net./



More information about the asterisk-users mailing list