DEV Community


Posted on • Updated on

Brief intro of Asterisk Manager

Weekly sharing

Hi everyone, I am Ekim, a fresh Bootcamp graduate and an IT helper (I don't dare to call myself a programmer yet). Every Friday, I will share some of the work that I've done over the last week in a bid to get feedbacks from you guys and record my journey to become a programmer.


Make calls through Asterisk CLI


After being able to make calls and play around with playback and record dialplan applications, it's time to prepare ourselves for using those functions through codes. But before that, we need to know what Asterisk Manager Interface is.

**Warning: **Only try the following within your own local network.

What is Asterisk Manager Interface ?

  • It is like a remote control of the asterisk.
  • Unlike running asterisk commands on the CLI, the state and process of which cannot be seen and controlled, the asterisk manager interface resolves those issues and helps monitor the operation of the asterisk.
  • Since AMI allows you to remotely control the asterisk, it is advised that you do not use AMI directly with a public IP address without protection like SSL connection or a VPN tunnel.

Steps using AMI

  • Check if port 5038 is available as we are going to use it.
    netstat -lpn
Enter fullscreen mode Exit fullscreen mode
  • Configure the manager.conf
    enabled = yes       ;by default, it is "no" for security reason.
    port = 5038
    bindaddr =  ;bind the ip address to localhost for lcoal testing, need to change when remote control it
    [ekim]              ;login username, often for CRM, ERP or dialer 
    secret=xxxxxxxx     ;login password, should be complex
    deny=        ;deny everything --> much safer to permit each ip address we trust
    permit=XXX.XXX.XX.XX/      ;permit local network after an entire denial, this can also be done in acl.conf
    read=all        ;read all logs
    write=all       ;write all logs
Enter fullscreen mode Exit fullscreen mode
  • Restart asterisk after IP and port changes
    sudo service asterisk restart
Enter fullscreen mode Exit fullscreen mode
  • Use telnet to connect to AMI

    • telnet allows access to remote servers, which is based on the TELNET protocol. Only recommend you use telnet to connect within your own network.
    # telnet <permitted IP address> <port>
    telnet XXX.XXX.XX.XX 5038
Enter fullscreen mode Exit fullscreen mode
    # after that, tab "enter" once as we need to continue to login
    # when finish registering, tab "enter" twice for signaling you're done

Enter fullscreen mode Exit fullscreen mode
  • After that, you should see the Response: Success and could see all actions in the asterisk.
    Response: Success
    Message: Authentication accepted

    Event: FullyBooted
    Privilege: system,all
    Uptime: 67
    LastReload: 67
    Status: Fully Booted
Enter fullscreen mode Exit fullscreen mode


  • Now, you have accessed to your own asterisk server and entered the AMI. That means you are no longer playing on the CLI. You are 'remotely controlling' your asterisk pbx.

  • So, why not we try to originate a call (make a call) and see what would happen ?

  • The below is based on our first tutorial pjsip and dialplan settings

# remember to tab 'enter' twice to signal that you are finished

Enter fullscreen mode Exit fullscreen mode



Mine is working now, how about yours ? Btw, if you want to leave the AMI, you could do this

      # remember to tab 'enter' twice to signal that you are finished

Enter fullscreen mode Exit fullscreen mode


You might want to keep your eyes close to the log data shown in AMI since those are the things we might need if we touch on the coding part. That's all for today. In the meantime, stay healthy and stay tuned for more content !!!

Top comments (0)