How to handle channels into an ARI queue app? [closed] - asterisk

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 days ago.
Improve this question
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 Im trying to call for queue agents (in order to match these with the waiting call in the queue) I should usePOST /channels/createcombined with POST /channels/{channelId}/dialinstead of usingPOST /channels` which would use originate?

I am not the best ARI programmer in the world, but on the matter of your code calling stasisStart() the second time I believe pretty much you only have the following two options:
Yes, implement your original idea of a global variable to mark the first time stasisStart is called and bypass it every time afterwards. I tried this approach and it is working very well for me.
If you can arrange your scenario in such a way that the first agent to answer is considered one phone call and the transfer to the next agent is considered a new phone call (albeit with the same caller channel) then you might be able to divide your code in two ARI apps, both running registered to stasis at the same time, where agent1 answers the call with app1 and then transfers the call to app2.

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:
When you play MOH "directly" to the channel - asterisk will create a bridge for you internally. No need to create ARI bridge for DTMF too. I think (not sure) that you should create a bridge yourself only when you want to use a single bridge for multiple channels to control it easily.
The benefit of using create and dial 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.

Related

Simulring with Voicemails

I've got a basic twilio setup using studio for a simple IVR (like less than 20 minute setup kind of simple).
One thing I'm doing is using simulring to hit multiple parties and whoever answers. The issue I'm having is that if there is a voicemail to be hit, it appears to be ok with that and then plays the endpoints custom voicemail.
That's not really good with our setup.
Do you guys know how I can trigger the calls to multiple phones, detect a real person and then transfer the call, otherwise trigger a voicemail?
I can't imagine this is unique.
Twilio developer evangelist here.
There are two options you can use here, either call screening/human detection, in which you ask the person answering the phone to, for example, dial 1. A voicemail won't do this and you can leave a message or hang up, a human will dial the number and you can then take them on to the rest of the call. Or there is answering machine detection (AMD). When making an outbound call with AMD, once detected Twilio will make the webhook callback with a parameter that describes whether the call was answered by a human or a machine.
I recommend reading this article on both options, which should help you to understand what will work best for your use-case.

asterisk get credit card info

I`m trying to build a script that will capture the credit card info like card number,cvc and expiration date using asterisk 11.x and asterisk-java library for AMI/AGI integration.
Right now I am able to build a script that will acquire that info if it is called via dialplan but i have a different scenario:
1. A call enters a queue.
2. An agent from the specific queue answer the call
3. The caller wants to input the card details
4. After the caller has entered the card details is redirected back to agent to continue the call.
My specific problem is related to step 3 as I do not know how to route the caller to my AGI and then back to the same agent. (eventually the agents has to be still involved in (some) call to guarantee that when the caller returns from agi it is still available)
Any idea how can I achieve that ? I know that this is a common practice so I think that there has to be a way.
When the call is delivered to the agent, use a macro to set a custom channel variable with the agent ID or extension in it.
Then, when your credit-card authentication function is done, read the variable and use an AGI command to transfer the call back to the agent.
Further Reading
http://www.voip-info.org/wiki/view/Asterisk+variables
http://www.voip-info.org/wiki/view/Asterisk+manager+Example:+Transfer
Note if this solution solves your problem, please 'accept' it to make it easier for others with the same issue to find it. thanks!
There are no any common practice for business process like you have. That depend of you and your client only.
You can use features conf or transfer. Can transfer to special extension or to conference room.
No way say what suite you better.
For sure you need understand how asterisk work before write any AGI/AMI or dialplan application. I can recommend ORelly's "Asterisk the future of telephony" book as start point.

NServiceBus, when are too many message used?

When considering a service in NServiceBus at what point do you start questioning how many messages handled by a service is too much and start to break these into a new service?
Consider the following: I have a sales service which can currently be broken into a few distinct business components, these are sales order validation, sales order processing, purchase order validation and purchase order processing.
There are currently about 20 message handlers and 2 sagas used within this service. My concern is that during high volume traffic from my website this can cause an initial spike in the messages to jump into the hundreds. Considering that the messages need to be processed in the order they are taken off the queue this can cause a delay for the last in the queue ( depending on what processing each message does).
When separating concerns within a service into smaller business components I find this makes things a little easier. Sure, it's a logical separation, but it seems to provide a layer of clarity and understanding. To me it seems it seems an easier option to do this than creating new services where in the end the more services I have the more maintenance I need to do.
Does anyone have any similar concerns to this?
I think you have actually answered you own question :)
As soon as the message volume reaches a point where the lag becomes an issue you could look to instance your endpoint. You do not necessarily need to reduce the number of handlers. You could simply install the service a number of times and have specific message types sent to the relevant endpoint by mapping.
So it becomes a matter of a simple instance installation and some config changes. So you can then either split messages on sending so that messages from a particular source end up on a particular endpoint (maybe priority) or on message type.
I happened to do the same thing on a previous project (not using NServiecBus though) where we needed document conversion messages coming from the UI to be processed ASAP. We simply installed the conversion service again with its own set of queues and changed the UI configuration to send the conversion messages to the new endpoint. The background conversion messages were still going to the previous endpoint. So here the source determined the separation.

Oneway conference calling through asterisk

I am new to Asterisk and Voip. I wanted to accomplish a following small thing using Asterisk.
Description
Asterisk is used as server
Several Voip clients. (Two types of clients possible. One which can start a conference call, other can't call but can only hear.) Only caller client can start/end this call.
The call can't be longer then a particular time.
Is it possible through Asterisk. How does asterisk help to implement this scenario. What does I need to learn? Any web links will be very helpful.
Thanks
You can do all that with Asterisk and ConfBridge:
http://www.voip-info.org/wiki/view/Asterisk+cmd+ConfBridge
Use the following options to accomplish your objectives:
'A' — Set marked mode
'm' — Set initially muted.
'w' — Wait until the marked user enters the conference
You can use another dial plan function: TIMEOUT(absolute) to limit the conference duration.
To start I would look at the examples in the above link.

Asterisk Web API to calculate Wait Times

I would like to know if there is a web api for asterisk. I would also like to know if the average wait time to talk to a customer service agent is exposed through the api.
I have looked around online, but could not get an firm answer.
Any pointers are appreciated.
AFAIK, no, there is no such thing in Asterisk.
What does exist is the ability of parsing the queue_log file. You can get the moment the call started, the moment the call was answered by an agent, and subtract them - this will give you the wait time. Also, the first extra data value of the CONNECT event contains the time waited.
(If you are not in the mood for parsing a text file, you can register the queue logs in the database and use SQL to generate reports based on the logs. This is in fact my preferred approach.)
If you want to provide this information to other apps, you can write your own application which reads queue_log file/table and provides a webservice which returns wait times. In the case you decide to do it, we can try some more robust answers.

Resources