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 1.4 beta has which is very user friendly. Asterisk comes with , 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:

  1. Edit the /etc/asterisk/:
    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
    —————————————————

  2. .
  3. Open a IP.
  4. Login by sending the following string:
    : Login\r\n\
    Username: user_name\r\n\
    Secret: user_password\r\n\
    ActionID: 1\r\n\r\n”
  5. Send a command using the following format:
    : 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


————
[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 …
my $manager_sock = new IO::Socket::INET

(PeerPort=>5038,
  Proto=>’tcp’,
  PeerAddr=>’192.168.0.100′);
# Login…  
if($manager_sock->send( : 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(: command\r\ncommand: reload\r\n\r\n”);
$manager_sock->close();


Tags: , , , , , , , ,

Related posts