Queue with Failover

Call Handling Asterisk 18+ -- Last reviewed 2026-03-29 queues failover call-distribution Found this useful? Upvote it. ×

Queue with Failover

A call queue that distributes calls to agents, with failover to voicemail when no one answers or the queue times out.

Requirements

Queue Configuration (queues.conf)

[support-queue]
musicclass = default
strategy = ringall
timeout = 15
retry = 5
maxlen = 10
wrapuptime = 5
announce-frequency = 30
announce-holdtime = yes
joinempty = yes
leavewhenempty = no

Dialplan

[main-queue]
exten => s,1,NoOp(Entering support queue)
 same => n,Set(CHANNEL(musicclass)=default)
 same => n,Answer()
 same => n,Queue(support-queue,t,,,120)
 same => n,NoOp(Queue returned: ${QUEUESTATUS})
 same => n,GotoIf($["${QUEUESTATUS}" = "TIMEOUT"]?timeout)
 same => n,GotoIf($["${QUEUESTATUS}" = "FULL"]?full)
 same => n,Goto(failover)
 same => n(timeout),NoOp(Queue timed out after 120s)
 same => n,Goto(failover)
 same => n(full),NoOp(Queue is full)
 same => n,Goto(failover)
 same => n(failover),Playback(custom/all-agents-busy)
 same => n,VoiceMail(100@default,u)
 same => n,Hangup()

How it works

  1. Queue(queuename,options,URL,announceoverride,timeout): The fifth argument is the maximum time (in seconds) a caller will wait in the queue before it returns.
  2. QUEUESTATUS: After Queue() returns, this channel variable indicates why: TIMEOUT, FULL, JOINEMPTY, LEAVEEMPTY, JOINUNAVAIL, or LEAVEUNAVAIL.
  3. Strategy: ringall rings every available member simultaneously. Other options: leastrecent, fewestcalls, random, rrmemory (round-robin with memory).
  4. Failover chain: The GotoIf checks route to a common failover label that plays a message and sends the caller to voicemail.

Tips

User Notes

No notes yet. Be the first to contribute a tip or example.

Contribute a note

Share a tip, gotcha, or practical example. Keep it under 2000 characters. No questions (use the Asterisk community forums for support). Wrap code in backticks.

Moderated before publishing. Email never shown.

Related Snippets