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

on the phone’s display; likewise, if you’re using a soft phone, the URL might pop up
               on your computer screen). This argument is very rarely used.
               Note that the second, third, and fourth arguments may be left blank. For example, if
               you want to specify an option but not a timeout, simply leave the timeout argument
               blank, like this:
                   exten => 1,1,Dial(Zap/1,,m)

               Adding a Context for Internal Calls
               In our examples thus far, we have limited ourselves to a single context, but it is probably
               fair to assume that almost all Asterisk installations will have more than one context in
               their dialplans. As we mentioned at the beginning of this chapter, one important func-
               tion of contexts is to separate privileges (such as making long-distance calls or calling
               certain extensions) for different classes of callers. In our next example, we’ll add to our
               dialplan by creating two internal phone extensions, and we’ll set up the ability for these
               two extensions to call each other. To accomplish this, we’ll create a new context called
               [employees].


                           As in previous examples, we’ve assumed that an FXS analog channel
                           (Zap/1,  in  this  case)  has  already  been  configured,  and  that  your
                           zapata.conf file is configured so that any calls originated by Zap/1 begin
                           in the [employees] context. For a few examples at the end of the chapter,
                           we’ll also assume that an FXO Zap channel has been configured as Zap/
                           4, with calls coming in on this channel being sent to the [incoming]
                           context.
                           We’ve also assumed you have at least one SIP channel (named SIP/
                           Jane) that is configured to originate in the [employees] context. We’ve
                           done this to introduce you to using other types of channels.
                           If you don’t have hardware for the channels listed above (such as Zap/
                           4), or if you’re using hardware with different channel names (e.g., not
                           SIP/Jane), just change the examples to match your particular system
                           configuration.

               Our dialplan now looks like this:
                   [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)


                                                                Building an Interactive Dialplan | 133
   156   157   158   159   160   161   162   163   164   165   166