Adding a channel to a bridge using ARI

Hello,

Here is what I am trying to achieve using asterisk ARI with python,

  1. Originate a call to my number/get the channel ID,
  2. create a bridge
  3. add the channel ID to the bridge
    I am stuck here
  4. how to add a new call to the bridge & put both the calls in conference ?

Do I have to originate call again & get channel ID and add that in existing bridge ?
thanks in advance

Regards
CJ

Yes. It’s completely up to you what happens. If you want to call two parties and put them in a bridge together, then it’s up to you to tell ARI to do that.

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.

Could you post your code on how you created the conf and added the extensions into the conference? (I don’t care about what programming language, mostly interested in sequence of ARI functions called)

Hi,

Thanks for your response , so basically do I need to get events?because my app just calls a function based on certain condition and only then,
I need a bridge and then originate a call and add both parties to the bridge.

Regards
CJ

I have examples of using various Asterisk APIs here. The track_call_ari_bridged_async example shows how to do call bridging with ARI.

Hi,

do I have install any python package to use your examples?

Regards
CJ

You will need to install my Seaskirt Python module.

I am using JS, the below code work fine to me.
Make sure your channel is exist before you add into a bridge.

bridge.addChannel({ channel: channelID });

GitHub - asterisk/node-ari-client: Node.js client for ARI. This library is best effort with limited support.

Hi,

I Am using python 3.10 will that support on my python version & where can I download it from ?

Regards
CJ

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.