Is there a way to respond to Twilio studio executions programmatically? - twilio

I would like to build an end-to-end test of my Twilio Studio Flow, where it receives an incoming call and from there proceeds to expect user input via dial-pad and voice. I've also connected the REST API as an additional trigger to point to the same tree as the voice path. So far I can create a new execution of said flow and have the steps returned, and from there I would like to respond to each additional step with test input (in the form of TwiML) and continue the execution to determine the pass/fail of my tests with expected input.

There is a recent blog I read that may be of interest to you.
Automating how IVR call flows are tested
https://tech.ovoenergy.com/automating-how-ivr-call-flows-are-tested/
ivr-tester
https://github.com/SketchingDev/ivr-tester
That said, is there a particular issue you encountered with the above approach you are taking? It is not clear what the issue is.

Related

Twilio Flex Voice Mail to Unavailable

We have set-up our Flex, and stuck on one of the last steps. We are a small office, and have a main number that clients call us on. If they ask for a specific employee, more importantly, if the specific employee is required to answer the client issue, and they are marked UNAVAILABLE, it doesn't appear we have access to send the call to voicemail (the transfer button is grayed out).
Is there a work around? A way to direct call the VM? Do we need to tweak our flow? If not, it appears we need to be logged in 24/7 to have access to VM's. A fairly inefficient and expensive option.
OK, I think I know what the issue is. A call comes through to one agent in Flex, but they need to transfer it to the other agent. If the other agent is also available, they can transfer the call no problem. If the other agent is not available, you would like to transfer the call to that agent's voicemail, but there's no way to do that right now.
The issue is that Flex is built around available agents and doesn't have voicemail built in. You've added voicemail as part of the Studio Flow, but this is not integrated to the Flex interface at all.
I would solve this with a Flex plugin that does a couple of things:
Add a button to the agent transfer list for unavailable agents to send to their voicemail.
That button would trigger a request to a Twilio Function, sending it the Call's Sid and the agent you want to transfer to.
The Function could then use the calls API to update the call, redirecting it to the existing voicemail handlers that you have for your agents.
I'm afraid I don't have example code for this plugin, but there is great documentation on building Flex plugins that you can follow to get up to speed.

Twilio Cold Transfer, no queue overflow

Requirement
Our business requires us to expand the functionality of the transfer feature that is already built in to
Twilio Flex.
What exists today
Today's functionality (out of the box) is partially what we need with the Actions.TransferTask functions. The issue with this is that when we choose an agent to cold transfer to, and they're not available, the call gets put back in to a queue and picked up by the next available agent. This seems completely counter intuitive to how I would expect it to work as I would expect that call to go to voicemail if the agent is unable to pick up.
What we tried
We have logged a support ticket with Twilio to no avail. Any attempts to use the StartConferenceCall won't work because we're on an active call. Twilio functions' Dial doesn't seem to work as I don't seem to have access to my current call. (Dial is meant for calls that are about to happen?) But Dial seems to be the only process that allows digits to be passed. Therefore, conferences & participants don't seem to be the answer either.
What we do have though is a phone number that will end up in our primary work flow and if the incoming number is the aforementioned number, we skip the voice prompts, accept digits and redirect to the agent. This part works.
What we need
We're looking for a Twilio function or plugin Action (or some other method that I'm unaware of) that can cold transfer a call to another agent with no over flow to a queue (let it get picked up by voicemail).

How to send a voice message using Twilio-Client-Javascript or using Twiml - Our understanding & possible approach

