VMware ESXi and vSphere Cluster Management

Asterisk Dialplan Applications

Learn how Asterisk dialplan applications execute actions on channels, use arguments, and advance through priorities with practical examples.

An Asterisk application is a dialplan command that performs an action for the channel currently processing an extension. The dialplan is the routing and call-processing logic that tells Asterisk what to do with a call.

Applications form the action portion of each dialplan step. For example, Answer() answers a channel, Playback(tt-weasels) plays an audio prompt, and Hangup() terminates the channel.

Applications in the Dialplan

A dialplan step is associated with a context, an extension, and a priority. The extension identifies the call-processing path, while the priority determines the order in which its application steps run.

  • Context: A named dialplan section that groups extensions and controls which call logic is reachable.
  • Extension: A dialplan match or destination containing an ordered sequence of application steps.
  • Priority: The sequence position of an application step within an extension.
  • Application: The executable action performed for the current channel.
  • Channel technology: The driver mechanism used to place or receive calls through a particular protocol or interface, such as a SIP-based technology.
  • Variable: A named value that can be read or changed by dialplan logic. A variable is data, not an application.

A channel is the active call leg or communication path being processed by Asterisk. Applications operate on that channel, although some applications also create or connect to other channels.

How an Extension Executes Applications

Each extension can contain an ordered sequence of application steps. Asterisk normally begins at the first priority and advances through later priorities in order. The application at each priority executes before the next step is selected.

[example-applications]
exten => 100,1,Answer()
 same => n,Playback(tt-weasels)
 same => n,Hangup()

In this example, the call enters extension 100 in the example-applications context. Asterisk answers the channel, plays the prompt, and then hangs up.

Normal sequential execution is not guaranteed after every application. An application can fail, terminate the channel, set a result used by later logic, or cause dialplan flow to branch. For example, Hangup() ends the active channel, so no later application in that path can run. Applications such as Dial() can also produce a result that a later step may inspect when handling success or failure.

Application Syntax

The standard forms are:

same => n,Application(arguments)
exten => extension,priority,Application(arguments)

The application name identifies the action. The optional parenthesized argument list supplies values that control that action. The exact formatting is application-specific.

  • Commas generally separate individual arguments.
  • An application may accept multiple arguments.
  • Some applications require arguments.
  • Some applications accept no arguments.
  • Required arguments must be supplied in the order defined by that application's documentation.

For example, Playback(sound-name) has one argument identifying a sound resource, while a dialing application usually receives a destination expression such as SIP/alice. Do not assume that the argument rules for one application apply to another.

Applications With Required Arguments

Arguments give an application the information needed to perform its action. Depending on the application, an argument may identify a target channel, sound prompt, destination, recording location, queue, database key, or operating option.

Dial() needs a destination. Playback() needs a sound resource. Recording, queue, and database-oriented applications also require application-specific values describing what to record, where to distribute a call, or which data item to access.

Use the Asterisk CLI to inspect the syntax provided by the installed version:

asterisk -rx "core show application Playback"
asterisk -rx "core show application Dial"
asterisk -rx "core show applications"

Local application help is important because available options, module names, and channel technology support depend on the Asterisk installation.

Applications Without Arguments

Some applications need no arguments because their action applies directly to the current channel.

  • Answer() answers the current channel.
  • Hangup() terminates the current channel.

Answer() is commonly placed before media handling when the call path requires the channel to be answered before audio is delivered. This makes the call active for subsequent media operations such as Playback(). The exact behavior can depend on the signaling technology and call state.

Hangup() deliberately ends the active call. Including it at the end of a short call flow makes the intended end-of-call behavior clear instead of relying on accidental fall-through.

Representative Applications

ApplicationPrimary purposeRequires argumentsExample formEffect on current channel
AnswerAnswer the callNoAnswer()Answers the current channel
HangupTerminate the callNoHangup()Ends the current channel
PlaybackPlay an audio promptUsually yesPlayback(tt-weasels)Plays a sound resource to the caller
DialAttempt an outbound connectionYesDial(SIP/alice)Attempts to connect the current call to a destination

Call Handling and Connection Applications

Call handling applications connect, redirect, answer, or otherwise manage calls. Dial() is a central example. It attempts to call one or more destinations using a channel technology and an endpoint or resource identifier.

A dial string such as SIP/alice contains a technology prefix, SIP, and a destination identifier, alice. The actual technology prefixes and endpoint names depend on the installed channel driver and its configuration. A system using a different driver may require a different technology expression.

