Directory()

Since 0.1.0 Applications Found this useful? Upvote it. ×

Provide directory of [[term:voicemail|voicemail]] extensions.

Last reviewed 2026-08-22

Directory([vm-[[term:context|context]],dial-context,options])
Dialplan Builder -- build your Directory() command
This is the context within voicemail.conf to use for the Directory. If not specified and `searchcontexts=no` in `voicemail.conf`, then `default` will be assumed.
This is the [[term:dialplan|dialplan]] context to use when looking for an extension that the user has selected, or when jumping to the `o` or `a` extension. If not specified, the current context will be used.
Allow the caller to additionally enter an alias for a user in the directory. This option must be specified in addition to the `f`, `l`, or `b` option.
Allow the caller to enter either the first or the last name of a user in the directory. If specified, the optional number argument will be used for the number of characters the user should enter.
Load the specified config file instead of voicemail.conf
Enable ADSI support for screen phone searching and retrieval of directory results. Additionally, the channel must be ADSI-enabled and you must have an ADSI-compatible (Type III) CPE for this to work.
In addition to the name, also read the extension number to the caller before presenting dialing options.
Allow the caller to enter the first name of a user in the directory instead of using the last name. If specified, the optional number argument will be used for the number of characters the user should enter.
Allow the caller to enter the last name of a user in the directory. This is the default. If specified, the optional number argument will be used for the number of characters the user should enter.
Instead of reading each name sequentially and asking for confirmation, create a menu of up to 8 names.
Read digits even if the channel is not answered.
Pause for n milliseconds after the digits are typed. This is helpful for people with cellphones, who are not holding the receiver to their ear while entering DTMF.
Skip calling the extension, instead set it in the **DIRECTORY_EXTEN** channel variable.
Full arguments reference
  • vm-context - This is the context within voicemail.conf to use for the Directory. If not specified and searchcontexts=no in voicemail.conf, then default will be assumed.
  • dial-context - This is the dialplanThe core call-routing configuration of Asterisk, written mostly in extensions.conf as contexts, extensions, and priorities that decide how every call is handled. Full definition → context to use when looking for an extension that the user has selected, or when jumping to the o or a extension. If not specified, the current context will be used.
  • options
    • e - In addition to the name, also read the extension number to the caller before presenting dialing options.
    • f - Allow the caller to enter the first name of a user in the directory instead of using the last name. If specified, the optional number argument will be used for the number of characters the user should enter.
      • n required
    • l - Allow the caller to enter the last name of a user in the directory. This is the default. If specified, the optional number argument will be used for the number of characters the user should enter.
      • n required
    • b - Allow the caller to enter either the first or the last name of a user in the directory. If specified, the optional number argument will be used for the number of characters the user should enter.
      • n required
    • a - Allow the caller to additionally enter an alias for a user in the directory. This option must be specified in addition to the f, l, or b option.
    • m - Instead of reading each name sequentially and asking for confirmation, create a menu of up to 8 names.
    • n - Read digits even if the channel is not answered.
    • p - Pause for n milliseconds after the digits are typed. This is helpful for people with cellphones, who are not holding the receiver to their ear while entering DTMF.
      • n required
    • c - Load the specified config file instead of voicemail.conf
      • filename required
    • s - Skip calling the extension, instead set it in the DIRECTORY_EXTEN channel variable.
    • d - Enable ADSI support for screen phone searching and retrieval of directory results. Additionally, the channel must be ADSI-enabled and you must have an ADSI-compatible (Type III) CPE for this to work.
Description

This application will present the calling channelA single call leg passing through Asterisk. Channels represent connections to endpoints and are what dialplan applications act on. with a directory of extensions from which they can search by name. The list of names and corresponding extensions is retrieved from the voicemail configuration file, voicemail.conf, or from the specified filename.

This application will immediately exit if one of the following DTMFDual-Tone Multi-Frequency, the touch-tone signals phones send for digit input during a call, used by IVRs and feature codes. digits are received and the extensionA dialplan entry that matches a dialed number or pattern within a context and triggers a sequence of prioritized steps. to jump to exists:

0 - Jump to the 'o' extension, if it exists.

* - Jump to the 'a' extension, if it exists.

This application will set the following channel variables before completion:

  • DIRECTORY_RESULT - Reason Directory application exited.
    • OPERATOR - User requested operator
    • ASSISTANT - User requested assistant
    • TIMEOUT - User allowed DTMF wait duration to pass without sending DTMF
    • HANGUP - The channel hung up before the application finished
    • SELECTED - User selected a user to call from the directory
    • USEREXIT - User exited with '#' during selection
    • FAILED - The application failed
  • DIRECTORY_EXTEN - If the skip calling option is set this will be set to the selected extension provided one is selected.
Arguments
  • vm-context - This is the context within voicemail.conf to use for the Directory. If not specified and searchcontexts=no in voicemail.conf, then default will be assumed.
  • dial-context - This is the dialplanThe core call-routing configuration of Asterisk, written mostly in extensions.conf as contexts, extensions, and priorities that decide how every call is handled. Full definition → context to use when looking for an extension that the user has selected, or when jumping to the o or a extension. If not specified, the current context will be used.
  • options
    • e - In addition to the name, also read the extension number to the caller before presenting dialing options.
    • f - Allow the caller to enter the first name of a user in the directory instead of using the last name. If specified, the optional number argument will be used for the number of characters the user should enter.
      • n required
    • l - Allow the caller to enter the last name of a user in the directory. This is the default. If specified, the optional number argument will be used for the number of characters the user should enter.
      • n required
    • b - Allow the caller to enter either the first or the last name of a user in the directory. If specified, the optional number argument will be used for the number of characters the user should enter.
      • n required
    • a - Allow the caller to additionally enter an alias for a user in the directory. This option must be specified in addition to the f, l, or b option.
    • m - Instead of reading each name sequentially and asking for confirmation, create a menu of up to 8 names.
    • n - Read digits even if the channel is not answered.
    • p - Pause for n milliseconds after the digits are typed. This is helpful for people with cellphones, who are not holding the receiver to their ear while entering DTMF.
      • n required
    • c - Load the specified config file instead of voicemail.conf
      • filename required
    • s - Skip calling the extension, instead set it in the DIRECTORY_EXTEN channel variable.
    • d - Enable ADSI support for screen phone searching and retrieval of directory results. Additionally, the channel must be ADSI-enabled and you must have an ADSI-compatible (Type III) CPE for this to work.
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
MusicOnHold() 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() ConfBridge() 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() Reference section rework and a batch of audio converter improvements 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() StartMusicOnHold() Stasis() StatsD() StopMixMonitor() StopMonitor() StopMusicOnHold() StopPlayTones() StoreDTMF() StreamEcho() 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
MusicOnHold() 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() ConfBridge() 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() Reference section rework and a batch of audio converter improvements 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() StartMusicOnHold() Stasis() StatsD() StopMixMonitor() StopMonitor() StopMusicOnHold() StopPlayTones() StoreDTMF() StreamEcho() 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()