We are working on a requirement where we are initiating a call from Twilio client SDK [Javascript]. We have an ASP.Net MVC Core application handling incoming Webhook request from Twilio Twiml app. To initiate a call from a client side, we are using Twiml dial verb and providing from and to number. Further our requirement is to send a voice message as soon as an answering machine is detected.
As we have used Dial verb of Twiml, we can't pass detect answering machine and hence can't send voice message. This is by design of Dial verb as it is an attended calling mechanism. After going through a documentation, I have found that, REST API allows to detect and answering machine and also allows sending a voice message. Twilio REST API shall be used for an unattended call initiation and rule based workflow. Twiml Dial verb uses VoiceResponse class to initiate a call whereas Twilio REST API uses CallResource to initiate a call.
I wanted to confirm my understanding before I start working on possible alternatives.
We are thinking of implementing above use case with below steps
Make a Twilio REST API call to initiate an unattnded phone call with answering machine detection option enabled.
If API responds with answered_by value as human or unknown then we will invoke a webhook that shall patch the call using Twiml Dial verb.
If API responds with answered_by value as machine then it shall use a Twiml which contains a voice message that can be sent to callee.
The above is correct. Is there a specific question, however?
Twilio’s Answering Machine Detection Now Generally Available
https://www.twilio.com/blog/answering-machine-detection-generally-available
We have developed an outbound call mechanism using TwiML app and Dial verb using Javascript SDK & ASP.Net Core MVC with Twilio SDK. We came across an issue where we found that answering machine detection and voice message drop is not supported by Dial verb. We are taking a different approach where we will use Twilio REST API to initiate a call. It has a provision to detect an answering machine and respond to an outcome of answering machine detection such as patching an agent or sending a voice message. Further, There are 2 possible configurations and workflows.
MachineDetection:Enable
Possible values for answered_by are machine_start, human, fax or unknown.
1.1 If value is machine_start then we can't send a voice message as it is not waiting for "beep" after which a voice message can be send.
1.2 If value is human then we can invoke a webhook for patching a user into current call.
1.3 If value is fax then we shall not take any action [Out of scope]
1.4 If value is unknown then we may patch a user to take action. This can be a deciding factor for making user productive. More number of requests ending in Unknown shall degrade the desired outcome.
MachineDetection:DetectMessageEnd
Possible values for answered_by are machine_end_beep, machine_end_silence, machine_end_other, human, fax or unknown.
2.1 If value is machine_end_beep then we can use a TwiML url to send a voice message to a callee.
2.2 If value is machine_end_silence then we can use TwiML url to send a voice message to a callee. Such scenarios needs to be handled with this default action and improved over period of time.
2.3 If value is machine_end_other then we can use TwiML url to send a voice message to a callee. Such scenarios needs to be handled with this default action and improved over period of time.
2.4 If value is human then we can invoke a webhook for patching a user into current call.
2.5 If value is fax then we shall not take any action [Out of scope]
2.6 If value is unknown then we may patch a user to take action. This can be a deciding factor for making user productive. More number of requests ending in Unknown shall degrade the desired outcome.
Rerference:
https://www.twilio.com/docs/voice/answering-machine-detection
https://www.twilio.com/docs/voice/answering-machine-detection#webhook-parameters
Based on above workflows we are deciding to use MachineDetection:DetectMessageEnd configuration option. We do have a query regarding point number 2.4. Below is a scenario,
We have made an API request to initiate a call with MachineDetection:DetectMessageEnd configuration. A callee has picked a phone and introduced himself/herself. Twilio has detected a human and set answered_by to human. This has triggered a webhood which as patched a user to current call. It is very much possible that a user who has joined the conference is not aware of who is at other end and can end up asking who is this? This may anoy a callee and affecting overall customer engagement.
This is the scenario shared by our client based on his experience.
I would like to know how fast Twilio can detect "answerd_by"?
Is there a mechanism that can allow a recording of a callee to be played after patching a call so that a user is aware of who is at another end. Is it something Twilio can provide or we need to use the recording feature to do so?
I understand that Twilio has various options to tweak AMD parameters through a Web API however, we may not have enough data to tweak them before the start of the project. We might get there after rolling this feature in production.
Also our client mentioned that sometimes, a voice message is not delivered completely?
Is this something observed by Twilio customers too?
If so what are the best practices to ensure this shouldn't happen?

How to implement video call with twilio task router

We are using Task Router for our Call Center Project. Incoming calls routing through Task Router to our agents. Now, We have to impliment Video Call as well. I want to understand, how we can use Same Task Router for Voice Call and Video call to distribute to our Agents ?
Is there any code of reference example to use that ?
Twilio developer evangelist here.
We have one example of a multichannel contact centre that is powered by TaskRouter. You can see it on GitHub here: https://github.com/nash-md/twilio-contact-center.
When you integrate Voice with TaskRouter, the TwiML integration makes it straightforward to create tasks by enqueueing the call to a workflow. When you are working with other inputs you need to manually create the tasks and handle the assignment on the other end too. This app should help you see how that works.
I'm not super familiar with the codebase myself, but you probably want to start by checking out the task controller which starts video chat rooms and creates a task to match. Then the workflow controller is the client side component that deal with receiving, accepting or denying reservations.
Let me know if that helps at all.

Twilio: IVR connect to agent voicemail

I am using the IVR sample script found here:https://www.twilio.com/docs/howto/ivrs-call-screening-and-recordingLet's say that someone calls and connects to agent 1, if the agent reject's the call, it then hangs up the person who called (which is pointless). I want to redirect that person if the agent doesn't pick up or the agent rejects the line to a voicemail twimlet (http://twimlets.com/voicemail?Email=my%40email.com&). I know that this should be easy to do but I am having a hard time figuring out where to add the twimlet,<redirect>http://twimlets.com/voicemail?Email=my%40email.com&</redirect>
I think a good place to look for this might be in the OpenVbx project.
This is their link http://www.openvbx.org/.
In the source code, I would direct you to have a look at the Dial applet server side implementation.
a basic version of steps would be this.
When dialling an agent instead of only dialling one agent, you dial a list, group or department of agents, you can implement your own logic here. I would suggest taking a careful look at how the whisper functionality was written, basically from it you can see that an agent is required to accept the call with interaction by pressing a button, this helps if you agents devices that you are placing calls to, are perhaps mobile devices and go into voicemail. In the end, while you are dialling more than one agent, the first agent to pickup the call is the agent who will be connected to the caller. The rest of the dial attempts will be cancelled for you.
The source code for the project resides here https://github.com/twilio/OpenVBX
while the source code is in PHP, with Twilio it is luckily very easy to see how one would convert this to other languages. You could also simply get the project running and look at the Twiml that is generated when dialling for example and use that as guidance for your own solution.

Resources