Twilio - Call another person during a call and setup a conference call - twilio

I'm using Twilio to build a service right now. Here's my use case:
In a web page, I input a phone number and call it using Twilio JS (already done). During the call, I want to input another number and call another person. The call with the first person will be forwarded to the conference. When the second person answer the call, he will join the conference too.
Is it possible to use Twilio to implement this case?

This is definitely possible with twilio. i have worked on that scenario directly and twilio api works excellently well.
When u initiate a call from the twilio number to the first number, use the call back url to connect the person to the another person you want.
This can be done using twiML, which has <Dial> which will be of great help to you.
This is the easiest way of implementation.
The other way, is pretty clean but takes time to implement.
The twilio api provides conference capability themselves.
So you can create a request of conference with all the numbers that need to be connected.
The down side of this is that, all number will be called and connected, if your requirement is to call the first number and then only connect him to another person, then i wouldnt recommend this solution.
I hope this helped you.

Related

How to Create Twilio Conference Before Calling Anyone?

I'm looking for a way to generate a Conference resource within the Twilio system before adding anyone to that conference.
The official recommended way to start a Conference is by returning TwilXML in response to a Twilio callback. This can either be done in response to someone calling a Twilio number or, in a somewhat indirect way, by making a call and returning TwilXML which will connect the person to a conference once they pick up. All of the APIs to modify conferences use the ConferenceSID as the handle to decide what conference to change. The problem with both of these methods is that they do not give you the ConferenceSID until you receive a callback.
Unfortunately callbacks do not contain any identifying information about who generated them. They do have a ConferenceSID (identifying the conference), and a CallSID (uniquely identifying the call connecting the caller to the conference). When you get your first callback, there appears to be no way to be able to match either of those identifiers. If you start multiple conferences and get two callbacks with different ConferenceSIDs and different CallSIDs, it is inconvenient to tell which conference is generating which callback.
That's why it would be easiest to create a conference resource and then use the versatile add participant call. This would simplify the entire backend flow for using conferences by starting with the ConferenceSID and going from there.
P.s. To head off other suggestions - there are ways around this. You can specify different callback URLs for different conferences. You can specify different friendlyNames for different participants which you can match in your backend. It's totally possible to work with, but I would like something cleaner, which would require making conferences before anyone is called.
Twilio developer evangelist here.
There is no way to create a conference resource from the API. You can only do so by directing a caller there with the <Dial><Conference> TwiML.
Further, I don't quite understand when you say "When you get your first callback, there appears to be no way to be able to match either of those identifiers." What are you trying to match? You could use the CallSid to look up the From number of the caller joining the conference. You also receive the FriendlyName in the callback, which is the name you set in the TwiML <Conference>Friendly Name</Conference> which you could choose to help determine which conference is which.
Does that help at all?

Twilio Queue Connecting to the wrong call

I am working with a twilio queue and I have multiple numbers that come into the queue. The operator receives a popup and it shows the department that a customer is calling into (based on the twilio number they dial).
Like:
Technical support [has it's own number]
Customer Service [has it's own number]
Sales [has it's own number]
I am presenting this info to the operator and when they accept the call it connects the operator to the queue and pops off the top.
The issue: If another call comes in it pops someone off the top of the queue and they may have called a different department. So, the info I am showing to the operator is not accurate. The first person in the queue may have called sales, and someone else calls technical support. The operator answers technical support when they really called sales. So I am displaying bad info.
I know they have twilio task router. But, is it possible to solve this with the queue? Essentially I want to be able to identify what number someone called which categorizes it into the right department.
Can I pop a specific call off the queue based on call SID or something like that so I know I am delivering the right call?
Thanks
Twilio developer evangelist here.
You have a couple of options here.
You could enqueue the calls coming in to your support/customer service/sales numbers into differently named queues. That way, when an operator accepts a sales call, they will only dial into the sales queue.
Alternatively, instead of dialling the queue, you could use the REST API to update the queued call, redirecting it to connect to your operator another way. For example, if your operator accepts the call they could <Dial> into a <Conference> and at the same time redirect the call, via the REST API, to that conference too.

For voice tasks in Twilio Flex, how do I get the current conference ConferenceSid?

I can see that for all the voice interactions, behind the scenes flex is using its voice API to create a conference between caller and worker. How do I obtain the created ConferenceSid after the task has been selected and reserved?
What I would like to do is simply Get the value upon connecting.
I can see a very long and not so pretty way of getting it, which is by running a twilio function that iterates over every conference, making additional requests to see the participants. But that seems way to complex to me.
I can see in the logs that the conference friendly is being printed
ConferencesState handleConferenceUpdate WT5d0800a3ce8724fd55cf89841c48XXX
Is there anyone who can help here?
UPDATE:
#philnash below answered the question exactly.
Twilio developer evangelist here.
There seems like a couple of ways to get hold of the Conference SID in a Flex interaction.
First, the task that your worker accepts has a number of attributes that are set by Flex and relevant for the type of task it is. For a voice call, you will find a conference key, which has an object including the sid as well as entries for the participants.
Secondly, I found that the <TaskCanvas> component in the UI is passed a context that includes a conference object. That object then has a source property which expands to an object with a conferenceSid property, as well as other properties, including a participants list.
Does that point you in the right direction?

How to record when Make a call between two numbers not registered in twilio

I did when Make a call between two numbers not registered in Twilio using following link "Make a call between two numbers not registered in twilio" in C#. But I need to record while pressing 1 during the call at any time.Thanks in advance.
Twilio developer evangelist here.
You cannot nest a <Gather> within a <Dial>, so you can't interrupt a call between two people by pressing 1.
You could place your callers in a <Conference> (in fact, according to that SO question you linked to, it looks like you might have already). Then you can use <Dial>'s hangupOnStar attribute to end the conference for the moderator and allow them to record the call.
You'd then need to direct the moderator into a new <Conference> with the record attribute set to record-from-start. And then you'd need to redirect the original caller from their original conference to the conference that is being recorded.
Let me know if that helps at all.

Twilio: Change caller ID based on number called?

I have two numbers that forward to a single phone, one work number (A), and one personal number (B).
(A) was setup using Twilio to forward to my phone.
Is there anyway to have some sort of caller ID indicator letting me know which number is being called? That way I can distinguish whether the incoming call was for my work or personal number.
Any help would be deeply appreciated.
Thank you,
This depends on how you have it set up.
If you have your office and personal line ring a twilio number you would do something like this
First you would add a verified outbound caller ID with twilio
https://support.twilio.com/hc/en-us/articles/223180048-Adding-a-verified-outbound-caller-ID-with-Twilio
Then you on an inbound call you would grab the id of the number called. It will be listed as the To number.
https://www.twilio.com/docs/api/rest/call
Then when they call the phone you are forwarding it to you would just specify the To number from before as the From number.
https://www.twilio.com/docs/api/rest/making-calls
If you have a different set up or would like to have twilio make an announcement instead of showing that caller ID there are other work arounds for those methods too. Just let me know and I can edit my answer.

Resources