Call recording file naming


i have my current call recording set for my queue for now all incoming calls have the same file format:


I need help to have the existing file name adds the agents in the queue who answered.

current extensions.conf:
;msw tb_queue
exten => _864,1,Answer()
exten => _864,n,Set(tension=MSW-Bets)
exten => _864,n,Macro(selfrec,${tension})
exten => _864,n,Set(CDR(userfield)=MSW-Bets)
exten => _864,n,Playback(GigiScript1)
exten => _864,n,Queue(tb_queue,dtr,120)
exten => _864,n,Voicemail(860@asterisk-mnl)
exten => _864,n,HangUp()

exten => s,1,Set(CALLFILENAME=${ARG1}-${STRFTIME(${EPOCH},%Y%m%d-%H%M%S)})
exten => s,n,MixMonitor(/raid/var/spool/asterisk/monitor/Today/${CALLFILENAME}.wav,W(3))
exten => s,n,NoOp


You can’t do it on the front end. At the time that you create the file name and enable the mixmonitor, the call hasnt been answered by an agent.

You can use the h event to rename the file after the call is completed.

I opted to just write the recording out under the unique id and then after the call is completed, I write out a text file which is save under the uniqueid but contains the queue, agent, time etc.

I also enabled the monitoring in my queue.conf file rather than the dial plan. Below is the Macro that I send my queue calls to. Also, to get the memberinterface be sure to put setinterfacevar=yes in the queue.conf.

exten => 300,1,Macro(queuecall,pos)

exten => s,1,Answer
exten => s,n,set(CALLERID(name)=[${ARG1}] ${CALLERID(name)})
exten => s,n,Queue(${ARG1},1800)
exten => s,n,Set(CDR(userfield)=Left Que ${ARG1} ${QUEUESTATUS})
exten => s,n,hangup
exten => h,1,Set(y=${MEMBERINTERFACE:4})
exten => h,n,System(echo QUEUE=${ARG1} AGENT=${y} TIME=${STRFTIME(${EPOCH},%Y%m%d.%H%M)} UNIQUEID=${UNIQUEID} >> /var/spool/asterisk/monitor/${UNIQUEID}.TXT)