Appendix B. Applications in the dialplan

This section is a comprehensive description of the applications available for use in the dialplan (/etc/asterisk/extensions.conf). To use an application, the module to which it belongs must be loaded; this is configured in the [modules] section of /etc/asterisk/modules.conf with autoload=yes or explicitly with load => app_applicationname.so. You can see which modules and applications are available in Asterisk with by entering show applications or show application application_name (Asterisk 1.2) and core show applications oder core show application application_name (Asterisk 1.4).

Take care not to confuse applications or commands with functions. When required, functions are called within commands in the dialplan. "Application" is perhaps too expansive a term but it is the convention in Asterisk when referring to dialplan commands.

It is often possible to omit parameters entirely. In those cases, it is still necessary to include the comma delimiter to establish that a parameter is empty or not provided (i.e. that the default value should be used). For example:

exten => s,1,Dial(IAX2/User:password@example.com/123,,tT)

In general, if an application exits with an error it will return -1, if successful it returns a 0. A return value of -1 means that Asterisk will hang up the channel without passing it along the dialplan.

[Important]

Be sure to separate parameters with the "," (comma) or "|" (pipe) depending on the version of Asterisk. In this book we use the "," primarily.

Anyone who has used Asterisk for some time already might wonder why one or another application is not included here. The missing applications have been deprecated in Asterisk 1.2 and have ceased to exist altogether in Asterisk 1.4. The corresponding functions which replace them can be found in Appendix C, Functions in the dialplan. The diff output of the built-in help files provided is always shown from the newer 1.4 to the older 1.2.

In the examples the arbitrarily chosen extension 123 and priority 1 are used, just for the purposes of illustration.

Before Asterisk 1.2, many applications jumped to priority n+101, if present, in case of an error (where n is the current priority). This old behavior (called "priority jumping") can be re-enabled with the option j (jump) for some commands or globally via the parameter priorityjumping=yes in the [general] section of extensions.conf. This method, however, is now deprecated. The objectives once met by priority jumping are now achieved by calling defined channel variables, which are considerably more powerful.

To enhance the utility of this book as a reference, the applications are listed in alphabetical order. They also can be arranged into logical categories, shown here:

Call handling (pick-up, transfer, hang-up, ...)

the section called “Answer() - Answer
the section called “Busy() - Signal busy to caller
the section called “ChanIsAvail() - Check to see if a channel is available
the section called “ChannelRedirect() - Redirect a channel to another extension and/or priority
the section called “Congestion() - Signal congestion to caller
the section called “Dial() - Initiate a call to a channel / connect to a channel
the section called “DISA() - DISA (Direct Inward System Access)
the section called “FollowMe() - "follow me" function
the section called “Hangup() - Hang up
the section called “Page() - Page multiple devices
the section called “Park() - Park call
the section called “Pickup() - Call pickup
the section called “RetryDial() - Dial() with auto-redial
the section called “Ringing() - Signal ringing to caller

Flow control and timeouts

the section called “ContinueWhile() - Jump to the beginning of a While() loop
the section called “EndWhile() - End a While() loop
the section called “Exec() - Launch an application
the section called “ExecIf() - Conditional launch of an application
the section called “ExecIfTime() - Time conditional launch of an application
the section called “ExitWhile() - Break a While() loop
the section called “Gosub() - Go to a subroutine
the section called “GosubIf() - Conditional Gosub()
the section called “Goto() - Go to another priority, and/or extension and/or context
the section called “GotoIf() - Conditional Goto()
the section called “GotoIfTime() - Time conditional Gosub()
the section called “Random() - Go to a random entry in the dialplan
the section called “Return() - Return to priority from which Gosub() and GosubIf() was called
the section called “TryExec() - Attempt to launch an application and get the return code
the section called “While() - Start a while loop

Macros

the section called “Macro() - Call a macro
the section called “MacroExclusive() - Call a macro only once at a time
the section called “MacroExit() - Exit from the macro
the section called “MacroIf() - Conditional call of a macro

Caller detection, presentation and handling

the section called “CallingPres() - Change the caller presentation on PRI circuits
the section called “LookupBlacklist() - Look up the caller ID in the blacklist
the section called “LookupCIDName() - Look up the caller ID name in the database
the section called “PrivacyManager() - Request that the caller enter the originating number if no caller ID is available
the section called “SetCallerPres() - Set the caller ID independently of the calling channel
the section called “SoftHangup() - Request a hangup
the section called “Zapateller() - Block telephone solicitations

Call detail records (CDRs)

the section called “AppendCDRUserField() - Append a value to the CDR 'user' field
the section called “ForkCDR() - Creates an additional CDR for the current call
the section called “NoCDR() - Disable CDR for this call
the section called “ResetCDR() - Resets the current CDR
the section called “SetAMAFlags() - Set AMA flags
the section called “SetCDRUserField() - Sets the CDR 'user' field

Voicemail

the section called “Directory() - Provide the "Dial-by-Name" directory
the section called “mailboxExists() - Checks if the mailbox exists
the section called “VoiceMail() - Voicemail engine
the section called “VoiceMailMain() - Voicemail retrieval engine
the section called “VMAuthenticate() - Authenticates the user using user information contained in voicemail.conf

Conferences

the section called “MeetMe() - MeetMe conference
the section called “MeetMeAdmin() - Administer a MeetMe conference
the section called “MeetMeCount() - Provides a count of the participants in a MeetMe conference

Variable handling

the section called “ImportVar() - Import a variable from a channel
the section called “Read() - Read digits from a user into a variable
the section called “ReadFile() - Read a file into a variable
the section called “RealTime() - Read a value from the realtime system into a variable
the section called “RealTimeUpdate() - Change a variable in the realtime system
the section called “Set() - Set a channel variable
the section called “SetGlobalVar() - Set a global variable

