Hold Option in Twilio Application - twilio

Why twilio not provide a hold option as like their mute option?
It doesn't make sense, to use a API to do this option because it just like the mute option except it needs Hold music to be played during for caller.
Any solution? or update?

as for a solution, I would understand that an agent is only dealing with a single call at any one time, so having to place a caller on hold, should be pretty simply, you could simply take the call and place it into a conference where you can play the music of your choice. You could use the agent name perhaps and add hold to it to easily get the agent back to the call in the conference, so perhaps creating a conference in such a way, where the agent name is agent1, the conference name could be agent1hold. Once the agent has finished with that which he was busy with when placing the call on hold in the first place, he could simply dial back into the conference. you would need to make sure that you setup the conference correctly so that if the caller has to be placed on hold again, and the agent exits the conference, that the conference is not terminated.

Megan from Twilio here.
Basic hold functionality can be handled via modifying live calls:
https://www.twilio.com/docs/api/rest/change-call-state
An example in Python where you would use the URL parameter directing the caller to some TwiML to <Play> the caller some hold music. You easily give this a try by hosting the TwiML with Twimlbin.
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACCOUNT_SID"
auth_token = "AUTH_TOKEN"
client = TwilioRestClient(account_sid, auth_token)
call = client.calls.update("CALL_SID", url="YOUR_TWIMLBIN_URL",
method="POST")
And some examples of working with other scenarios involving <Conference> can be found on our blog.
In Java: https://www.twilio.com/blog/2015/08/how-to-warm-transfer-a-call-with-java-and-twilio-voice.html
In Python: https://www.twilio.com/blog/2015/09/warm-phone-call-transfers-with-python-flask-and-twilio-voice.html

Related

Gather DTMF inputs from user via an outbound call

I have a very simple question about gathering DTMF inputs from users via an outbound call made to them. I am describing the requirement below.
Main Requirement
I have a python script that makes outbound calls to a particular number. The person accepts the call. I say the information to them via the twiml configured. The person hears the info and presses a key on their phone. I want to capture that key input and just print it as an output using my script.
The problem
I am able to make the outbound call using the client.calls.create method described here. https://www.twilio.com/docs/voice/tutorials/how-to-make-outbound-phone-calls-python
But I am unable to gather the digits. The examples I have seen online are describing how to achieve gathering inputs with a running web application. I am NOT using this method.
I am looking to get this done via a simple script. I initiate the outgoing call from the Twilio number via the script. I don't intend to use any web applications or webhooks here.
I am putting the code below that works until making the call and reciting the options to the user.
How can I get this done? Is this possible? Many thanks.
import os
from twilio.rest import Client
from twilio.twiml.voice_response import Gather, VoiceResponse, Say
account_sid = os.environ['TWILIO_ACCOUNT_SID']='XXXXX'
auth_token = os.environ['TWILIO_AUTH_TOKEN']='YYYYY'
client = Client(account_sid, auth_token)
call = client.calls.create(
twiml='<?xml version="1.0" encoding="UTF-8"?><Response><Gather input="dtmf" timeout="5" numDigits="1"><Say>Please press 1 for sales</Say></Gather></Response>',
to='Destination_Number',
from_='My_Twilio_Number'
)
#TODO - How to Gather Digits from the user????
Twilio developer evangelist here.
There are many ways to interact with a phone call through Twilio, but when you are trying to take user input through <Gather> all of them require Twilio to be able to notify you of the digits that the user pressed. Since this is an asynchronous action, the basic method of doing so is via a webhook, an HTTP request, sent to a web application that you control.
If you do not want to host an application that responds to webhooks yourself, you could achieve this flow using Twilio Studio, which is a drag and drop editor for communications flows, or using Twilio Functions, which is a serverless environment where you can respond to incoming HTTP requests with JavaScript functions.

Twilio Flex. Start a stream once an agent has accepted a task

so, the flow is, I call enqueue Twiml verb. It creates a task and assigning to a specific agent. I have a task router callback on reservation.accepted event. I got it, but once I update a customer call with Stream Twiml - it's removing a customer from the conference which Flex creates. I'd like to avoid it somehow. To avoid that I update a customer participant with end_conference_on_exit: false attribute. Then I update a customer call with Stream and Dial.conference to get a customer back to a conference which I do not like. Is there any easier way to implement it ?
Twilio developer evangelist here.
Updating a call like that will always take it out of it's current TwiML flow and you would have to redirect back to where it was, like you have already implemented.
I know this is not starting the stream after the task is accepted, but I think the best way to implement this right now is to use the fork stream Studio widget directly before the send to Flex widget in the Studio Voice IVR flow.

