Asterisk Queue Position Announcement

Hi,

Is it possible to have asterisk announce the caller’s position in the queue when they join rather than wait until the first periodic announcement?

I want their position to be announced every 30 seconds, but also immediately upon joining but I can’t see how this is possible.

Can anybody shed some light on this for me?

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

Hi,
I have queue with following options:

announce-frequency = 35
announce-position = yes

It announces ok , in every 35 sec, but it announces position when user joins queue also.
Is it possible to avoid this first announcment? So announce after 35 sec caller joins?
asterisk 1.4.42

Rebards Kajana.

Hi kajana!

I think this modification should do that:

exten => 0,1,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,Queue(${QUEUE_NAME}|HhTtKkWw)
If if the maximum is not reached the caller will be send to the queue.
If the queue is full it will tell the caller that and hangup the call!

Thank you nypon for your reply.
But i suspect you misunderstood my question.
I need to avoid position announcment as soon as caller joins a queue.
I need to announce position after 35 sec will elapse , and every next 35 sec(I have announce-frequency = 35)
It announces position not only when maxlen is reached, but for every caller.

Regards Kajana

Hi kajana!

Then i’m not fully sure I understand what you want!

When the maxlen in this example is reached it will not announce caller
position, it will tell the caller that the queue is full and hang up the call!

But you can try to send the call to a queue direct and only have.

[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)}>)

exten => s,n,Queue(${QUEUE_NAME}|HhTtKkWw)
exten => s,h,Hangup()[/code]
I don’t remember if:

will announce the position when the caller join the queue!

Virtually yours // Nypon

It seems this level of customization requires changes to source code.
I did it. It works ok in my testing environment.

--- app_queue.c.orig    2012-10-24 16:13:58.000000000 +0400
+++ app_queue.c.new     2012-10-24 15:40:45.000000000 +0400
@@ -1627,6 +1627,9 @@
        time(&now);
        if ((now - qe->last_pos) < 15)
                return 0;
+        /* Avoid first position announcment */
+        if ((now - qe->start) < qe->parent->announcefrequency)
+            return 0;

        /* If either our position has changed, or we are over the freq timer, say position */
        if ((qe->last_pos_said == qe->pos) && ((now - qe->last_pos) < qe->parent->announcefrequency))

Regards Kajana