Page 160 - Asterisk™: The Future of Telephony
P. 160

If the call is answered before the timeout, the channels are bridged and the dialplan is
               done. If the destination simply does not answer, is busy, or is otherwise unavailable,
               Asterisk will set a variable called DIALSTATUS and then continue on with the next priority
               in the extension.

               Let’s put what we’ve learned so far into another example:
                   exten => 123,1,Dial(Zap/1,10)
                   exten => 123,n,Playback(vm-nobodyavail)
                   exten => 123,n,Hangup()
               As you can see, this example will play the vm-nobodyavail.gsm sound file if the call goes
               unanswered.
               The third argument to Dial() is an option string. It may contain one or more characters
               that modify the behavior of the Dial() application. While the list of possible options
               is too long to cover here, one of the most popular options is the m option. If you place
               the letter m as the third argument, the calling party will hear hold music instead of
               ringing while the destination channel is being called (assuming, of course, that music
               on hold has been configured correctly). To add the m option to our last example, we
               simply change the first line:
                   exten => 123,1,Dial(Zap/1,10,m)
                   exten => 123,n,Playback(vm-nobodyavail)
                   exten => 123,n,Hangup()
               Since the extensions numbered 1 and 2 in our dialplan are somewhat useless now that
               we know how to use the Dial() application, let’s replace them with new extensions
               that will allow outside callers to reach John and Jane:

                   [incoming]
                   exten => 123,1,Answer()
                   exten => 123,n,Background(enter-ext-of-person)
                   exten => 123,n,WaitExten()

                   exten => 1,1,Dial(Zap/1,10)
                   exten => 1,n,Playback(vm-nobodyavail)
                   exten => 1,n,Hangup()
                   exten => 2,1,Dial(SIP/Jane,10)
                   exten => 2,n,Playback(vm-nobodyavail)
                   exten => 2,n,Hangup()
                   exten => i,1,Playback(pbx-invalid)
                   exten => i,n,Goto(incoming,123,1)

                   exten => t,1,Playback(vm-goodbye)
                   exten => t,n,Hangup()
               The fourth and final argument to the Dial() application is a URL. If the destination
               channel supports receiving a URL at the time of the call, the specified URL will be sent
               (for example, if you have an IP telephone that supports receiving a URL, it will appear




               132 | Chapter 5: Dialplan Basics
   155   156   157   158   159   160   161   162   163   164   165