Adding a channel to a bridge using ARI

I just recently wrote a similar application and it wasn’t hard once the basic event framework was in place. Do you have the event stream from the websocket working? That’s an important component to know the state of your channels.

Your app basically needs to be a state machine, changing state based on the events from Asterisk. When you originate the call you’ll start getting events that will let you know when the originated call has been answered. At that point your app can make the API call(s) to add them to the bridge or do whatever else is needed.

Also, once you get the happy-path working you’ll need to handle hangups and whatnot. In my opinion this is the more complex challenge. You’ll want to architect your code such that the different channels you’ll be bridging can have links to the other channels so that a hangup on one channel can hangup the other end of the call.

If you’re originating calls from ARI you may also hit this issue I ran into: ARI: Getting channel events after calling /channels/{channelId}/continue - #3 by TJNII This may be a non-issue for your app if the channel does not leave the Stasis app for the entirety of it’s lifecycle.