Lee, John (Sydney) wrote:
Check the number of calls waiting in the queue, then play the message
if
more than 0

example code (written in the TBird IDE)

Exten => 100,1,Answer()
Exten => 100,n,Set(NumWaiting=${QUEUE_WAITING_COUNT(${QUEUENAME})})
Exten => 100,n,GotoIf($[${NumWaiting} = 0]?JoinQueue)
Exten => 100,n,PlayBack(MyMessage)
Exten => 100,n(JoinQueue),Queue(MyQueueName)
Exten => 100,n,Hangup()

So, if there are no members in the queue, jump directly to the queue
application, otherwise play the message first.

Thanks Julian and it certainly works.
I have got another question if I may.
If there is just one agent in the queue and he put on Do-Not-Disturb,
certainly in this case the queue count will be zero but I would still
like Asterisk to play back "Welcome to XYZ, your call is important to us
... please stay on the line", the logic above would fail to play back
the intro message.
I thought about trapping DIALSTATUS but if there is actually no dial
cmd, how can I trap the DND then and play back the message again?
Any thoughts?

The only possibility I can see would be the QUEUE_MEMBER_COUNT function, however if the agent is using the "DND" feature of their phone, this is very unlikely to work. The only other method I can think of would be to call the queue using the "n" option to enter the queue and when the Queue application returns (which it will do if the call hasn't been answered on the first try - either due to a timeout or because the agent is in DND mode) to play the announcement to the caller.

Try something like...

exten => 100,1,Answer()
exten => 100,n,Set(NumWaiting=${QUEUE_WAITING_COUNT(${QUEUENAME})})
exten => 100,n,GotoIf($[${NumWaiting} = 0]?firstcaller)
exten => 100,n,Goto(announce)
exten => 100,n(firstcaller),Queue(MyQueueName,nr)
exten => 100,n(announce),PlayBack(MyMessage)
exten => 100,n,Queue(MyQueueName)
exten => 100,n,Hangup()

Calling the queue with the options "nr" means the queue will play the ring tone (omit the "r" if this isn't the desired behaviour) and drop through to the next statement if the call times out to all available agents... which would then play the announcement and put them back in the queue.

Theoretically, anyway.  :)

_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to