Average waiting time in the queue

How do I find the average waiting time in the queue?

from the asterisk cli:-

queue show (queue)

from bash:-

rasterisk -x “queue show”

for a prettier view maybe:-

  1. 7007 has 0 calls (max 20) in ‘rrmemory’ strategy (180s holdtime, 417s talktime), W:0, C:1577, A:385, SL:69.3% within 60s

And after several minutes:
7007 has 0 calls (max 20) in ‘rrmemory’ strategy (88s holdtime, 191s talktime), W:0, C:1581, A:388, SL:69.3% within 60s

But I want to know average waiting time in queue for ALL calls.
Is it possible?

  1. And by the way, when I look in CDR Reports numbers of Unanswered calls to destination 7007, it does not show any call.
    http://rghost.net/44138171/image.png
    But queue show showed me that there should be at least 388.
    Why is this happening?

It’s just simple mathematics, look at the code for the “wallboard” I pointed you at and rewrite it if doesn’t do exactly what you want.

For the unanswered calls look at the DID that was dialed not the queue, the queues do their best to keep your CDR records as clean as possible.

You might however be better off just buying the asternic package from :-

http://www.asternic.net/

Simpler for me to write few strings of python code:

#!/usr/bin/python

-- coding:utf-8 --

import re

def rf(file):
f = open(file, ‘r’)
lines = f.readlines()
f.close()
return lines

lines = rf(‘queue_log’)

def search_wait(string):
data = re.search(r’|(12\d)|COMPLETECALLER|(\d+)|(\d+)|\d+’, string)
if data:
tel_id = data.group(1)
wait_time = data.group(2)
if wait_time != ‘0’:
return wait_time
else:
return None

waiting = [search_wait(line) for line in lines if search_wait(line) != None]
waiting = sorted( [int(x) for x in waiting] )

print 'average waiting time: ', sum(waiting)/len(waiting)

hmm, margins are not saved :frowning: