Setup
Suppose you have a caller who is enqueued into a queue. Then, your app dials an agent, who upon answering the call is connected to the caller in queue. The two parties are now bridged, or connected.
By passing hangup_on_star: true to the Dial verb, the agent is able to end the call by pressing star.
Question
Is there an equivalent way to enable the caller to end the connected call by pressing star? I would like for both parties to have this ability.
Workaround
The only way I can imagine enabling the caller to end the call is to have them send an SMS with something like "end" or "hangup" to my Twilio phone number, and then I would have logic to update the call resource with status: completed.
First up, setting a call to status: completed will end the call, which the caller could do by simply hanging up their phone.
If you want them to be able to hang up and then carry on to something else in the call then you won't be able to do this with a direct bridge like a <Dial><Number>. Instead, it would be better to send the caller initially into a <Conference>.
That way you can nest the <Conference> in a <Dial hangupOnStar="true"> and let the caller also hangup with star. <Conference> also supports wait music if you set startConferenceOnEnter="false" for the caller.
Then, when you dial out to the agent, the TwiML you provide to them should direct them into the <Conference> with startConferenceOnEnter="true" so that when they connect they can immediately start talking to the caller.
Then, for either side of the conversation you can add further TwiML after the <Dial> and when they hang up with star they will go onto that TwiML.
Related
Scenario:
Person A calls my server. My server returns Twiml with Dial plus extra, connecting them to my client C. Sometimes C's phone is busy, and the extra just tells A they couldn't be connected, try texting.
I want to have a failover, where the same thing happens when C is not busy, but if C is busy, A is put in a queue, as are subsequent callers. When C's call ends, I try to connect A to C.
Is there a way of doing this with simple Twiml verbs, like dial.queue, and Redirect? So far I've failed: I can enqueue A when C is busy, hearing hold music and all, but I've utterly failed to get A off the queue and in touch with C. I suspect I'll need to create calls using the API, but figured I'd ask to see if the Twiml way should be doable.
I am aware that I could just throw all callers into a queue, but for business reasons I want to preserve the "ring and connect" behavior when the client is immediately available.
Twilio developer evangelist here.
The bit here is getting A to start a new call once they are done with the call they are on. You could, for example, send an SMS message to A to tell them that someone is waiting in the queue. Then, when they call their Twilio number back return TwiML that <Dial>s into the <Queue>.
When using the <Queue> TwiML, the caller will be connected to the person waiting at the front of the queue.
Alternatively, if you don't trust A to call the queue back, you could keep trying to periodically make calls to A using the REST API and once the call connects return the same TwiML to <Dial> into the <Queue>. If the caller hangs up and the queue becomes empty before A answers the call, you can stop calling and perhaps send a message to inform A that someone called and they can choose to call them back.
I want to ask if it's possible to forward call not from called side but from caller? For example, first user calls to second user. Second user picks up. Then system (or second user) automatically (or on button click somewhere) calls to third user and the first user hangs up the call so when third user picks up then there are second user and third user on the call?
Thanks.
I was able to forward call from called user to thid party but the common user was caller. For example it's described here - https://www.twilio.com/docs/voice/tutorials/call-forwarding-nodejs-express but it's not what I need. I want to forward call from caller not from called user.
Twilio developer evangelist here.
This seems like something you could achieve using a <Conference>. You could have the first user dial a Twilio number that dropped them into a conference call with the following TwiML
<Response>
<Dial hangupOnStar="true" action="/dial-next-user">
<Conference>Forwarder</Conference>
</Dial>
</Response>
This would set the initial caller to listen to hold music. You could then initiate an outbound call with the REST API to caller 2 by creating a participant for the conference. This will dial the user into the conference too.
Now, to get caller 1 to hangup and connect to caller 3. Notice I included hangupOnStar="true" to the <Dial>. This would allow caller 1 to press * and leave the call. When they do that Twilio will make a webhook to the URL defined by the action attribute. You can then respond to that request by dialling in caller 3 using the same participants API and thus achieving connecting caller 1 to 2 and then 2 to 3.
Let me know if that helps at all.
Do Play verb with loop 0 value cause the music to play till the call is connected?
https://www.twilio.com/docs/api/twiml/play
Twilio developer evangelist here.
Effectively in this situation you are looking to put your user in a queue while you dial your agents. This is how you'd do it:
First up, when you receive the incoming call you can respond with <Enqueue> that directs a user into a queue. You can set a waitUrl attribute that allows you to define either a music file or TwiML that will play while the user waits for the call to be answered.
<Response>
<Enqueue waitUrl='/wait-music'>incoming</Enqueue>
</Response>
While your incoming caller is waiting, you can then start making calls to your agents using the REST API. Once an agent connects and accepts the whisper you would then join the calls by dialling the <Queue>.
<Response>
<Dial><Queue>incoming</Queue></Dial>
</Response>
With this method you'd need to maintain whether your user has been answered yet and manually handle whether to redirect their call from the queue to more TwiML to <Record> a voicemail.
There is a more robust way to set all this up. It still requires enqueueing in the first place, but you should take a look at TaskRouter. It's an automated call distribution service with configurable workflows. There's a bit more setup involved on the Twilio side, but TaskRouter will handle directing calls to your agents and allow you to define rules for how to handle a user who's been waiting too long. I recommend you check out the TaskRouter documentation and then take a look at the quickstart guide as an example.
Let me know if that helps at all.
I am using Twilio to create call tracking phone numbers that redirect to another number using the Dial verb. I am also recording these calls. Here is an example of my TWIML
<Response><Dial record="true" action="http://example.com/PostCall">555-555-5555</Dial></Response>
I want to be able to terminate the call recording but not the call using something like the Record verb's finishOnKey option. Is this possible?
The reason is, a call comes in to a call center and is transferred to a lawyer. I want to record the call center part of the call but not the attorney/client part of the call. If pressing # during the call could stop the recording but keep the call active it would solve my problem.
Is there a way to stop recording without terminating the call?
Can the record verb be used in conjunction with the dial verb?
The <Record> TwiML verb is best if you want to record one person talking. I'm assuming you want to record both parties connected via <Dial> in the call center so you would rely on the record attribute as you have above.
Read the FAQ for the full breakdown on the difference in recording settings.
Is there a way to stop recording without terminating the call?
Depending on the flow of your call center you might modify the live call via the REST API and redirect the call to new TwiML where you set recording to "false".
call = client.calls.update("CALL_SID", url="https://example.com/no-record.xml",
method="POST")
Alternatively, you could add Twilio itself as a 3rd call leg in a <Conference> call, and let it handle recording. This way you can use the REST API to modify that leg without disrupting the primary 2 callers, including stopping recording of the call midway through while the other 2 callers are still live.
I'am using twilio to set up a call between 2 people
I'd like to manage call transfer asked from one side (like when a dtmf key is pressed). The other side could listen to a prompt who could be "please wait while your call is being transfered"
Any chance to do that properly with twilio?
When both parties are connected, Twilio blocks execution of further verbs until the caller or called party hangs up. That's why it is not possible in regular way.
But you can hangupOnStar attribute to hangup the caller party. And set an action URL to continue next dial verbs.
Here is a detail answer:
Twilio call transfer from in-call