Asterisk calculate wait time


I need to trace on a mysql Db the time between calls arriving on ivr and wait time on the choosen queue…
Between ivr starting and queue answer (or abbandoned)…
This to monitor cc Service Level…
Could have i any suggestions?


${CDR(duration)} Duration of the call.
${CDR(billsec)} Duration of the call once it was answered.

Can i subtract these two values?


I don’t understand what do you mean in your last question. Those values are available for your use after the call hangup, If you have a CDR setup properly those values are in DB too.


Sorry…i’ll try to explain better…

I need to calculate time passed between call answered by IVR and queue agent answer…

There is an authority for water distribution company (acqueduct) that force to take over this value…

I’ve Asternic (with license) installed…but this program take on core the cc performance…so IVR time is not included on surveys…
I wish i could keep on a DB the timestamps on both answer events and calculate month by month the average wait time…


Although I don’t know how well this works in practice, the expectation is that you would use the Queue application, and take this information from the queue log.


Queue log could take over calls before they enter a queue?
If not i wish i could set timestamps of the two events and do any math on those…
I’ve only to report the average wait time on hook before agent answer…


What happens between the IVR and entering the queue. For most people, entering the queue is when the wait time starts.

If dialplan is active, you can capture the time just by setting a channel variable to the time.


Yes…for call starts i know how to do…but how can i check this on queue answer?


You can run dialplan on queue answer.

You haven’t explained why the normal queue statistics don’t give you the value you need.


Because as you said for normal queue statistics entering the queue is when the wait time starts.

When you say “You can run dialplan on queue answer.” you mean i have to fill the dots?

On priority 2 i’ll obtain answer timestamp if set correctly? (sorry for bothering you)

exten => 1000,1,Queue(1000,tT)
exten => 1000,2,…
exten => 1000,3,Hangup


Entering the queue is when most people want the wait time to start being counted!

The Queue and Dial applications handle the whole of the connected phase of the call, so priority 2 will not be run until the agent hangs up or the queue gives up.

Please read queues.conf.sample for how to run a subroutine when the agent is called.