UCx APIs Overview

UCx currently provides two application programming interfaces (APIs): Asterisk Gateway Interface (AGI) and Asterisk Manager Interface (AMI).

These interfaces serve different purposes:

  • AGI provides an interface between the UCx dialplan and an external program that wants to manipulate a channel in the dialplan. In general, the interface is synchronous - actions taken on a channel from an AGI block and do not return until the action is completed. AGI requires some modification to the dialplan to run and is good for processing inbound calls.
  • AMI provides a mechanism to control where channels execute in the dialplan. Unlike AGI, AMI is an asynchronous, event driven interface. For the most part, AMI does not provide mechanisms to control channel execution - rather, it provides information about the state of the channels and controls about where the channels are executing. It allows remote software to completely control the UCx: get event status updates, make calls, receive calls, route calls, etc.

Both of these interfaces are powerful and opened up a wide range of integration possibilities. Using AGI, remote dialplan execution could be enabled, which allows developers to integrate UCx with PHP, Python, Java, and other applications. Using AMI, the state of UCx could be displayed, calls initiated, and the location of channels controlled. Using both APIs together, complex applications integrated with UCx could be developed.

From release 6.0 onwards, UCx will provide another interface:  Asterisk RESTful Interface (ARI).

ARI is an asynchronous API that allows developers to build communications applications by exposing the raw primitive objects in UCx - channels, bridges, endpoints, media, etc. - through an intuitive REST interface. The state of the objects being controlled by the user are conveyed via JSON events over a WebSocket.

ARI consists of three different pieces that are - for all intents and purposes - interrelated and used together. They are:

  1. A RESTful interface that a client uses to control resources in UCx.
  2. A WebSocket that conveys events in JSON about the resources in UCx to the client.
  3. The Stasis dialplan application that hands over control of a channel from UCx to the client.

All three pieces work together, allowing a developer to manipulate and control the fundamental resources in UCx and build their own communications application.

Page Tags: 
REST
ARI
AGI
ami
api