I have a macro set up to record inbound calls on an extension:
[macro-DialStartMonitor]
; Calculate the time of the call from "epoch time", format it into yyyy-mm-dd and add the PhoneExt. at the end
exten => s,1,Set(MONITOR_FILENAME=${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-FROM-${CALLERID(num)}-TO-${ARG1})
same => n,MixMonitor(${MONITOR_FILENAME}.wav,b)
exten => 1001,1,noop(Dialing ${PEX_ONE})
same => n,Macro(DialStartMonitor,${PEX_ONE})
same => n,Dial(SIP/${PEX_ONE},30,mTt)
same => n,Playback(vm-nobodyavail) ; Play "no one's available"
same => n,Hangup()
exten => 1002,1,noop(Dialing ${PEX_TWO})
same => n,Macro(DialStartMonitor,${PEX_TWO})
same => n,Dial(SIP/${PEX_TWO},30,mTt)
same => n,Playback(vm-nobodyavail) ; Play "no one's available"
same => n,Hangup()
Thus, when I make a call from 1002 to 1001, the recording is saved to /var/spool/asterisk/monitor
with a format like this example "20140106-122313-FROM-1002-TO-PExten1001.wav"
I need to record the outbound call that originated from 1002 as it's own separate file - that is, when a call is made from 1002 to 1001, 2 recordings are made, one is an inbound recording for 1001(which is the code above) and one is an outbound recording for 1002(which is what this question is about).
Do I have to write a separate context for both the extensions? Or is there another method?
Thanks in advance.
You can't do 2 monitor on SAME channel.
To do what you want you have 2 variants
1) Create script on hangup which will copy file(recommended way)
2) Dial via Local/soemexte@somecontext/n and create enother monitor inside somecontext.