WARNING
This repository is archived but remains here for reference. Feel free to fork and continue using this if it fits your system. Unfortunately all developers are no longer directly involved in the development of this code, and don't have time to maintain it adequately.
We still believe the architecture is sound, but this repository is no longer kept up to date with the latest Asterisk ARI development.
An implementation of the [go-ari-library][1] used to connect to the Asterisk REST Interface for delivery of Events and Commands across a message bus.
The go-ari-proxy
is an application that makes it easier to build
external applications for the Asterisk REST
Interface (ARI). Primarily, we wrap the ARI messages in a structure that can be
easily disseminated and sent across a message bus using json
. From there, the
application can decapsulate the message, act on the ARI portion, and send back a
response in a similar manner.
$ cd $GOPATH/src
$ go get github.com/nvisibleinc/go-ari-library
$ git clone https://github.com/nvisibleinc/go-ari-proxy
$ go install go-ari-proxy
Add a config.json
file to your directory you're running the application from.
{
"origin": "http://foo.com",
"server_id": "bar",
"applications": [
"foo"
],
"websocket_url": "ws://localhost:8080/ari/events",
"stasis_url": "http://localhost:8080/ari",
"ws_user": "user",
"ws_password": "secret",
"message_bus": "RABBITMQ|NATS",
"bus_config": {
"url": "",
"queue": ""
}
}
TODO
The go-ari-proxy
application works by using a message bus (NATS, RabbitMQ) and
having a broadcast channel (topic, queue) that applications listen to. When a
StasisStart
is recieved by the proxy, we perform an AppStart
which
broadcasts this information.
The message bus then distributes this to an application listening on the topic. From there, the application knows what topic to subscribe to in order to continue the conversation. Currently this setup channel is unidirectional, however in the future it may be further enhanced/designed to allow for applications to acknowledge setup of a dialog.
The primary purpose of the broadcast channel is to distribute to one or more application instances, and then a dialog is created over three (3) additional topics. These topics are: Events, Commands, and CommandResponses.
NOTE: Prior revisions of the go-ari-library upon which this proxy is built had support for the NSQ message bus. Unfortunately, as a result of the eventually consistent semantics of NSQ's topic discovery mechanism, its use is no longer supported and the code was removed.
StasisStart
event, the proxy creates a new ProxyInstance, creating a
unique dialogID, and connect to three new topicsAppStart
event across the
signalling channel to tell the application which topics to listen for Events,
to send Commands, and to listen for Command Responses.Copyright 2015-2016 N-Visible Technology Lab, Inc.
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.