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

bindaddr = 0.0.0.0
                   [oreilly]
                   secret = notvery
                   ;deny=0.0.0.0/0.0.0.0
                   ;permit=209.16.236.73/255.255.255.0
                   read = system,call,log,verbose,command,agent,user
                   write = system,call,log,verbose,command,agent,user
               In the [general] section, you have to enable the service by setting the parameter enabled
               = yes. You will need to reload the Manager in order to have this change take effect
               (module reload manager from the Asterisk console). The TCP port defaults to 5038.
               Next, you create a section for each user that will authenticate to the system. For each
               user, you will specify the username in square brackets ([ ]), followed by the password
               for that user (secret), any IP addresses you wish to deny access to, any IP addresses you
               wish to permit access to, and the read and write permissions for that user.

                           It is very important to understand that other than a clear text password
                           and the ability to restrict IP addresses, there is no security of any kind
                           on the Manager interface. If you are running Manager on an untrusted
                           network (or have any other complex needs), you should consider using
                           David Troy’s excellent AstManProxy to handle all of your connections
                           to the manager API.

               Connecting to the Manager Interface

               It is important to keep in mind that the Manager interface is designed to be used by
               programs, not fingers. That’s not to say that you can’t issue commands to it directly—
               just don’t expect a typical console interface, because that’s not what Manager is for.
               Commands to Manager are delivered in packages with the following syntax (lines are
               terminated with CR+LF): †
                   Action: <action type>
                   Key 1: Value 1
                   Key 2: Value 2
                   etc ...
                   Variable: Value
                   Variable: Value
                   etc...
               For example, to authenticate with Manager (which is required if you expect to have
               any interaction whatsoever), you would send the following:




               † Carriage Return followed by Line Feed. This is popularly achieved by pressing the Enter key on the keyboard,
                 but there are differences across various OS platforms and programming languages, so if you are having trouble
                 with commands to the interface, it may be worth noting the exact character combination that is required. At
                 the  time  of  writing,  Wikipedia  had  a  respectable  writeup  on  this  concept  (http://en.wikipedia.org/wiki/
                 Newline).

               228 | Chapter 10: Asterisk Manager Interface (AMI) and Adhearsion
   251   252   253   254   255   256   257   258   259   260   261