Queue()

Since 0.2.0 Applications Found this useful? Upvote it. ×

Queue a call for a call queue.

Last reviewed 2026-04-14

Queue(queuename[,options,URL,announceoverride,timeout,AGI,gosub,rule,position])
Dialplan Builder -- build your Queue() command
*URL* will be sent to the called party if the channel supports it.
Announcement file(s) to play to agent before bridging call, overriding the announcement(s) configured in `queues.conf`, if any.
Will cause the queue to fail out after a specified number of seconds, checked between each `queues.conf` *timeout* and *retry* cycle.
Will setup an AGI script to be executed on the calling party's channel once they are connected to a queue member.
Will run a gosub on the called party's channel (the queue member) once the parties are connected. The subroutine execution starts in the named context at the s exten and priority 1.
Will cause the queue's defaultrule to be overridden by the rule specified.
Attempt to enter the caller into the queue at the numerical position specified. `1` would attempt to enter the caller at the head of the queue, and `3` would attempt to place the caller third in the queue.
Full arguments reference
  • queuename required
  • options
    • b - Before initiating an outgoing call, Gosub to the specified location using the newly created channel. The Gosub will be executed for each destination channel.
      • context
      • exten
      • priority required
        • arg1 required (multiple)
        • argN
    • B - Before initiating the outgoing call(s), Gosub to the specified location using the current channel.
      • context
      • exten
      • priority required
        • arg1 required (multiple)
        • argN
    • C - Mark all calls as "answered elsewhere" when cancelled.
    • c - Continue in the dialplan if the callee hangs up.
    • d - Data-quality (modem) call (minimum delay). This option only applies to DAHDI channels. By default, DTMF is verified by muting audio TX/RX to verify the tone is still present. This option disables that behavior.
    • F - When the caller hangs up, transfer the called member to the specified destination and start execution at that location. NOTE: Any channel variables you want the called channel to inherit from the caller channel must be prefixed with one or two underbars ('_'). NOTE: Using this option from a Gosub() might not make sense as there would be no return points.
      • context
      • exten
      • priority required
    • h - Allow callee to hang up by pressing *.
    • H - Allow caller to hang up by pressing *.
    • i - Ignore call forward requests from queue members and do nothing when they are requested.
    • I - Asterisk will ignore any connected line update requests or any redirecting party update requests it may receive on this dial attempt.
    • k - Allow the called party to enable parking of the call by sending the DTMF sequence defined for call parking in features.conf.
    • K - Allow the calling party to enable parking of the call by sending the DTMF sequence defined for call parking in features.conf.
    • m - Custom music on hold class to use, which will override the music on hold class configured in queues.conf, if specified. Note that CHANNEL(musicclass), if set, will still override this option.
    • n - No retries on the timeout; will exit this application and go to the next step.
    • r - Ring instead of playing MOH. Periodic Announcements are still made, if applicable.
    • R - Ring instead of playing MOH when a member channel is actually ringing.
    • t - Allow the called user to transfer the calling user.
    • T - Allow the calling user to transfer the call.
    • x - Allow the called user to write the conversation to disk via MixMonitor.
    • X - Allow the calling user to write the conversation to disk via MixMonitor.
  • URL - URL will be sent to the called party if the channel supports it.
  • announceoverride - Announcement file(s) to play to agent before bridging call, overriding the announcement(s) configured in queues.conf, if any.
    • announceoverride required
    • announceoverride2 (multiple)
  • timeout - Will cause the queue to fail out after a specified number of seconds, checked between each queues.conf timeout and retry cycle.
  • AGI - Will setup an AGI script to be executed on the calling party's channel once they are connected to a queue member.
  • gosub - Will run a gosub on the called party's channel (the queue member) once the parties are connected. The subroutine execution starts in the named context at the s exten and priority 1.
  • rule - Will cause the queue's defaultrule to be overridden by the rule specified.
  • position - Attempt to enter the caller into the queue at the numerical position specified. 1 would attempt to enter the caller at the head of the queue, and 3 would attempt to place the caller third in the queue.
Description

In addition to transferring the call, a call may be parked and then picked up by another user.

This application will return to the dialplan if the queue does not exist, or any of the join options cause the caller to not enter the queue.

