Search code examples
phpasteriskasteriskami

Retrieving/making statistics of asterisk queues using asterisk queue_log table or AMI


Using PHP asterisk manager interface I am able to query asterisk for current queue status by issuing a QueueStatusAction. This provides me with useful statistics like:

  1. Hold time
  2. Calls abandoned
  3. Calls completed
  4. Average talk time.

As far as I understand, these statistics are calculated only for the lifetime of asterisk process on the server and are lost once the process stops.

In my application, I would like to display the mentioned statistics about queues for the last {day|week|month|year}. Is there a way to retrieve the historic statics via asterisk manager interface or some abstraction on top of it, or is it up to me to program a method for making those statistics from the data in asterisk queue_log table?

If anybody has done this or has some idea of how to go about tackling this problem, please share.


Solution

  • You are gooing wrong way.

    Asterisk is PBX software. It not responsible for save/record/manage info about queue. It not designed to store info about queue inside asterisk, instead it providing following ways:

    1. Events like agent login/logoff/call etc via manager API
    2. Events log in /var/log/asterisk/queue_log
    3. Same as 2, but queue_log in database(recommended way). See this:

    After data placed you can use SQL query language to create report you need. Actualy it is simple SQL for anyone with sql skill.

    For example to got hold time, you need select all events with your queue number and event CONNECT,it provide waittime. For call time you need check CONNECT and check next event COMPLETECALLER/COMPLETEAGENT with same uniqueid.

    If for some reason you are not so nice with sql, you can check some opensource project like Asternic Call Center Stats or other(google by queue managment/report) and check SQLs it use or hire someone to do your sql part.