Can you do peer to peer calls with Twilio? - twilio

If I wanted to create an interoffice phone system with Twilio can you call between two registered clients on Twilio, i.e. can I call my co-worker in the office across from me?
Bonus prize, if you can do that, can you enqueue the call to the other person, essentially creating a multi-line phone for people?
Thanks!

Twilio evangelist here.
Sure, you can absolutely make a Client to Client call. The Twilio Client for JavaScript Quickstart has a walk-through showing you how to do this:
https://www.twilio.com/docs/quickstart/php/client/browser-to-browser-calls
You can also use the Queue verb in a client-to-client call.
Lets say you want to put Call A (lets call them 'customer') into a queue. To do that you would create a new TwiML App and point it at a URL that returns the <Enqueue> verb. When you initiate that client you would use that TwiML Apps SID to generate the Capability token.
Now for Call B (lets call them 'agent'). If you want to connect them to callers in your Queu, you would create another TwiML app whose URL returns TwiML with the <Dial> verb containing the <Queue> noun. This tells Twilio to connect the 'agent' with the first caller in the queue. As with the 'customer', when you initialize the 'agent', you would use the 'agent' specific TwiML App SID to generate the Capability token.
Hope that helps.
Devin

Related

Twilio Flex Post caller ID's phone number to external webpage

I am setting up a Twilio Flex acct and am wanting when a caller calls and lets say says or presses # 2 I want to ultimately take the callers phone number from the caller id and do a post to an external webpage. I am looking for documentation on this. Anyone have any suggestions?
The Twilio Studio flow I am having issues with it
Twilio developer evangelist here.
By default, incoming calls to a Flex number are directed through a Twilio Studio flow. The default flow passes the caller straight through to get assigned to an agent in Flex, but you can add other widgets to ask for input or direct the call any way you want.
One of the available Studio widgets is the Make HTTP Request widget which allows you to make an HTTP request to a URL of your choice. You can add data to the body of the request using the widget. To get the phone number of the caller you can use the variables set by the inbound trigger. In the case of the phone number of the caller, you need {{trigger.call.From}}.

in case of multiple outbound calls, how to identify the call uniquely

I am creating a voice survey application so that the the users can complete the survey over voice using the DTMF inputs.
I am creating multiple calls at a given moment, but i get the call information only when the call connects and the user send the DTMF.
Is there a way, i map the received DTMF input with a unique outgoing call ?
Twilio developer evangelist here.
When you create an outbound call the object that is returned includes a sid property that is the unique identifier for that call resource within Twilio. That sid will be present in the webhook requests as the CallSid parameter. So, if you store the initial call sid against your user somehow, you can always look it up using the information in the incoming webhook request.

Twilio voicemail with worker order

I am trying to implement a voicemail with twilio, for that reason I created a worker that will be the final assignment and it will redirect to a Twiml voicemail endpoint.
Problem is that my taskrouter does not assign the incoming call to my virtual user although it's the only one available.
And here is the workflow.
It seems that the voicemail worker had a task assigned so it couldn't get another assignment.

how to execute dialing a queue in twilio php?

How do I execute this code?
$response = new Twiml();
$dial = $response->dial();
$dial->queue('support', ['url' => 'about_to_connect.xml']);
echo $response;
I'm using laravel and used this function on button click. All I get is a Twiml return.
Twilio developer evangelist here.
Let me explain the use of TwiML within Twilio applications. TwiML does not initiate phone calls, it is used to react to events within phone calls.
When you receive an incoming call to your Twilio number or when you make a call via the Voice API which connects, Twilio then needs to ask your application what to do with that call. It does so by making an HTTP request to the URL you provide for the phone number or via the API request. Your application needs to respond to that request with TwiML to provide the instructions for the call.
In your case, it looks like you're trying to make a call to a number and then connect that user to the first person waiting in the support queue. To do that, you should keep the TwiML you have, just don't execute it on the button click.
Instead, when your user clicks the button you should make the API call to generate the call and direct Twilio to call this TwiML when the call connects.
This tutorial on click to call using Twilio and Laravel should help with this.

Twilio Client Call Routing

Looking over the Twilio Client setup am I correct in thinking that for each person I want to route a call to that I need to have a TwiML app set up for that person.
That way they each have a unique name to register with to accept inbound calls. Then I am also limited to only haveing 1,000 apps
Twilio evangelist here.
You should only need to have a single TwiML App, but you can dynamically generate the TwiML returned from that apps Voice Request URL with whatever client name you are trying to reach.
Hope that helps.

Resources