Sound files & Music-on-Hold

the section called “Background() - Play a sound file while proceeding to the next priority
the section called “BackgroundDetect() - Background() with sound detection
the section called “ControlPlayback() - Playback() with user playback controls
the section called “DateTime() - Say the date and time
the section called “Echo() - Echo received sound to the user
the section called “Festival() - Read text as speech using the Festival Text-To-Speech engine
the section called “Milliwatt() - Provide a constant 1004 Hz tone at 0 db
the section called “MP3Player() - Play an mp3 file or stream
the section called “MusicOnHold() - Play music-on-hold
the section called “NBScat() - Play an NBS stream
the section called “Playback() - Play a sound file
the section called “Playtones() - Play a tone
the section called “Progress() - Provide the calling channel with in-band progress sounds
the section called “SayAlpha() - Spell out an alphanumeric string
the section called “SayDigits() - Say digits
the section called “SayNumber() - Say a number
the section called “SayPhonetic() - Spell out a string using the phonetic alphabet
the section called “SayUnixTime() - Say the Unix time
the section called “SetMusicOnHold() - Set the Music-on-Hold class
the section called “StopPlaytones() - Stops Playtones()

Recording and Monitoring

the section called “AgentMonitorOutgoing() - Record the outgoing calls of a call agent
the section called “ChangeMonitor() - Changes the filename prefix of a specific channel for Monitor()
the section called “ChanSpy() - Eavesdrop on an active channel
the section called “Dial() - Record a conversation (when used with option w or W)
the section called “Dictate() - A virtual dictation machine
the section called “ExtenSpy() - Eavesdrop on an active channel, and whisper to the originating caller
the section called “MixMonitor() - Like Monitor() but mixes both legs into a single file
the section called “Monitor() - Records each leg (incoming and outgoing) of a call in separate files
the section called “PauseMonitor() - Pauses recording
the section called “Record() - Records only incoming audio
the section called “StopMonitor() - Stop recording with Monitor()
the section called “UnpauseMonitor() - Resumes recording
the section called “ZapBarge() - Eavesdrop on a ZAP channel
the section called “ZapScan() - Eavesdrop on Zap channels and switch easily between them

Database operations

the section called “DBdel() - Erase a record from the database
the section called “DBdeltree() - Erase a branch from the database

General

the section called “Authenticate() - Authenticate a user
the section called “SendDTMF() - Send DTMF tones
the section called “SendImage() - Send an image
the section called “SendText() - Send text
the section called “SendURL() - Send a URL
the section called “Transfer() - Transfer a call
the section called “VMAuthenticate() - Authenticate a user configured in voicemail.conf
the section called “Wait() - Wait for a specified time
the section called “WaitExten() - Wait for the user to dial an extension for specified time
the section called “WaitForRing() - Wait for ring
the section called “WaitForSilence() - Wait for silence
the section called “WaitMusicOnHold() - Wait while providing music-on-hold to caller

External applications

the section called “AGI() - Execute an AGI script
the section called “DeadAGI() - AGI() on an inactive channel
the section called “DumpChan() - Dump information about a channel to the CLI
the section called “EAGI() - See AGI()
the section called “ExternalIVR() - Call an external IVR generator
the section called “FastAGI() - AGI() on another server
the section called “Log() - Log a message at the specified verbosity level
the section called “Macro() - Execute a macro
the section called “NoOp() - No operation; write debugging information to the CLI
the section called “Perl() - res_perl is like mod_perl for Apache, only for Asterisk
the section called “PHP() - res_php is like mod_php for Apache, only for Asterisk
the section called “Read() - Read digits from a user into a variable
the section called “System() - Execute a shell command
the section called “TrySystem() - Like System(), but always returns 0
the section called “UserEvent() - Send an event to the Manager interface
the section called “Verbose() - Send a message to the CLI at the specified verbosity level

SIP

the section called “SIPdtmfMode() - Change the SIP DTMF mode for a SIP originated call
the section called “SIPAddHeader() - Add a SIP header for an outgoing call

ZAP

the section called “Flash() - Send a flash-hook on a ZAP trunk
the section called “ZapBarge() - Eavesdrop on a ZAP channel
the section called “ZapRAS() - Enable RAS (Remote Access Server) on a ZAP ISDN channel
the section called “ZapScan() - Eavesdrop on Zap channels and switch easily between them

Queues and call center functions

the section called “AddQueueMember() - Dynamically add an interface to a queue
the section called “AgentCallbackLogin() - Log-in a queue agent (with call back)
the section called “AgentLogin() - Log-in a queue agent
the section called “AgentMonitorOutgoing() - Record outgoing call of an agent
the section called “ParkAndAnnounce() - Park a call and announce it
the section called “ParkedCall() - Pick up a parked call
the section called “PauseQueueMember() - Pause a queue member
the section called “Queue() - Send a call to the queue
the section called “QueueLog() - Write a message to the queue log
the section called “RemoveQueueMember() - Remove an interface from the queue
the section called “UnpauseQueueMember() - Resume a paused queue member

ADSI

the section called “ADSIProg() - Load an ADSI script into an ADSI telephone device
the section called “GetCPEID() - Request the ADSI-CPE-ID from an ADSI telephone device

Miscellaneous

the section called “AMD() - Answering machine detection
the section called “AlarmReceiver() - Receive and process alarm system events in Contact-ID format from an Ademco alarm panel
the section called “IAX2Provision() - Provision an IAXy device
the section called “Morsecode() - Send text as Morse code
the section called “SetTransferCapability() - Set ISDN transfer capability
the section called “SMS() - Send or receive SMS messages