The Dial application

We’ve already used the Dial application a number of times, so you probably know the primary purpose of this application – to connect two channels together. Channels do not have to be of the same type – you can connect a caller using SIP-based softphone with a caller using an ordinary analog phone.

This application takes up to four arguments:

  • destination
  • timeout
  • options
  • URL

Let’s take a closer look at each of these arguments.

Destination
The first parameter is the destination you’re attempting to call, in the form of Technology/Resource. For example, to dial a SIP peer defined in sip.conf as 100, you would use Dial(SIP/100). You can also dial multiple channels at the same time, by using the ampersand (&) character to concatenate the destinations:

exten => 200,1,Dial(SIP/alice&IAX2/200)

The line above specifies that the SIP peer alice and the IAX device 200 will ring simultaneously when the extension 200 is called. The call will be bridged with whichever destination channel answers first and the other channel will stop ringing.

Timeout
The optional timeout argument comes after the destination. If no timeout is specified, the channel will ring until someone answers or the caller hangs up. If a timeout is specified, the Dial application will attempt to call the specified destination for the number of seconds specified before giving up and moving on to the next priority in the extension.

Let’s modify our dialplan so that the channels will ring for 20 seconds, and play the nobody available message if the call is not answered within that time:

exten => 200,1,Dial(SIP/alice&IAX2/200,20)
 same => n,Playback(vm-nobodyavail)
 same => n,Hangup()

Options
The third argument is an option string. For example, the option m will provide the caller with the hold music instead of ringing until the call is answered. This could be specified as:

exten => 200,1,Dial(SIP/alice&IAX2/200,20,m)
If you don’t have a timeout specified, and you want to assign options, you must still assign a spot for the timeout. This is done by leaving the timeout argument blank, like this:
exten => 200,1,Dial(SIP/alice&IAX2/200,,m) 

 

URL
The last argument to the Dial application is a URL. The optional URL will be sent to the called party if the destination channel supports it. If you have an IP telephone that supports receiving a URL, it will appear on your phone’s display.

Geek University 2022