Calling from twilio sub account using <dial> - twilio

I am using voice-quickstart-ios but i am facing some problems here.
I need to know a few things.
How can I make call from sub account without using REST API rather TwiML <dial>?
If point 1 is not possible then how can i make call without changing leg of the call or if i had to change the leg then how can i retrieve it in voice-quickstart-ios SDK?
How can i record a call with leg CallSid using REST API?(if i can retrieve leg of the call)
Does twilio cloud have scheduler? (eg: firebase pubsub)?

Answers:
Q: How can I make call from sub account without using REST API rather TwiML ?
A: You cannot initiate a call using Twilio Markup Language (TwiML), only manage an existing call. You will need to use the REST API (Calls Resource) to initiate a call.
Q: If point 1 is not possible then how can i make call without changing leg of the call or if i had to change the leg then how can i retrieve it in voice-quickstart-ios SDK?
A: I don't understand this question. Can you provide more details on what you mean? Two call legs are involved when connecting parties, sometimes referred to as the "parent" leg (the main leg) and the "child" leg, the leg that is kicked off by some action of the parent. Your iOS SDK leg would be the parent leg, if making an outbound call toward Twilio and would use TwiML to create the child leg.
How can i record a call with leg CallSid using REST API?(if i can retrieve leg of the call)
A: Using the REST API Recording Resourcee.
Q: Does Twilio cloud have scheduler? (eg: firebase pubsub)?
A: Not at this time.

Related

Twilio Gather followed by call forward (Dial) after user input without using another webhook

I'm using the Twilio C# SDK to initiate an outbound call from Twilio, during which user's DTMF input needs to be gathered (Press 1 to be transferred to sales, 2 for support...), and the subsequent action is to forward the call to a designated E164 number that matches the key.
So the VoiceResponse.Gather() method takes this action parameter that is a webhook Uri to which the user input will be posted and we can surely forward the call from there.
var twiml = new VoiceResponse();
twiml.Say("...");
twiml.Gather(numDigits: 1, action: webhookUri);
But is there a way to achieve this simple forward instruction within the current twiml object without involving an external webhook? Basically something that gathers the user input digit, correlates to a E164 number(using a predefined dictionary), then Dial directly.
Twilio developer evangelist here.
No, there is not a way to achieve the instruction after the <Gather> without another webhook. You must pass a URL as the action parameter and respond to the webhook with the next set of TwiML to direct the call onward.
If you do not want to host the application that responds to this webhook 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.

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.

Twilio Answering Machine Detection for number dialed with 'Number' node inside 'Dial' node

It's not listed anywhere if Answering machine detection will send parameter "AnsweredBy" in request when a number is dialed from within a connected call with 'Number' node.
I think it doesn't send any such parameter because i'm getting nullpointer exception when i do request.getParameter("AnsweredBy") number dialled by 'number' node inside 'dial' node.
Is it that twilio hasn't implemented Answering machine detection fully? or is there any way i can make it work
Twilio Evangelist here. I'm afraid that currently the AnsweredBy parameter is only available when making an outbound call with the Twilio REST API. If you make the outbound call using TwiML's <Dial> then you will not get this parameter.
Depending on your application, if you can use the the REST API instead of TwiML to initiate the call, then you should be able to get this work as you need. But I would need a little more information on what your call flow is to provide any help.

Resources