Attended Call Transfer in Twilio

I am trying to create an attended transfer using Twilio.
The flow I would like is as follows:
1. Existing call with two legs (client side, agent side)
2. Using API put Client on HOLD and put Agent 1 in Conference
3. Using API Put Agent 2 into same Conference
4. Agent 1 and Agent 2 can speak without Client hearing
5. Using API add Client to Conference
6. Client, Agent 1 and Agent 2 can speak together
7. Using API Agent 1 can be disconnected from the call
Is it possible to do this?
Or do we need to create a conference for all our inbound and outbound calls?
(even though only about 5% of our calls get transferred)
Twilio developer evangelist here.
You can definitely do this. It might be easier to do this from the context of a conference in the first place, as you can take advantage of putting conference participants on hold.
To do it from a regular call to start with, you would want to redirect one of the agent or caller to new TwiML and then make sure the other leg of the call had somewhere to continue to with the existing TwiML. It's probably easier to transfer the agent's call with the REST API and then make sure that the TwiML you originally return to the user continues to place them into a queue using <Enqueue> that you can then call them out of later, or simply a looping <Play>.
Let me know if that helps at all.

Move Twilio call to a conference room

How do I move the two parties involved on the call to a conference room at the same time?
I started the call through the Web SDK, thus the call started from a <Dial> element.
Now I have the ParentCallSid and ChildCallSid to identify each party.
But using the Twilio's PHP library, I can't seem to find how I can move both parties to a new URL (which would start the conference) at the same time.
And if I try to move only one at a time, the moment I move one party Twilio hangs up the other party, probably because it was left alone on the call. And the party I moved is successfully transferred to the conference.
On Twilio's docs there's no example of doing it. I've tried passing an array, passing a string separated with spaces, chaining the calls() method, but no luck. Couldn't find the docs of that method as well.
Twilio evangelist here.
Think the best option would be to just put them in a <Conference> at the start of the call if you can. Doing that is pretty simple. You drop the incoming call in the the conference, then using the REST API, you initiate the outgoing call to the second party. When they answer you drop them into the same conference.
If that's not an option, what you'll need to do is use the REST API to redirect each call leg into the conference. Redirect lets you tell Twilio to go get a new set of TwiML to execute for a specific call SID. In your case you want that TwiML to be something like:
<Response>
<Dial>
<Conference>BrayansBestConferenceEvar</Conference>
</Dial>
</Response>
Check out Modifying Live Calls in our docs for more info.
Hope that helps.
I've recently been using their API and if you add a pause after your initial dial command to connect to a call, then when you issue a command to move the child call and the parent right after, the call will be active for the move to register in their system. I use a 2 second pause for this.

Twilio twiml say different messages to each person on call?

I'm using Twilio to create phone calls between two phone numbers. In certain cases during the call I want to interrupt the call and play IVR messages. When I interrupt the call I want to play a different message to each person.
I see the way to interrupt the call is by redirecting the call here.
Then if I want to say some thing I use the twiml say command here.
But I can't see any way specifying which recipient receives what from the twiml. It seems that when you say a message it will be played to both people on the call.
Can Twilio support this functionality?
Twilio evangelist here.
So I think what you are going to have to do in this case is leverage a Conference. This may change how your initiating the two legs of the call. If you are currently using <Dial> to connect the two callers together, the problem there is that there is no easy way to get the Call SID of the second leg of the call. This means there is no easy way to redirect that call.
So instead of using <Dial>, what I normally do is when Caller A dials in, I put them into a conference, saving the name of the conference room to a database. Then I use the Twilio REST API to make an outbound call to Caller B. When they answer I put them into the same conference room as Caller A.
This also means I have both calls Call SIS, which I can use to redirect the two call legs independently. So in your case, when you wanted to Say something to Caller A, you would simply redirect them our of the conference, use <Say> or <Play> to talk to them, then redirect them back into the conference. Same process for caller B.
Hope that helps.

Resources