10.4. ManagerAsterisk Manager provides an API that allows external programs the ability to create, monitor and manage Asterisk. [*] The Manager interface is a powerful mechanism for integrating external programs of all kinds into Asterisk.
To use the Manager, you must define an account in the file /etc/asterisk/manager.conf . This file will look something like this: [general] enabled = yes
port = 5038 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 . The TCP port to use will default to 5038. 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. 10.4.1. Manager CommandsIt 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 directlyjust 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 CRLF): 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: Action: login Username: oreilly Secret: notvery <CRLF> An extra CRLF on a blank line will send the entire package to Manager. Once authenticated, you will be able to initiate actions, as well as see events generated by Asterisk. On a busy system, this can get quite complicated and become totally impossible to keep track of with the unaided eye. 10.4.2. The Flash Operator PanelThe Flash Operator Panel (FOP) is far and away the most popular example of the power of the Manager interface. FOP creates a web-based visual view of your system and allows you control of calls. FOP is most commonly used to enable a live attendant to view the users in the system and connect calls between them. It can also be used in a call-center environment to provide CRM-triggered screen pops. [*]
The FOP management interface is shown in Figure 10-1. To grab a copy of FOP, head to http://www.asternic.org. |