This application does not automatically answer and should be preceded by an application such as Answer(), Progress(), or Ringing().

This application sets the following channel variables upon completion:

  • QUEUESTATUS - The status of the call as a text string.
    • TIMEOUT
    • FULL
    • JOINEMPTY
    • LEAVEEMPTY
    • JOINUNAVAIL
    • LEAVEUNAVAIL
    • CONTINUE
    • WITHDRAW
  • ABANDONED - If the call was not answered by an agent this variable will be TRUE.
    • TRUE
  • DIALEDPEERNUMBER - Resource of the agent that was dialed set on the outbound channel.
  • QUEUE_WITHDRAW_INFO - If the call was successfully withdrawn from the queue, and the withdraw request was provided with optional withdraw info, the withdraw info will be stored in this variable.
  • QUEUEWAIT - The total amount of time, in seconds, that the caller spent waiting in the queue before being connected to an agent.
  • QUEUEWAIT_MS - The total amount of time, in milliseconds, that the caller spent waiting in the queue before being connected to an agent.
  • ANSWEREDTIME - The amount of time, in seconds, that the caller spent connected to an agent. If the call was never answered, this will be set to 0.
  • ANSWEREDTIME_MS - The amount of time, in milliseconds, that the caller spent connected to an agent.
  • DIALEDTIME - The total amount of time, in seconds, from the start of the call until it ends. This matches the behavior of Dial().
  • DIALEDTIME_MS - The total amount of time, in milliseconds, from the start of the call until it ends.
Arguments
  • queuename required
  • options
    • b - Before initiating an outgoing call, Gosub to the specified location using the newly created channel. The Gosub will be executed for each destination channel.
      • context
      • exten
      • priority required
        • arg1 required (multiple)
        • argN
    • B - Before initiating the outgoing call(s), Gosub to the specified location using the current channel.
      • context
      • exten
      • priority required
        • arg1 required (multiple)
        • argN
    • C - Mark all calls as "answered elsewhere" when cancelled.
    • c - Continue in the dialplan if the callee hangs up.
    • d - Data-quality (modem) call (minimum delay). This option only applies to DAHDI channels. By default, DTMF is verified by muting audio TX/RX to verify the tone is still present. This option disables that behavior.
    • F - When the caller hangs up, transfer the called member to the specified destination and start execution at that location. NOTE: Any channel variables you want the called channel to inherit from the caller channel must be prefixed with one or two underbars ('_'). NOTE: Using this option from a Gosub() might not make sense as there would be no return points.
      • context
      • exten
      • priority required
    • h - Allow callee to hang up by pressing *.
    • H - Allow caller to hang up by pressing *.
    • i - Ignore call forward requests from queue members and do nothing when they are requested.
    • I - Asterisk will ignore any connected line update requests or any redirecting party update requests it may receive on this dial attempt.
    • k - Allow the called party to enable parking of the call by sending the DTMF sequence defined for call parking in features.conf.
    • K - Allow the calling party to enable parking of the call by sending the DTMF sequence defined for call parking in features.conf.
    • m - Custom music on hold class to use, which will override the music on hold class configured in queues.conf, if specified. Note that CHANNEL(musicclass), if set, will still override this option.
    • n - No retries on the timeout; will exit this application and go to the next step.
    • r - Ring instead of playing MOH. Periodic Announcements are still made, if applicable.
    • R - Ring instead of playing MOH when a member channel is actually ringing.
    • t - Allow the called user to transfer the calling user.
    • T - Allow the calling user to transfer the call.
    • x - Allow the called user to write the conversation to disk via MixMonitor.
    • X - Allow the calling user to write the conversation to disk via MixMonitor.
  • URL - URL will be sent to the called party if the channel supports it.
  • announceoverride - Announcement file(s) to play to agent before bridging call, overriding the announcement(s) configured in queues.conf, if any.
    • announceoverride required
    • announceoverride2 (multiple)
  • timeout - Will cause the queue to fail out after a specified number of seconds, checked between each queues.conf timeout and retry cycle.
  • AGI - Will setup an AGI script to be executed on the calling party's channel once they are connected to a queue member.
  • gosub - Will run a gosub on the called party's channel (the queue member) once the parties are connected. The subroutine execution starts in the named context at the s exten and priority 1.
  • rule - Will cause the queue's defaultrule to be overridden by the rule specified.
  • position - Attempt to enter the caller into the queue at the numerical position specified. 1 would attempt to enter the caller at the head of the queue, and 3 would attempt to place the caller third in the queue.
