AMI (Asterisk Management Interface) is used for third party applications to work properly with Asterisk (FreePBX). Applications can retrieve updated information about system events via AMI and send some commands to Asterisk.

To use AMI on Asterisk and FreePBX, you need to define a user and password. You can create this in two ways:

  1. By editing the /etc/asterisk/manager.conf file
  2. By creating a user with Asterisk Manager in FreePBX.

Let’s examine both methods in more detail.

Creating an AMI User on Asterisk:

  1. Connect to the Asterisk server via SSH.
  2. Open the /etc/asterisk/manager.conf file with an editor.
nano /etc/asterisk/manager.conf
  1. Enter the AMI settings in the [general] section:
[general] 
enabled = yes 
port = 5038 
bindaddr = 0.0.0.0 
displayconnects = no
  1. Create a new user under the [general] section:
[amiuser] 
secret = 123456 
deny = 0.0.0.0/0.0.0.0 
permit = 192.168.0.0/255.255.255.0 
read = system,call,log,verbose,command,agent,user,config,command,dtmf,reporting,cdr,dialplan,originate,message 
write = system,call,log,verbose,command,agent,user,config,command,dtmf,reporting,cdr,dialplan,originate,message 
writetimeout = 5000

Note: In this example, the username is amiuser and the password is 123456. It only accepts requests from the 192.168.0.0/24 network, but all access is read and write.

  1. Save and close the file.
  2. Reinstall the Asterisk Manager module:
asterisk -rx "manager reload"

Creating AMI User on FreePBX:

  1. Click Settings in the top navigation bar and then Asterisk Manager Users:
Asterisk Manager Users
Asterisk Manager Users Menu

2. Click the Add Manager button to add a new user.

FreePBX Add Manager

3. Here you can see the settings window for a new user. Complete the relevant fields here:

AMI User Properties
  • Manager Name: Enter the AMI Username (no spaces).
  • Manager Secret: Enter the password for the AMI User.
  • Deny: Here you can specify the IP address and subnet mask that you want to restrict connection with AMI. You can use the “&” symbol to specify multiple networks, eg 192.168.1.0/255.255.255.0&192.168.2.0/255.255.255.0
  • Permit: Specify the network or unique IP address to which you allow AMI connection.
  • Write Timeout: Enter the timeout period for the execution of the AMI command.
  1. Set access permissions using the Permissions tab.
AMI Permissions

5. Click the Submit button at the bottom right to save the settings and then click Apply Config appears at the top left to complete the process.

Exit mobile version