Got task to create call between two mobiles using ARI. Got access to prepared asterisk server
version: 18.16.0. But can’t find actual example with my case. I tried to use example from this topic from stack:
Command executed without errors, i see a lot of logs in asterisk, but there are no dialing on any numbers. Support says that params are invalid and i must use extension for external calls. Obviously example from 2015 is not good =) So I would appreciate any relevant example !
There is no such thing as “external” in ARI. You use originate to place calls to endpoints (including to ITSPs), create a bridge to connect them together, and place each channel in the bridge to have them talk. That’s the general gist of what you do. There are routes for doing these in ARI. I don’t have a written example, someone else may, but you’re going to need to understand ARI and experiment if you ultimately plan to use it for anything real. An understanding of VoIP and basic Asterisk is also needed.
Was such logic with avaya and their javax.telephony library. Creating two calls and merge them. But there are plenty of working examples for avaya. Easy to make app from scratch. Now i’m stuck cause need fast prototype. Strange that solution from stack was working 8 years ago with single api call.
Will try to make your described logic. Will post solution here if i achive any success
val channel: Channel =
ari.channels().originate("SIP/FW/mobile_n1")
.setExtension("mobile_n2")
.setContext("from-internal")
.setCallerId("222")
.execute()
where:
SIP and FW - Tech and Name of a trunk (got freepbx ui Connectivity → Trunk)
222 - is created extension
Template will look like this:
val channel: Channel =
ari.channels().originate("{trunk tech}/{trunk name}/{first number to call}")
.setExtension("{second number to call}")
.setContext("{predefined context for outbound calls}")
.setCallerId("{extension}")
.execute()