User Notes

Know a tip or gotcha for this topic? Share it below and help others.

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.
Applications
ConfBridge() MusicOnHold() StartMusicOnHold() StopMixMonitor() ADSIProg() AELSub() AGI() AMD() AddQueueMember() AgentLogin() AgentRequest() AlarmReceiver() Answer() AttendedTransfer() AudioSocket() Authenticate() Background() BackgroundDetect() BlindTransfer() Bridge() BridgeAdd() BridgeWait() Broadcast() Busy() CELGenUserEvent() CallCompletionCancel() CallCompletionRequest() ChanIsAvail() ChanSpy() ChangeMonitor() ChannelRedirect() ClearHash() ConfKick() Congestion() ContinueWhile() ControlPlayback() DAHDIAcceptR2Call() DAHDIRAS() DAHDIScan() DAHDISendCallreroutingFacility() DAHDISendKeypadFacility() DBdeltree() DISA() DateTime() DeadAGI() Dial() Dictate() Directory() DumpChan() EAGI() Echo() Else() ElseIf() EndIf() EndWhile() Exec() ExecIf() ExecIfTime() ExitIf() ExitWhile() ExtenSpy() ExternalIVR() Festival() Flash() FollowMe() ForkCDR() GetCPEID() Gosub() GosubIf() Goto() GotoIf() GotoIfTime() Hangup() HangupCauseClear() IAX2Provision() ICES() IVRDemo() If() ImportVar() Incomplete() JACK() JabberJoin() JabberLeave() JabberSend() JabberSendGroup() JabberStatus() Log() MP3Player() MSet() Macro() MacroExclusive() MacroExit() MacroIf() MailboxExists() MeetMe() MeetMeAdmin() MeetMeChannelAdmin() MeetMeCount() MessageSend() Milliwatt() MinivmAccMess() MinivmDelete() MinivmGreet() MinivmMWI() MinivmNotify() MinivmRecord() MixMonitor() Monitor() Morsecode() NBScat() NoCDR() NoOp() ODBCFinish() ODBC_Commit() ODBC_Rollback() OSPAuth() OSPFinish() OSPLookup() OSPNext() Originate() PJSIPHangup() PJSIPNotify() Page() Park() ParkAndAnnounce() ParkedCall() PauseMonitor() PauseQueueMember() Pickup() PickupChan() PlayTones() Playback() PrivacyManager() Proceeding() Progress() Queue() QueueLog() QueueUpdate() RaiseException() Read() ReadExten() ReceiveFAX() ReceiveMF() ReceiveSF() ReceiveText() Record() Reload() RemoveQueueMember() ResetCDR() RetryDial() Return() Ringing() SIPAddHeader() SIPDtmfMode() SIPRemoveHeader() SIPSendCustomINFO() SLAStation() SLATrunk() SMS() SayAlpha() SayAlphaCase() SayCountedAdj() SayCountedNoun() SayDigits() SayMoney() SayNumber() SayOrdinal() SayPhonetic() SayUnixTime() SendDTMF() SendFAX() SendImage() SendMF() SendSF() SendText() SendURL() Set() SetAMAFlags() Signal() SkelGuessNumber() SoftHangup() SpeechActivateGrammar() SpeechBackground() SpeechCreate() SpeechDeactivateGrammar() SpeechDestroy() SpeechLoadGrammar() SpeechProcessingSound() SpeechStart() SpeechUnloadGrammar() StackPop() Stasis() StatsD() StopMonitor() StopMusicOnHold() StopPlayTones() StoreDTMF() StreamEcho() System() TestClient() TestServer() ToneScan() Transfer() TryExec() TrySystem() UnpauseMonitor() UnpauseQueueMember() UserEvent() VMAuthenticate() VMSayName() Verbose() VoiceMail() VoiceMailMain() VoiceMailPlayMsg() Wait() WaitDigit() WaitExten() WaitForCondition() WaitForNoise() WaitForRing() WaitForSignal() WaitForSilence() WaitForTone() WaitUntil() While() Zapateller()
Applications
ConfBridge() MusicOnHold() StartMusicOnHold() StopMixMonitor() ADSIProg() AELSub() AGI() AMD() AddQueueMember() AgentLogin() AgentRequest() AlarmReceiver() Answer() AttendedTransfer() AudioSocket() Authenticate() Background() BackgroundDetect() BlindTransfer() Bridge() BridgeAdd() BridgeWait() Broadcast() Busy() CELGenUserEvent() CallCompletionCancel() CallCompletionRequest() ChanIsAvail() ChanSpy() ChangeMonitor() ChannelRedirect() ClearHash() ConfKick() Congestion() ContinueWhile() ControlPlayback() DAHDIAcceptR2Call() DAHDIRAS() DAHDIScan() DAHDISendCallreroutingFacility() DAHDISendKeypadFacility() DBdeltree() DISA() DateTime() DeadAGI() Dial() Dictate() Directory() DumpChan() EAGI() Echo() Else() ElseIf() EndIf() EndWhile() Exec() ExecIf() ExecIfTime() ExitIf() ExitWhile() ExtenSpy() ExternalIVR() Festival() Flash() FollowMe() ForkCDR() GetCPEID() Gosub() GosubIf() Goto() GotoIf() GotoIfTime() Hangup() HangupCauseClear() IAX2Provision() ICES() IVRDemo() If() ImportVar() Incomplete() JACK() JabberJoin() JabberLeave() JabberSend() JabberSendGroup() JabberStatus() Log() MP3Player() MSet() Macro() MacroExclusive() MacroExit() MacroIf() MailboxExists() MeetMe() MeetMeAdmin() MeetMeChannelAdmin() MeetMeCount() MessageSend() Milliwatt() MinivmAccMess() MinivmDelete() MinivmGreet() MinivmMWI() MinivmNotify() MinivmRecord() MixMonitor() Monitor() Morsecode() NBScat() NoCDR() NoOp() ODBCFinish() ODBC_Commit() ODBC_Rollback() OSPAuth() OSPFinish() OSPLookup() OSPNext() Originate() PJSIPHangup() PJSIPNotify() Page() Park() ParkAndAnnounce() ParkedCall() PauseMonitor() PauseQueueMember() Pickup() PickupChan() PlayTones() Playback() PrivacyManager() Proceeding() Progress() Queue() QueueLog() QueueUpdate() RaiseException() Read() ReadExten() ReceiveFAX() ReceiveMF() ReceiveSF() ReceiveText() Record() Reload() RemoveQueueMember() ResetCDR() RetryDial() Return() Ringing() SIPAddHeader() SIPDtmfMode() SIPRemoveHeader() SIPSendCustomINFO() SLAStation() SLATrunk() SMS() SayAlpha() SayAlphaCase() SayCountedAdj() SayCountedNoun() SayDigits() SayMoney() SayNumber() SayOrdinal() SayPhonetic() SayUnixTime() SendDTMF() SendFAX() SendImage() SendMF() SendSF() SendText() SendURL() Set() SetAMAFlags() Signal() SkelGuessNumber() SoftHangup() SpeechActivateGrammar() SpeechBackground() SpeechCreate() SpeechDeactivateGrammar() SpeechDestroy() SpeechLoadGrammar() SpeechProcessingSound() SpeechStart() SpeechUnloadGrammar() StackPop() Stasis() StatsD() StopMonitor() StopMusicOnHold() StopPlayTones() StoreDTMF() StreamEcho() System() TestClient() TestServer() ToneScan() Transfer() TryExec() TrySystem() UnpauseMonitor() UnpauseQueueMember() UserEvent() VMAuthenticate() VMSayName() Verbose() VoiceMail() VoiceMailMain() VoiceMailPlayMsg() Wait() WaitDigit() WaitExten() WaitForCondition() WaitForNoise() WaitForRing() WaitForSignal() WaitForSilence() WaitForTone() WaitUntil() While() Zapateller()