Section 10.4. Manager


10.4. Manager

Asterisk 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.

[*] An Application Program Interface (API) is a mechanism by which a program allows other programs to take control of it. Contrast this with AGI, which allows external programs to be called from the dialplan.

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 

Sound Recording from the Dialplan

Surprisingly, one of the easiest ways to get respectable-quality recordings is not through a PC with fancy editing software, but rather through a telephone set. There are many reasons for this, but the most important is that the telephone will tend to filter out background noise (such as white noise caused by HVAC equipment) and will record at a consistent audio level.

This little addition to your dialplan will allow you to easily create recordings, which will be placed in your system's /tmp/ folder (from there, you can rename them and move them wherever you'd like):

 exten => _66XX,1,Wait(2)     exten => _66XX,2,Record(/tmp/prompt${EXTEN:2}:wav)     exten => _66XX,3,Wait(1)     exten => _66XX,4,Playback(/tmp/prompt${EXTEN:2})     exten => _66XX,5,Wait(2)     exten => _66XX,6,Hangup( ) 

This little snippet will allow you to dial from 6600 to 6699, and it will record prompts in the /tmp/ folder using the names prompt00.wav to prompt99.wav . After you complete recording (by pressing the # key), it will play your prompt back to you and hang up.

Be sure to move your prompts out of the /tmp/ dir to the Asterisk sounds directory. To keep the dialplan readable, rename your promptXX files to a meaningful namese.g., mv /tmp/prompt00.wav /var/lib/asterisk/sounds/custom/welcome-message.wav .


 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 Commands

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 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 Panel

The 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. [*]

[*] Customer Relationship Management (CRM) is an interface companies use to help manage customer information and interaction.

The FOP management interface is shown in Figure 10-1. To grab a copy of FOP, head to http://www.asternic.org.



Asterisk. The Future of Telephony
Asterisk: The Future of Telephony: The Future of Telephony
ISBN: B0026OR3OO
EAN: N/A
Year: 2001
Pages: 380

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net