Include agent who answered in Monitor filename?

Hi,

I’m using Asterisk 13.14.0 and am using MixMonitor to record calls to a wav file. In the dialplan entry for each queue, I set the MONITOR_FILENAME using the available variables. I want to end up with something that includes the time, caller’s extension and the extension (or name) or the agent who ended up answering the call.

In the dialplan for each queue, I have an entry like this:
exten => 1001,n,Set(MONITOR_FILENAME=${STRFTIME(${EPOCH},%Y%m%d-%H:%M:%S)}-${EXTEN}-Sales-${CALLERID(NUM)}-${BRIDGEPEER})

This works beautifully, except that $BRIDGEPEER ends up being blank. I’ve tried many alternatives, including: DIALEDPEERNAME, MEMBERINTERFACE, MEMBERNAME, AGENTNUMBER and many others, all with no luck.

I’ve googled quite a bit, and the best I could find were people writing their own custom scripts to scan the queue_log or cdr after the fact, search up the record for that matching unique call ID, parse out the id of the agent who answered the call, and then rename the file accordingly.

That would probably work, but seems awfully complicated. Isn’t there some other variable I could use? It seems like MixMonitor would already have this information handy…

You could try doing a ChangeMonitor as part of a Gosub when your agent gets the call to populate the variables.

https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+Application_ChangeMonitor

https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+Application_Queue

Queue(queuename,[options,[URL,[announceoverride,[timeout,[AGI,[macro,[gosub,[rule,[position]]]]]]]]])

Use the ‘gosub’ portion of the line to run a subroutine when the call is bridged.

Thanks, I’ll tinker with that and see if I can get it to work for me.