asterisk/rest-api-templates
David M. Lee 451993f4f5 ARI: WebSocket event cleanup
Stasis events (which get distributed over the ARI WebSocket) are created
by subscribing to the channel_all_cached and bridge_all_cached topics,
filtering out events for channels/bridges currently subscribed to.

There are two issues with that. First was a race condition, where
messages in-flight to the master subscribe-to-all-things topic would get
sent out, even though the events happened before the channel was put
into Stasis. Secondly, as the number of channels and bridges grow in the
system, the work spent filtering messages becomes excessive.

Since r395954, individual channels and bridges have caching topics, and
can be subscribed to individually. This patch takes advantage, so that
channels and bridges are subscribed to on demand, instead of filtering
the global topics.

The one case where filtering is still required is handling BridgeMerge
messages, which are published directly to the bridge_all topic.

Other than the change to how subscriptions work, this patch mostly just
moves code around. Most of the work generating JSON objects from
messages was moved to .to_json handlers on the message types. The
callback functions handling app subscriptions were moved from res_stasis
(b/c they were global to the model) to stasis/app.c (b/c they are local
to the app now).

(closes issue ASTERISK-21969)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/2754/
........

Merged revisions 397816 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397820 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-27 19:19:36 +00:00
..
api.wiki.mustache Update events to use Swagger 1.3 subtyping, and related aftermath 2013-07-03 16:32:41 +00:00
ari.make.mustache Rename everything Stasis-HTTP to ARI 2013-07-27 23:11:02 +00:00
ari_model_validators.c.mustache Rename everything Stasis-HTTP to ARI 2013-07-27 23:11:02 +00:00
ari_model_validators.h.mustache Rename everything Stasis-HTTP to ARI 2013-07-27 23:11:02 +00:00
ari_resource.c.mustache Rename everything Stasis-HTTP to ARI 2013-07-27 23:11:02 +00:00
ari_resource.h.mustache ARI - implement allowMultiple for parameters 2013-08-02 14:36:32 +00:00
asterisk_processor.py ARI - channel recording support 2013-07-03 17:58:45 +00:00
do-not-edit.mustache This patch adds a RESTful HTTP interface to Asterisk. 2013-04-22 14:58:53 +00:00
make_ari_stubs.py Rename everything Stasis-HTTP to ARI 2013-07-27 23:11:02 +00:00
models.wiki.mustache Update events to use Swagger 1.3 subtyping, and related aftermath 2013-07-03 16:32:41 +00:00
odict.py This patch adds a RESTful HTTP interface to Asterisk. 2013-04-22 14:58:53 +00:00
param_cleanup.mustache ARI - implement allowMultiple for parameters 2013-08-02 14:36:32 +00:00
param_parsing.mustache ARI: WebSocket event cleanup 2013-08-27 19:19:36 +00:00
README.txt This patch adds a RESTful HTTP interface to Asterisk. 2013-04-22 14:58:53 +00:00
res_ari_resource.c.mustache ARI: WebSocket event cleanup 2013-08-27 19:19:36 +00:00
rest_handler.mustache Rename everything Stasis-HTTP to ARI 2013-07-27 23:11:02 +00:00
swagger_model.py ARI - channel recording support 2013-07-03 17:58:45 +00:00
transform.py Update events to use Swagger 1.3 subtyping, and related aftermath 2013-07-03 16:32:41 +00:00

This directory contains templates and template processing code for generating
HTTP bindings for the RESTful API's.

The RESTful API's are declared using [Swagger][swagger]. While Swagger provides
a [code generating toolkit][swagger-codegen], it requires Java to run, which
would be an unusual dependency to require for Asterisk developers.

This code generator is similar, but written in Python. Templates are processed
by using [pystache][pystache], which is a fairly simply Python implementation of
[mustache][mustache].

 [swagger]: https://github.com/wordnik/swagger-core/wiki
 [swagger-codegen]: https://github.com/wordnik/swagger-codegen
 [pystache]: https://github.com/defunkt/pystache
 [mustache]: http://mustache.github.io/