Asterisk ARI

Asterisk 12 introduced ARI, the Asterisk REST Interface.

Enable it. First, enable Asterisk’s built-in http server by editing /etc/asterisk/http.conf:

enabled = yes

Edit /etc/asterisk/ari.conf:

enabled = yes
pretty = yes

type = user
read_only = no
password = mysecret

Restart Asterisk:

asterisk*CLI> core restart now

We can curl, but since the ARI requires WebSockets all we get is:

curl http://asterisk:mysecret@localhost:8088/ari/events?api_key=asterisk:mysecret&app=hello-world
<title>426 Upgrade Required</title>
<h1>Upgrade Required</h1>
<hr />

The ARI consists of three interrelated pieces:

  1. A RESTful interface through which a client controls resources in Asterisk.
  2. A WebSocket that conveys Asterisk events to a client in JSON.
  3. The Stasis dialplan application that gives a client control of an Asterisk channel.

Together, the three pieces allow a developer to build a custom communication application to manipulate and control Asterisk.