Business Telephony Solutions

Support

NEW!! Video Conferencing

Multi-point high quality video and voice conferencing capability for Xorcom IP-PBX launched.
View demo
or read more...
Join the Xorcom Partner Channel
 

Asterisk Tip: Connecting to the Asterisk Manager

Use this procedure to connect to the Asterisk Manager:
  1. 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
    ---------------------------------------------------
  2. Reload the Asterisk configuration.
  3. Open a TCP socket to the Asterisk IP.
  4. 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”
  5. 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 ...
my $manager_sock = new IO::Socket::INET
(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();

 


 
  • Send to a friend

  •  
    Bookmark and Share
    Quick Contact Form
    * = Required field

    Name*:

    Company*:

    E-mail*:

    Type in your request below:*


    Subscribe to newsletter?: 

    Enter this code in the field below:*
    Enter this code in the field below:
    Refresh





    Related Info - White Papers
    Xorcom has developed a library of white papers to help leverage the benefits of VoIP technology in general, and the Asterisk platform in particular:



    U.S. & Canada Latin America EMEA APAC Africa