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

CHAPTER 5

                                                           Dialplan Basics
















                                                Everything should be made as simple as possible, but not
                                                                                  simpler.
                                                                —Albert Einstein (1879–1955)

               The dialplan is truly the heart of any Asterisk system, as it defines how Asterisk handles
               inbound and outbound calls. In a nutshell, it consists of a list of instructions or steps
               that Asterisk will follow. Unlike traditional phone systems, Asterisk’s dialplan is fully
               customizable. To successfully set up your own Asterisk system, you will need to un-
               derstand the dialplan.
               If you have attempted to read some sample dialplans and found them overwhelming,
               or if you’ve tried to write an Asterisk dialplan and had no success, help is at hand. This
               chapter explains how dialplans work in a step-by-step manner and teaches the skills
               necessary to create your own. The examples have been designed to build upon one
               another, so feel free to go back and reread a section if something doesn’t quite make
               sense. Please also note that this chapter is by no means an exhaustive survey of all the
               possible things dialplans can do; our aim is to cover just the fundamentals. We’ll cover
               more advanced dialplan topics in later chapters.

               Dialplan Syntax

               The Asterisk dialplan is specified in the configuration file named extensions.conf.


                           The extensions.conf file usually resides in the /etc/asterisk/ directory, but
                           its location may vary depending on how you installed Asterisk. Other
                           common  locations  for  this  file  include  /usr/local/asterisk/etc/
                           and /opt/asterisk/etc/.


               The dialplan is made up of four main concepts: contexts, extensions, priorities, and
               applications. In the next few sections, we’ll cover each of these parts and explain how


                                                                                     119
   142   143   144   145   146   147   148   149   150   151   152