A recurring theme lately I’ve run into is people not really understanding ARI, the Asterisk REST Interface. This is not a new thing (both ARI itself and not understanding it) but has come up more often lately so I thought I’d talk about about it. The documentation does go into this some but a fresh perspective is always nice.
Before I talk about ARI, let’s talk about Asterisk dialplan applications. This is primarily what people get confused about in relation to ARI, specifically how to access a dialplan application from ARI. To start with a bit of background! Dialplan applications are traditionally written in C and use APIs and interfaces provided by the Asterisk core and other modules. They provide the ability for a deployer or user of Asterisk to invoke them from the dialplan with specific options and configuration to do a task or operation. This can include voicemail, dialling a phone and bridging them, and more. While C is powerful and there are lots of APIs and interfaces in Asterisk this limits the scope of who can write new functionality. We wanted to expand this to more people and give the control C developers get to others.
ARI was the result of this. ARI provides the ability to write these dialplan applications outside of Asterisk, in any programming language capable of HTTP and Websockets. It achieves this by providing a fairly simple interface that hides a lot of the nitty gritty complicated details behind the scenes, as best it can. This allows the power of the Asterisk core and its fundamentals to be accessible to even more people.
An important aspect of this: ARI is not an interface to dialplan applications of Asterisk. ARI is an interface to write new dialplan applications. You may want to write your own call queue dialplan application, for example.
You gain access to such things as playing back sounds, recording audio, dialling channels, receiving DTMF, creating bridges, moving channels into bridges and out of them, and more. These are the building blocks that dialplan applications need and use.
This is not all that ARI is capable of so I’ll touch on the second one that people find particularly useful or interesting. A requirement of implementing dialplan applications using ARI is events to convey when things happen. These can be passively received by an ARI application to monitor aspects of what is going on with channels and bridges in Asterisk, without actually interacting with any channel or bridge. You can use this for example to produce a live dashboard of activity within a system and show when channels are dialed, connected to others, and hung up.