The Manager interface is used to remotely view/change console (and other) actions. Through the use of the manager interface, you are able to send actions and receive responses very similar to the CLI interface. However Asterisk latest version 1.4 beta has GUI manager interface which is very user friendly. Asterisk comes with Asterisk Manager API, which allows third-party software to provide external management services. And through the freely available Asterisk-Sounds add-on package, Asterisk provides a full range of canned voice messages to use with menus and IVR.
Use this procedure to connect to the Asterisk Manager:
- Edit the /etc/asterisk/manager.conf:
Set the enabled option to “yes”.————–
enabled = yes
————–Adding a user:
user_name > The user name used to authenticate the connection
user_password > The password used to authenticate the connection
connecting_from_ip > The IP address from which you are connecting————————————————–
[user_name]
secret = user_password
deny=0.0.0.0/0.0.0.0
permit = connecting_from_ip/255.255.255.0
read = system,call,log,verbose,command,agent,user
write = system,call,log,verbose,command,agent,user
————————————————— - Reload the Asterisk configuration.
- Open a TCP socket to the Asterisk IP.
- Login by sending the following string:
“Action: Login\r\n\
Username: user_name\r\n\
Secret: user_password\r\n\
ActionID: 1\r\n\r\n” - Send a command using the following format:
“Action: command\r\ncommand: command_string\r\n\r\n”
**********
* Sample *
**********
# Connect from Client (IP:192.168.0.90)
# to Asterisk (IP:192.168.0.100)
# Send command reload
Manager.conf
————
[general]
enabled = yes
port = 5038
bindaddr = 192.168.0.100
[admin]
secret = password
deny = 0.0.0.0/0.0.0.0
permit = 192.168.0.90/255.255.255.0
read = system,call,log,verbose,command,agent,user
write = system,call,log,verbose,command,agent,user
| Perl Script: ————- #!/usr/bin/perl -w use IO::Socket::INET; use strict; #Connect to manager interface … |
(PeerPort=>5038, |
| Proto=>’tcp’, | |
| PeerAddr=>’192.168.0.100′); |
| # Login… | |
| if($manager_sock->send( | Action: Login\r\n. |
| Username: admin\r\n. | |
| Secret: password\r\n. | |
| ActionID: 1\r\n\r\n”) == 0) |
{
print Failed to send login information\n;
exit(1);
}
#Command (reload asterisk configuration)
$manager_sock->send(Action: command\r\ncommand: reload\r\n\r\n”);
$manager_sock->close();






