We made a Salesforce click-to-call app that uses ARI in Asterisk 13. We currently we click a customer’s number in Salesforce, and it rings our phone then theirs and mixes the channels together in a bridge.
Meanwhile, each agent has a personal conference extension. If their phone extension is 4444, their personal conference line is 84444.
We want to add additional functionality, so that we have an “Add To Conference” field in Salesforce. The agent at extension 4444 would type in a customer’s phone number or a coworker’s extension into the field and click an “Add to Conference” button to call them. When the target picks up, they would be automatically placed into the 84444 conference.
What would be the best way to do this in ARI? I assume we don’t have to create a mixing bridge as the preexisting conference numbers are each a sort of persistent bridge that does not need to be created or destroyed.
You would just need to originate an outgoing channel and once answered add it to your bridge. I’m not really sure what to expand on in that from your question…
The tough part for us is that Asterisk seems to generate channels IDs and Bridge IDs randomly/dynamically. With our normal click-to-call app (node.js), it is generating two channels on the spot and bridging them so it already knows what the channelID values are; but looking up channel IDs and bridge IDs that are already preexisting seems to be stymieing our programmer. It’s the same thing stopping us from making a working “Hang up this call” button in the click-to-call app. We tried at ari.asterisk.org to originate a call with a value in the “channelId” field, but it doesn’t seem to be honored. I’m assuming that FreePBX overrides it, since they confirmed it was by design that it overrides the Caller ID field.
If we could tell the app “originate an outgoing channel then join it to conference extension 84444”, that would work, but I don’t know if we can target the extension directly or if we need to look up it’s bridgeID which I assume can change.
ARI doesn’t implement such logic, it merely provides the primitives to do so.
As for knowing channel ids and bridge ids - you can specify that when originating channels or creating bridges. As well when you create a bridge it is returned to you. Without further details I couldn’t say why it’s not working, but we do have tests for it and people are using it.
If you are using Local channels you would need to provide separate channel ids for each leg.
A channel ID can be provided using the originateWithId API call. As @jcolp mentioned, if you are creating a Local channel (which always comes in pairs), you can specifying the ID of the second half using the otherChannelId query parameter. When a channel is created in such a fashion, you control the IDs, and those IDs are never changed.
A Bridge’s ID cannot change. It is unique and immutable throughout the lifetime of the bridge.