[example-applications]
exten => 101,1,Dial(SIP/alice)
 same => n,Hangup()

The destination must exist and be usable by the configured channel technology. A successful or unsuccessful dial attempt can affect what the next dialplan step should do, so production call flows should include deliberate handling for failure conditions.

Media Applications

Media applications play or manipulate audio on a channel. Playback() plays an audio prompt to the caller on the current channel.

same => n,Playback(tt-weasels)

tt-weasels is a sound file identifier or sound resource name. Dialplan authors normally use the identifier rather than assuming a filesystem extension such as .wav is required. Asterisk selects an appropriate installed prompt resource and format according to its sound-file configuration and language settings.

Other Application Categories

  • Recording and voice capture: Capture audio from a channel and save it using a configured recording name or location.
  • Call distribution: Place callers into queues or distribute calls to available agents.
  • Data and database operations: Read, write, or query information used by call-processing logic.
  • Call control: Answer, transfer, redirect, branch, or otherwise change the call flow.
  • Termination: End a channel or stop a particular call-processing path.

These categories describe common purposes, not a universal syntax. Always check the documentation for the specific installed application.

Priorities and Execution Order

A priority is the execution order assigned to an application step within an extension. When an extension has multiple actions, priorities tell Asterisk which action runs first, second, and so on.

StyleUse caseExampleNotes
Explicit numeric priorityWriting every sequence position directlyexten => 100,1,Answer()Clear for short examples; later insertions require renumbering
Automatic next priority using nContinuing from the previous stepsame => n,Playback(tt-weasels)n means the next sequential priority
Named labelProviding readable destinations for branchessame => n(failed),Hangup()Labels identify a location in the dialplan; their exact use depends on the branching application

The n priority shortcut improves maintainability because adding a step does not require manually renumbering every later step.

[example-applications]
exten => 100,1,Answer()
 same => n,Playback(tt-weasels)
 same => n,Hangup()

This sequence demonstrates why priorities matter: answering, playing media, and ending the call are separate applications, and their order changes the call behavior.

Parts of an Application Step

PartMeaningExample
ExtensionThe dialplan match or destination being processed100
PriorityThe step's execution position1 or n
Application nameThe action Asterisk executesPlayback
ArgumentsValues passed to the applicationtt-weasels

Safe Dialplan Authoring Practices

  • Use consistent indentation so the execution sequence is easy to inspect.
  • Use one application per dialplan step.
  • Supply required arguments in the documented order.
  • Use explicit failure or error handling when an application can fail.
  • Include deliberate end-of-call behavior, such as Hangup(), when the call should end.
  • Validate syntax and confirm application availability on the target installation.
  • Test new call paths with verbose CLI output before relying on them in production.

Troubleshooting Applications

Application Does Not Exist

If Asterisk reports that an application cannot be found, the application module may not be installed or loaded, the name may be misspelled, or the deployed Asterisk version may not provide it.

  1. List installed applications with core show applications.
  2. Request application-specific help with core show application ApplicationName.
  3. Verify the relevant module and package installation.

Playback Does Not Produce the Expected Audio

Check the sound identifier, the installed prompt set, and the selected language. Also verify that the channel is answered when the call path requires an answer before media handling.

Dial Fails Immediately

Check whether the dial string uses the correct technology and endpoint name. Confirm that the endpoint is available or registered and that the configured channel driver matches the technology used in the dialplan. Use local Dial() help and inspect verbose CLI output during a test call.

Later Steps Are Skipped

Review the priority numbers and n usage for missing, duplicated, or incorrectly ordered steps. Also check whether an earlier application intentionally changes dialplan flow or terminates the channel. A malformed extension definition can prevent the expected path from loading.

Configuration Changes Are Not Active

Reload the dialplan, display the active context and extension, and place a new test call. An existing call may already be executing an earlier path, and an edited file has no effect if it is not included by the loaded configuration.

Key Points

  • An application is the executable action performed for the current channel.
  • An extension contains an ordered sequence of application steps.
  • Priorities determine normal execution order; n selects the next sequential priority.
  • Arguments are application-specific and commonly identify destinations, prompts, recordings, queues, data, or options.
  • Answer() and Hangup() are representative no-argument applications.
  • Dial() uses a destination expression such as SIP/alice, while Playback() uses a sound identifier such as tt-weasels.
  • Application availability and syntax must be verified on the target Asterisk installation.