[asterisk-dev] ARI Stasis Application Examples and Tutorials
Samuel Galarneau
sgalarneau at digium.com
Mon Dec 22 08:29:58 CST 2014
The examples on github[1] use client libraries for both the Python and
JavaScript examples. Client libraries abstract out some things for ease of
use, such as namespacing events for a given instance (channel, playback, et
cetera) but more importantly perform a lot of boilerplate that you would
otherwise be responsible for.
In addition, a client library shields developers from a changing API to
some degree. Both the Python and JavaScript libraries used in the examples
generate their API from ARI json definitions of what ARI can do. This means
that developers have access to the latest API on their target Asterisk
server without having to modify their boilerplate code.
As they stand today, the libraries we use in the examples are very thin
wrappers around ARI. Other than establishing a WebSocket connection and
providing a means to handle Stasis events, they mostly construct HTTP
requests for you and return objects from the responses. None of these
conveniences have to do with the way ARI works specifically.
[2] does a very good job at laying out the basics of how ARI works but
mostly does so with client libraries for the examples. One way to drive
adoption is to provide examples in as many programming languages as
possible so that users can be comfortable in their environments. A pull
request on our github repository [1] is always welcome. I would encourage
the use a client library there as well.
1 - https://github.com/asterisk/ari-examples
2 - https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=29395573
On Mon, Dec 22, 2014 at 5:22 AM, Nir Simionovich <nir.simionovich at gmail.com>
wrote:
> Hi All,
>
> I'm not sure if the dev list is the proper list of this, however, due to
> the fact that the issue at hand
> revolves around documentation and proper usage, I think bringing it up
> here is a good place.
>
> So, during the past few days, I've been trying to implement the Dial
> application using ARI. So,
> I'm aware I'm not the only one, but I'm the one trying to do it using
> PHPARI - naturally.
>
> In any case, I managed to write the functionality - reaching an issue
> where if I disconnect the
> first bridge handled by the stasis app, it will kill all the other bridges
> as well. I was wondering why
> that happens. I then realized that part of the my stasis loop
> implementation is just wrong, and it's
> not because PHPARI is wrong, or ARI is wrong - it's wrong because it is a
> WebSocket client.
>
> A stasis application, at least as I understand it - is a websocket
> client - or consumer in that
> respect. However, our consumer application is required to be able to
> handle multiple sessions,
> so, it now needs to be stateful on one hand, and 'multi-threaded' on the
> other. The result is that
> our 'client' application is actually a server in disguise.
>
> This is something that the ARI documentation and general usage concepts
> is missing - I think
> that we need to make ARI more accessible by explaining the basic concepts
> better.
>
> Another thing, yesterday Scott and I were going through Matt's example
> of the "bridge_dial" ARI
> application. The fact that the ari-py is autogenerated makes it really
> hard for a none-python (yours
> truly) guy to follow along. Even Scott, who is fluent in Python had a bit
> of trouble looking through the
> logic of the app, specifically when seeing that a certain event overloads
> an existing one - and some
> other stuff that ari-py does.
>
> In other words, if we want to deprecate AGI/AMI at some point - or for a
> better term, get people to
> use ARI extensively - we need better examples. I'm working on adding
> additional examples to PHPARI
> for this, but we need simple, to the point, usage examples for ARI. For
> example, examples that don't
> go about and do something funky in the background, so that people can
> truly learn from it.
>
> When I started with AGI and AMI, the one thing I liked was that I could
> use BASH. ARI isn't such a thing,
> and a WebSocket library is mandatory. But giving some basic concepts using
> only that, would be
> awesome.
>
> What do you think?
>
> Nir
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-dev
>
--
Samuel Fortier-Galarneau
Digium, Inc. | Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: www.digium.com & www.asterisk.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20141222/3629ea00/attachment-0001.html>
More information about the asterisk-dev
mailing list