Route Incoming Twilio Call to another Browser Client - twilio

An agent needs to route the active call to another agent.
I got one article to do with Node.js here. But, not sure what to do with Javascript client.
Can I modify an existing connection? Following is my code for accepting incoming calls.
Twilio.Device.setup(window.twilioToken);
// Handle incoming calls from Twilio
Twilio.Device.incoming(function (conn) {
conn.accept();
});
Now, one call is active on the browser. Is there any method to update the client based on Client SID?

Twilio developer evangelist here.
If you have multiple agents that you need to answer incoming calls using Twilio Client then you might want to take a look at Twilio TaskRouter.
TaskRouter is perfect for distributing calls to call center agents. It allows you to setup workers and workflows and turn incoming calls into tasks that are delivered to available workers. Check out the quickstart guide to TaskRouter and how to build a multi-channel support desk using TaskRouter.

Related

How to check status of a Twilio client before connecting call

I am using Twilio client to call my customer or receive the call from customers.
I want to play a busy voice message to customer if the Twilio client is engaged and talking to any other customer. how can I achieve that.
Twilio developer evangelist here.
You can’t tell the status of a Twilio Client from outside the page it is live on. Instead it is best to manage the availability of your agents via TaskRouter. With TaskRouter incoming calls can be queued until there is an available agent to answer. Those calls can also timeout, be assigned to other queues or be redirected to leave messages as in a voicemail system.
I recommend you look into TaskRouter.

Twilio SMS and Survey

I am using Twilio to communicate with my users via SMS. I have my own web application that reads the incoming Twilio message. I use a web hook for that purpose. I am able to read the incoming message and process it in my web application.
I would like to send out survey questions periodically during the day to the same number. I researched the Studio flow for this purpose. It looks like a good option to write a survey.
I have a doubt though. In twilio console I added my url as a web hook to receive all sms messages. If I build a studio flow then how do I use that. I already have a web hook but I also want to do a survey using the same twilio phone number. Is there a way to do this in Twilio.
What I want to achieve is I receive SMS from a twilio number all through the day using a web hook. Every 2 hours or so I would like to send out a survey question to the same twilio number and process the answer in my end. What is the best approach to do this? I use c# and .net core to write my web app.
Thank you
you can do this.
You would use the REST API path of the Studio Trigger widget of your Studio Flow, to kick off this outbound SMS. You can find more details below. The scheduling logic, every 2 hours, would be handled by your application logic.
Trigger a Twilio Studio Flow Execution via the REST API
Execution
We use the REST API trigger for the Appointment Reminder Studio example.

Twilio - Messaging Service Inbound Setting to Twilio Function instead of Webhook

I have a phone number that I configured the inbound messaging to run a Twilio function sends the message to the AWS SQS service.
But due to outbound traffic and other limitations, I setup a Messaging Service and I'm using the Passthrough API for bulk outbound. But for the inbound configurations for the Messaging Service, we are only limited to dumping the message, executing a webhook, or starting a conversation. I don't have the ability to run a Twilio function.
If I go back to the phone number configuration I can't have it both ways... it's either the Function or the Messaging Service.
Is there a way I can run a Twilio function on inbound messages to the Messaging Service or do I need to do this all in the webhook?
Twilio developer evangelist here.
When you choose Function in the inbound configuration for a number, it is just setting up the number to point to the Function's webhook URL.
So, you can enter the Function URL as the webhook URL for your messaging service and you shouldn't need to change anything else.

Identify forwarded calls

I'm very new at using Twilio. I just created my first flow using Studio, which forwards SMS and calls to my personal phone. Is there a way to differentiate forwarded inbound calls (business) from regular direct calls (personal)?
Thank you!
Twilio developer evangelist here.
I would edit the caller ID in the Connect Call To widget in Studio to be a different validated outgoing number so you know if it is that number, it is for business, as mentioned in this tutorial on call-forwarding with Studio.
You could also trigger the sending of a SMS message from Studio before forwarding the call or SMS message saying that the incoming message/call is for business.
We also offer the Lookup API in your console to find information like location, caller name, and carrier.
Hope this helps!

Can outbound calls be made through Twilio TaskRouter

Currently we have a call center application that is built on Twilio Client for JavaScript (for the WebRTC call handling capabilities) and we have started to use Twilio TaskRouter for managing the workflows of incoming calls. We have incoming calls properly being routed to our TaskRouter Workers using the Twilio Client WebRTC client. We previously had outbound calling working through the Twilio Client library in our JavaScript client and this worked well. Now that Twilio TaskRouter has been added to the mix and there's the concept of current Worker activity, our outbound calls never actually dial out to an external phone number.
The TaskRouter documentation for assignment callbacks seems to suggest that outbound calling is quite doable using Twilio TaskRouter, but the documentation seems to frame the use cases to outbound calls from one WebRTC client to another WebRTC client using Twilio Client. We want to create an outbound call from a Twilio Client WebRTC worker to an external phone line (e.g. calling back a customer). I'm pretty sure this use case is supported within the realm of Twilio TaskRouter, but I was hoping others have definitive documentation to support how to perform that scenario.
Twilio developer evangelist here.
You're right, the documentation does show an outbound call being made from client to client, however calls to an external phone are certainly possible.
I believe you are referring to this "call" JSON response from the docs:
{
"instruction": "call",
"to": "client:jenny",
"from": "+15558675309",
"url": "http://example.com/agent_answer",
"status_callback_url":
"http://example.com/agent_answer_status_callback"
}
All you would need to do to change that to call a number is replace "client:jenny" with the number you wish to call.
{
"instruction": "call",
"to": "+15551234567",
"from": "+15558675309",
"url": "http://example.com/agent_answer",
"status_callback_url":
"http://example.com/agent_answer_status_callback"
}
Let me know if that helps.

Resources