I`m trying to play a little bit with ARI in order to create a queue that would be capable to serve multiple asterisk instances. After some basic documentation, it seems that ARI is the way to do it.
What I have achieved by now it`s a simple dial plan that sends an incoming call to my stasis app. Once the call came into stasis a STASIS_START event is fired, and I consider this as being the entry point to my queue (that is my first problem). After the call was received I put some records into an H2 database and start playing moh on that channel.
Just for the demo, immediately I try to create another channel to a free agent to handle the call.
The problem is that when I create the channel I have to set the app, and if I set the same app, I will get a new STASIS_START event fired(another entry in H2 DB - which is not desired), but in this case, it's a fake one, as I considered that STASIS_START should be fired only when a new call came into my "queue". I was thinking to put some variables on the "true external calls" that enter the stasis app and then check if the arrived calls have these variables... but I'm afraid I`m doing something wrong maybe from an architectural point of view.
What is the best approach here?
Another two bonus questions:
Why would I use a bridge to play MOH for the waiting caller when I can play some moh directly on that channel? Is it because the bridge gave me the ability to record or capture DTMF events?
Is my assumption correct that when I
m trying to call for queue agents (in order to match these with the waiting call in the queue) I should use
POST /channels/createcombined with
POST /channels/{channelId}/dialinstead of using
POST /channels` which would use originate?
The initial
StasisStart
should be set to handle only the external calls.You can do it as you said by setting variable for the incoming calls or the opposite - by setting a variable for your originated agent calls.
The important thing is that you can listen to your own originated calls
StatsisStart
events, this events will fire only from this specific channel so you can track it easily.Bonus answers:
create
anddial
is that you can set channel variables and track the channel in all states before the answer event. If yoy trying to build the full queue app in ARI you definitely want it.