ARI has a number of parts to it - the HTTP server in Asterisk servicing requests, the dialplan application handing control of channels over to a connected client, and the websocket sharing state in Asterisk with the external application. This page provides the configuration files in Asterisk that can be altered to suit deployment considerations.
Asterisk Configuration Options for ARI
The HTTP server in Asterisk is configured via
http.conf. Note that this does not describe all of the options available via
http.conf - rather, it lists the most useful ones for ARI.
|Boolean||False||Enable the HTTP server. The HTTP server in Asterisk is disabled by default. Unless it is enabled, ARI will not function!|
|IP Address||The IP address to bind the HTTP server to. This can either be an explicit local address, or |
|Port||8088||The port to bind the HTTP server to. Client making HTTP requests should specify 8088 as the port to send the request to.|
|String||A prefix to require for all requests. If specified, requests must begin with the specified prefix.|
|IP Address/Port||The IP address and port to bind the HTTPS server to. This should be an IP address and port, e.g., |
|Path||The full path to the certificate file to use. Asterisk only supports the |
|Path||The full path to the private key file. Asterisk only supports the |
ARI users and properties are configured via
ari.conf. Note that all options may not be listed here; this listing includes the most useful ones for configuring users in ARI. For a full description, see the ARI configuration documentation.
|Boolean||No||Format JSON responses and events in a human readable form. This makes the output easier to read, at the cost of some additional bytes.|
|String||A comma separated list of allowed origins for Cross-Origin Resource Sharing.|
|String||Must be |
|Boolean||No||Whether or not the user can issue requests that alter the Asterisk system. If set to Yes, then only |
|String||plain||Can be either |
|String||The password for the user.|
Configuring the Dialplan for ARI
By default, ARI cannot just manipulate any arbitrary channel in Asterisk. That channel may be in a long running dialplan application; it may be controlled by an AGI; it may be hung up! Many operations that ARI exposes would be fundamentally unsafe if Asterisk did not hand control of the channel over to ARI in a safe fashion.
To hand a channel over to ARI, Asterisk uses a dialplan application called Stasis. Stasis acts as any other dialplan application in Asterisk, except that it does not do anything to the channel other than safely pass control over to an ARI application. The Stasis dialplan application takes in two parameters:
- The name of the ARI application to hand the channel over to. Multiple ARI applications can exist with a single instance of Asterisk, and each ARI application will only be able to manipulate the channels that it controls.
- Optionally, arguments to pass to the ARI application when the channel is handed over.
Example: Two ARI Applications
This snippet of dialplan, taken from
extensions.conf, illustrates two ARI applications. The first hands a channel over to an ARI application "Intro-IVR" without any additional parameters; the second hands a channel over to an ARI application "Super-Conference" with a parameter that specifies a conference room to enter.
When a channel enters into a Stasis application, Asterisk will check to see if a WebSocket connection has been established for that application. If so, the channel is handed over to ARI for control, a subscription for the channel is made for the WebSocket, and a StasisStart event is sent to the WebSocket notifying it that a channel has entered into its application.