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

In the next chapter, we’ll cover how to jump between different priorities based on
               dialplan logic. You’ll be seeing a lot more of priority labels, and you will be using them
               often in your dialplans.

               Applications

               Applications are the workhorses of the dialplan. Each application performs a specific
               action on the current channel, such as playing a sound, accepting touch-tone input,
               dialing a channel, hanging up the call, and so forth. In the previous example, you were
               introduced to two simple applications: Answer() and Hangup(). You’ll learn more about
               how these work momentarily.
               Some applications, such as Answer()and Hangup(), need no other instructions to do their
               jobs. Other applications require additional information. These pieces of information,
               called arguments, can be passed on to the applications to affect how they perform their
               actions. To pass arguments to an application, place them between the parentheses that
               follow the application name, separated by commas.


                           Occasionally, you may also see the pipe character (|) being used as a
                           separator  between  arguments,  instead  of  a  comma.  Feel  free  to  use
                           whichever you prefer. For the examples in this book, we will be using
                           the comma to separate arguments to an application, as the authors pre-
                           fer the look of this syntax. You should be aware, however, that when
                           Asterisk parses the dialplan, it converts any commas in the application
                           arguments to pipes.


               As we build our first dialplan in the next section, you’ll learn to use applications (and
               their associated arguments) to your advantage.


               A Simple Dialplan

               Now we’re ready to create our first dialplan. We’ll start with a very simple example.
               We are going to instruct Asterisk to answer a call, play a sound file, and hang up. We’ll
               use this simple example to point out the most important dialplan fundamentals.
               For the examples in this chapter to work correctly, we’re assuming that at least one
               channel (either Zap, SIP, or IAX2) has been created and configured (as described in the
               previous chapter), and that all calls coming into that channel enter the dialplan at the
               [incoming] context. If you have been creative with any previous examples, you may
               need to make adjustments to fit your particular channel names.









               124 | Chapter 5: Dialplan Basics
   147   148   149   150   151   152   153   154   155   156   157