Asterisk ari

From 탱이의 잡동사니
Jump to: navigation, search

Overview

ARI(Asterisk REST Interface) 내용 정리.

Stasis

Stasis is a dialplan application in Asterisk. It is the mechanism that Asterisk uses to hand control of a channel over from the dialplan - which is the traditional way in which channels are controlled - to ARI and the client. Generally, ARI application manipulate channels in the Stasis dialplan application, as well as other resources in Asterisk. Channels not in a Stasis application generally cannot be manipulated by ARI - the purpose of ARI, after all, is to build your own application, not manipulate an exisiting one.

Event subscribing

Resources in Asterisk do not, by default, send events about themselves to a connected ARI application. In order to get events about resources, one of three things must occur.

  • The resource must be a channel that entered into a Stasis dialplan application. A subscription is implicitly created in this case. The subscription is implicitly destroyed when the channel leaves the Stasis dialplan application.
  • While a channel is in a Stasis dialplan application, the channel may interact with other resources - such as a bridge. While channels interact with the resource, a subscription is made to that resource. When no more channels in a Stasis dialplan application are interacting with the resource, the implicit subscription is destroyed.
  • At any time, an ARI application may make a subscription to a resource in Asterisk through application operations. While that resources exists, the ARI application owns the subscription.

Subscribing all event

모든 이벤트를 수신하고자 한다면 다음과 같이 하면 된다.

$ wscat -c "ws://localhost:8088/ari/events?api_key=asterisk:asterisk&app=hello-world&subscribeAll=true"

See also