Setting up AMI access
Asterisk Manager Interface (AMI) is a powerful and convenient Asterisk programming interface (API) for managing the system from external programs. Thanks to the AMI, external programs can connect to Asterisk via the TCP protocol, initiate the execution of commands, read the result of their execution, as well as receive notifications about events in real time.
AMI is often used for integration with business processes and systems, CRM software (Customer Relationship Management - customer interaction management). Asterisk is often managed from the CLI console, but using AMI does not require direct access to the server running Asterisk. AMI is the simplest tool, which in the hands of a developer can be a very powerful and flexible tool for integration with other software products. It enables developers to use the information generated by Asterisk in real time.
The first thing to do is to enable the AMI and create a user with which the client program will authenticate. "System" -> "Asterisk Manager Interface(AMI)":
To add a new account, you must specify a Username and Password. In addition, it is necessary to set a Network filter, i.e. from which subnet the connection to the AMI user is allowed. You can allow connections from any addresses, or specify a specific network that you have configured in the "Network and Firewall" → "Firewall"
AMI user rights set in the [user] section of the configuration file /etc/asterisk/manager.conf
System
Reading general information about the system, for example, configuration restart notifications
Allows the user to execute Asterisk control system commands such as Restart, Reload, or Shutdown. This permission also gives users the ability to run system commands outside of Asterisk. Granting such permission is equivalent to granting access to the command shell, with the rights of the user/group under which the Asterisk process is running
Call
Reading an event about channels in the system
Allows the user to set information on channels
Log
Provides the user with access to reading logs
Read only
Verbose
Provides the user with access to reading detailed logs
Read only
Agent
Reading agent status events from app_queue and chan_agent modules
Allows the user to perform actions to manage and retrieve the status of queues and agents
User
Access to user events as well as Jabber/XMPP user events
Allows the user to execute the UserEvent command to create custom events
Config
For recording only
Allows the user to receive, update, and overload configuration files
Command
For recording only
Allows the user to execute Asterisk CLI commands from AMI
DTMF
Allows the user to receive DTMF events
Read only
Reporting
Access to call quality events such as jitterbuffer or RTCP
Allows the user to perform a number of actions to obtain statistics and information about the status of the entire system
Cdr
Reading data write events in CDR
Read only
Dialplan
Reading events for setting dialplan variables, creating extents
Read only
Originate
For recording only
Allowing the user to execute the Originate command, which sends a request to create a new call