[asterisk-app-dev] Asterisk AMI/ARI call origination complexity
Matthew Jordan
mjordan at digium.com
Thu Jun 5 13:13:17 CDT 2014
On Thu, Jun 5, 2014 at 11:45 AM, Maxim Litnitskiy
<litnimaxster at gmail.com> wrote:
>>
>> This problem was discussed on this mailing list late last year:
>>
>>
>> http://lists.digium.com/pipermail/asterisk-app-dev/2013-December/000239.html
>>
>> The preferred mechanism to solving this problem is to provide your own
>> channel unique ID when originating a channel. That applies to both AMI
>> and ARI.
>
>
>
> Was this channelID parameter in AMI introduced in Asterisk 12?
>
Yup, it was added in Asterisk 12.2:
http://svn.asterisk.org/svn/asterisk/tags/12.2.0/CHANGES
>>
>> Origination always comes in one of two flavours:
>>
>> (1) Originate a channel to a location in the dialplan, using a
>> context/extension/priority tuple
>> (2) Originate a channel directly to an application, optionally with
>> some arguments presented to the application.
>
>
> Sorry but in ARI seems not :-)
> Only when I added 'app' parameter I started to receive ChannelDestroyed
> message over WebSocket.
I think you're confusing the subscription model of channels in ARI
with what happens when you perform an Origination.
You can Originate a channel anywhere using ARI. That does not mean,
however, that you get events about that channel. You only get events
about channels if you have subscribed to the channel. You get an
implicit subscription to a channel when it enters into a Stasis
application.
If you specify an 'app', and that application is Stasis, then yes,
you'll get a subscription created for you, you will get a StasisStart
event, and you'll get events about the channel. You can, however,
Originate channels outside of your Stasis application - either to the
dialplan or to some other application.
In those cases, you can create an explicit subscription using the
/applications resource.
>>
>> In either case, the arguments passed to the Stasis application are
>> presented in the StasisStart event. They are not presented on every
>> single subsequent event: that would be redundant, as every channel
>> that is handed over to ARI through the Stasis application has a
>> StasisStart event.
>
>
>
> Great but when the call is not connected to Stasis app in dialplan there
> cannot be a StasisStart message.
> I mean that in ARI originate I specify app and appArgs and see only app in
> ChannelDestroyed message.
> In this particular case appArgs are lost.
>
Again, I think you're confusing Origination and the subscription event
model for an application in Stasis.
Just because you modify something through ARI does not mean you get
events about that thing. ARI != AMI. It is not an open pipeline of
everything that occurs in the system.
There are two ways to get events:
(1) Create a subscription to the thing that you want via the
applications resource
(2) Get an implicit subscription to a channel (and only a channel)
when it enters into the Stasis dialplan application
Unless you do one of those two things, you don't get events back about it.
--
Matthew Jordan
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org
More information about the asterisk-app-dev
mailing list