Hi rickead2000!
I’m using this to get the maximum that can be in the queue and announce the position to the caller.
If the queue is full I tell them to try again later!
I’m using realtime agents, queues and CDR in a MySQL DB.
The Agents is paused or unpaused.
[code]exten => s,1,Set(QUEUE_NAME=Reception-Q)
exten => s,n,Set(QUEUE_VOICEMAIL=2101)
exten => s,n,Set(CALLERID(all)=${QUEUE_NAME} <${CALLERID(num)}>)
; Check how many calls the max is for the queue.
exten => s,n,MYSQL(Connect connid ${ASTERISK_DB_HOST} ${ASTERISK_DB_USER} ${ASTERISK_DB_USER_PWD} ${ASTERISK_DB})
exten => s,n,GotoIf($["${connid}" = “”]?0,1)
exten => s,n,MYSQL(Query resultid ${connid} select\ maxlen\ FROM\ queues\ WHERE\ name="${QUEUE_NAME}")
exten => s,n,MYSQL(Fetch fetchid ${resultid} result_maxlen)
exten => s,n,MYSQL(Clear ${resultid})
exten => s,n,MYSQL(Disconnect ${connid})
exten => s,n,NoOp(The Maximum is ${result_maxlen} qued calls!)
exten => 0,1,Background(03-silence)
exten => 0,n,Set(your_place_in_queue=$[${QUEUE_WAITING_COUNT(${QUEUE_NAME})} + 1])
exten => 0,n,GotoIf($["${your_place_in_queue}" > “${result_maxlen}”]?205,1:)
exten => 0,n,Background(queue-thereare)
exten => 0,n,SayDigits(${your_place_in_queue})
exten => 0,n,Background(queue-callswaiting)
exten => 0,n,Background(03-silence)
exten => 0,n,Queue(${QUEUE_NAME}|HhTtKkWw)
exten => 205,1,Background(03-silence)
exten => 205,n,Background(im-sorry-the-queue-is-full)
exten => 205,n,Background(03-silence)
exten => 205,n,Background(please-try-again-later)
exten => 205,n,Background(03-silence)
exten => 205,n,Background(goodbye)
exten => 205,n,Background(10-silence)
exten => 205,n,Hangup()[/code]
What you are looking for is this:
[quote]Command Type: Dialplan Function
Version: Trunk
Syntax:
QUEUE_WAITING_COUNT([queuename])
Returns the number of callers currently waiting in the specified queuename.[/quote]
I hope this can be to any help for you