Tracking hourly call distribution for multiple incoming DIDs

2007-08-23
If you have multiple incoming DIDs pointing to the same queue, and you would like to track the hourly distribution of calls on each DID for planning, there is a simple thing you can do. You create a "virtual queue" for each DID, then when a call comes in into that DID, and before passing it to the actual queue that's servicing it, you write two log lines as if it was a lost call. Then you can define each "virtual queue" in QueueMetrics and run reports on it like you currently do; you will find all calls as "lost" but you do get call count, incoming caller id and hourly/daily/weekly call distribution.

In practice what you do is modify the dialplan so that:
exten => s,n, .....
exten => s,n,Macro(qm-lostcall,did-11,${CALLERID(name)})
exten => s,n,Queue(service-q,,30)
exten => s,n, .....

[macro-qm-lostcall]
; ${ARG1} - the name for the fake queue
; ${ARG2} - the caller id to be logged
exten => s,1,System( echo "${EPOCH}|${UNIQUEID}.1|${ARG1}|NONE|ENTERQUEUE||${ARG2}" >> /var/log/asterisk/queue_log )
exten => s,2,System( echo "${EPOCH}|${UNIQUEID}.1|${ARG1}|NONE|ABANDON|0|0|0" >> /var/log/asterisk/queue_log )


Now if you want to know what happended through the usual statistics, you run a report for queue service-q, while if you want to know about the incoming DID #11 you run a report for did-11.

See also Tracking the incoming DID on a queue.