Thank you Joshua!

Retrieving the Application details is a great solution for this.  I completely 
forgot about that support.

On a reconnect…
Code and start monitoring for StasisStart events for new channel can control.
Also can perform a GET with it’s own Application for the details.
Then, it can use that information for the bridge ids and channel ids that it’s 
responsible for.


From: asterisk-users <asterisk-users-boun...@lists.digium.com> On Behalf Of 
Joshua C. Colp
Sent: Monday, January 30, 2023 5:42 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion 
<asterisk-users@lists.digium.com>
Subject: Re: [External] [asterisk-users] Is there a list of Channel ARI 
requests that are allowed when the call is not handed off to the Stasis 
application

On Mon, Jan 30, 2023 at 7:30 PM Dan Cropp 
<d...@amtelco.com<mailto:d...@amtelco.com>> wrote:
We have used AMI for many years and I’m in the process of migrating to ARI.

My understanding is the call should be handed off to Stasis for the ARI 
application to control it.

I was playing around with things and discovered the ARI hangup (DELETE 
/channels/{channelId}) allowed me to hangup calls even when no StasisStart is 
received.
I tried some other requests and they did not seem to work.  This is what I 
expected to happen for the hangup.
Are there other commands that are allowed on channels when the call is not in 
the Stasis app?  (Obviously creating a channel and externalMedia will work 
because they create new channels).

There's not really a list, some just work due to the internal way they work in 
Asterisk.


Also, to be fault tolerant, I noticed a call handed off to Stasis app will 
remain in the Stasis app, even if the ARI/WebSocket connection drops (power 
outage, etc).  When establishing the ARI/WebSocket connection, the first thing 
I am planning to do is GET a list of the channels.  This returns all of the 
channels in the system and not just the channels that are in this Stasis apps 
control.  I plan to go through the list and identify the channels dialplan 
data.  Look for app_name of Stasis and the app_data (comma-delimited).
If app_name = “Stasis” and app_data’s first section of the comma-delimited 
parse portion matches the Stasis app name this instance is used, I take control 
of this channel.
I am planning this additional check because I noticed the Stasis power outage 
scenario resulted in channels stuck in the Stasis app.  If I don’t take control 
of these channels, it’s possible to eventually have hundreds/thousands of 
channels.  For SIP calls, the other end eventually hangs up.  However, this 
isn’t the case with Local channels.  Particularly when both ends are locally 
controlled by Stasis.

Does this sound like I am on the right track for migrating from AMI to Stasis, 
ARI/Websocket support?

You may be able to get the application details[1][2] which would tell you what 
the application is subscribed to, which would include the channels.

[1] 
https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+Applications+REST+API#Asterisk20ApplicationsRESTAPI-get
[2] 
https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+REST+Data+Models#Asterisk20RESTDataModels-Application

--
Joshua C. Colp
Asterisk Project Lead
Sangoma Technologies
Check us out at www.sangoma.com<http://www.sangoma.com> and 
www.asterisk.org<http://www.asterisk.org>
-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
      https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to