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

Allowing remote connections
               Here is the user definition for the dundi user:
                   [dundi]
                   type=user
                   dbsecret=dundi/secret
                   context=dundi-local
                   disallow=all
                   allow=ulaw
                   allow=g726
               Instead of using a static password, Asterisk regenerates passwords every 3,600 seconds
               (1 hour). The value is stored in /dundi/secret of the Asterisk database and advertised
               using the ${SECRET} variable defined within the mapping context lines in dundi.conf.
               You can see the current keys for all peers, including your local public and private keys,
               by performing a show keys at the Asterisk CLI.
               The context entry dundi-local is where authorized callers are sent in extensions.conf.
               From there, we can manipulate the call just as we would in the dialplan of any other
               incoming connection.

               Configuring the dialplan
               The extensions.conf file handles what numbers you advertise and what you do with the
               calls that connect to them. The dundi-local context performs double duty:

                 • It controls the numbers we advertise, referenced by the dundi mapping context in
                   dundi.conf.
                 • It controls what to do with the call, referenced by the dundi user in iax.conf.
               You have the power of dialplan pattern matching to advertise ranges of numbers and
               to control the incoming calls. In the following dialplan, we are only advertising the
               number +1-416-555-1212, but pattern matching could just as easily have been em-
               ployed to advertise a range of numbers or extensions:
                   [dundi-local]
                   exten => 14165551212,1,NoOp(dundi-local: Number advertisement and incoming)
                   exten => 14165551212,n,Answer()
                   exten => 14165551212,n(call),Dial(SIP/1000)
                   exten => 14165551212,n,Voicemail(u1000)
                   exten => 14165551212,n,Hangup()
                   exten => 14165551212,n(call)+101,Voicemail(b1000)
                   exten => 14165551212,n,Hangup()

               Alternative Voicemail Storage Methods

               Asterisk’s normal way of storing voicemail is to simply record the message in a file,
               which is placed on the local hard drive under the /var/spool/asterisk/voicemail tree.
               While this works well enough for simple PBX deployments, there are more advanced



               312 | Chapter 14: Potpourri
   335   336   337   338   339   340   341   342   343   344   345