Hi all,
I am developing an application (App) for integrating Asterisk 13 with an external database.
At a high level, App works as follows.
- App establishes a Websocket connection with Asterisk.
- App catches incoming calls from a specific SIP trunk by means of a separate context in the dialplan with ‘Stasis’ application invoked.
- App parses JSON data received in the Websocket and gets caller ID (and other call attributes).
- App queries an external database and gets an extension this incoming call should be routed to.
- App switches the incoming call to the extension returned by the query to the database.
Items ##1…4 are already implemented and work fine. However, I need a solution item #5.
One obvious solution is to use Asterisk REST API (ARI) and implement switching logic directly in the App: create outgoing channel, create bridge, add both channels to the bridge.
However, this solution seems quite complicated and not efficient in terms of performance.
So, I have the following questions to the community:
Is it possible for Stasis to return some variable back to a dialplan and continue with channel switching by means of the dialplan itself instead of designing this switching logic in the App and invoke ARI calls?
If not, do you have any other suggestions for implementing item #5 in the above scenario without designing channel switching logic in the App?
Thank you a lot!