Handling 3 call queues in twilio in an elegant way - twilio

I'd love some advice on my twilio setup for a problem I'm trying to solve.
Overview
A client can call our twilio number and have one of three cases to handle:
- is our client and has a question - should be transfered to CC queue (2ppl),
- wants to buy our services - should be transfered to Sales queue (7ppl),
- has some other case - should be transfered to a different queue, lets call it Other (1 person)
Current solution
The client calls:
welcome message
we gather his digit input
enqueue a call to the appropiate queue
assign a task to an available worker with the conference instruction
Problem with the current solution
If there are no workers in the office to handle the call the client will wait forever until he hangs-up by himself. The wroker who answers doesn't know the clients phone number so he isn't able to fallow-up if neccesary.
Questions
After the client picks a queue i would like to check if I have any workers in the office in that queque (not in Offline mode). If everybody is on offline mode redirect to voicemail and a an email is sent to a specified email address with the caller phone number and voicemail recording url.
After the worker picks-up (accepts the reservation) send him a message with the clients phone number.
If no worker answers within a specified amount of time (for example 5 minutes) the call gets redirected to voicemail and a an email is sent to a specified email address with the caller phone number and voicemail recording url.

Twilio developer evangelist here.
Answers in order, parts 1 and 3 need to talk about voicemail which I'll cover at the bottom:
You can use a skip_if expression to skip a queue if there are no available workers.
I assume this is using the reservation.conference instruction in the JavaScript SDK. You can actually inspect the reservation object at this stage too, check out reservation.task.attributes for all the task attributes, which should include the call attributes. You can use this to show your agent on screen or send them a message some other way.
For this, you should set a timeout on your queue. When the timeout fires the task should drop through to the next queue in the workflow.
Voicemail
For parts 1 and 3 we are ejecting a task from one queue, but it needs to go somewhere else to be dealt with. You want to send the calls to voicemail, which doesn't require an agent to deal with it. Currently, the best way to deal with this is direct the task to a queue that has one bot worker in it. The job of the worker is to redirect incoming reservations straight to some TwiML. You achieve this by instantly responding to an assignment callback with the redirect instruction.
To create voicemail, you can combine <Say> and <Record>. Make sure you set the recordingStatusCallback attribute to a URL in your application, you can then use the results to email the link to the voicemail recording.
Let me know if this helps at all.

thank you for yout time to answer my questions. Below please find my reply:
1. It seems that this does not work in console - I find this information in the documentation "skip_if cannot be configured through the console - it must be posted on the workflow API". As I am not using the workflow API this is probably not a solution for me.
2. I using this tutorial: https://www.twilio.com/docs/quickstart/php/taskrouter/twiml-dequeue-call but instead of using dequeue instruction i use conference. I don't quit get how to "inspect the reservation" - maybe you have a tutorial on that? While looking for other solutions I came up with workspace event calback, but I am not sure if this would work.
3) How can I do that in the console?

Related

Twilio Cold Transfer, no queue overflow

Requirement
Our business requires us to expand the functionality of the transfer feature that is already built in to
Twilio Flex.
What exists today
Today's functionality (out of the box) is partially what we need with the Actions.TransferTask functions. The issue with this is that when we choose an agent to cold transfer to, and they're not available, the call gets put back in to a queue and picked up by the next available agent. This seems completely counter intuitive to how I would expect it to work as I would expect that call to go to voicemail if the agent is unable to pick up.
What we tried
We have logged a support ticket with Twilio to no avail. Any attempts to use the StartConferenceCall won't work because we're on an active call. Twilio functions' Dial doesn't seem to work as I don't seem to have access to my current call. (Dial is meant for calls that are about to happen?) But Dial seems to be the only process that allows digits to be passed. Therefore, conferences & participants don't seem to be the answer either.
What we do have though is a phone number that will end up in our primary work flow and if the incoming number is the aforementioned number, we skip the voice prompts, accept digits and redirect to the agent. This part works.
What we need
We're looking for a Twilio function or plugin Action (or some other method that I'm unaware of) that can cold transfer a call to another agent with no over flow to a queue (let it get picked up by voicemail).

How to connect 2 anonymous inbound callers with Twilio

I have read a couple similar posts here on SO, however the responses do not explaiin how, they only explain that it is possible with Twilio. If a Twilio Evangelist could give me some specific direction on this it would be greatly appreciated.
The idea is (Caller A) calls (Twilio Number). Twilio stores Caller A's number until a second caller is achieved.
Once (Caller B) calls the same (Twilio Number) he is connected to Caller A.
This is at random, and handling many requests at the same time. Once Caller A and Caller B are connected, their numbers are removed from the storage so nobody else will be connected with them.
Rinse repeat.
Twilio developer evangelist here.
You can do this using Enqueue and <Queue>. First you need to create your queue using the REST API. This can be done ahead of time.
I'm going to use Ruby for the example here, however you can see what this looks like in other languages in our documentation.
require "twilio-ruby"
client = Twilio::REST::Client.new(ENV["TWILIO_ACCOUNT_SID"], ENV["TWILIO_AUTH_TOKEN"])
queue = client.queues.create(:friendly_name => "call_roulette")
puts queue.sid
You'll need to save the Queue Sid and friendly name, you'll use them to connect to the queue later.
Then, when a person calls you need to check whether there is anyone in the queue waiting. If there is then you connect the two callers, if there isn't then you place that caller into the queue and wait for another call.
When the call is made, Twilio will send an HTTP request to the URL you supply in the Twilio console. You need to respond with the correct
based on the conditions above.
This example uses Sinatra as the web framework.
require "twilio-ruby"
require "sinatra"
client = Twilio::REST::Client.new(ENV["TWILIO_ACCOUNT_SID"], ENV["TWILIO_AUTH_TOKEN"])
post "/call" do
queue = client.queues.get(QUEUE_SID)
if queue.current_size == 0
twiml = "<Response><Enqueue>#{QUEUE_FRIENDLY_NAME}</Enqueue></Response>"
else
twiml = "<Response><Dial><Queue>#{QUEUE_FRIENDLY_NAME}</Queue></Dial></Response>"
end
return twiml
end
When the queue is empty, we use Enqueue to put the caller in the queue, when the queue has someone in it, we use Dial and Queue to dial the person in the Queue.
Let me know if that helps at all.

With Twilio, can you get a notification when a queue add/removes a member?

I'm trying to do some server side queue management with a an application I am writing, using Twilio (C# MVC project). Is there any way to receive a notification of some sort when a caller is added to or removed from a queue without constantly having to check the queue myself?
Twilio evangelist here.
I'd suggest looking into using the waitUrl and action parameters on the [<Enqueue>][1] verb.
The url provided in the waitUrl param is requested when the user enters the queue. The url in the action parameter is requested when the caller leaves the queue.
I wrote a blog post a while ago that shows how to create a dashboard un ASP.NET MVC that displays current queue size and average time in queue using those two parameters. It should be pretty straight forward to adapt the post to whatever language and framework your working with.
Hope that helps.

Notify agent when any caller entered in twilio queue

I am using Twlio Client for my application.
I want to notify agent when any caller comes in Queue.
Right now I am calling Rest API Method for Dequeue first member of the queue on every 5 second.
but It is having some performance issues.
Is there any way to notify agent when caller enters in queue?
Twilio evangelist here.
I think a lot of this depends on the specific experience you want to give your agents.
The simplest solution could be to leverage the part of your application that generates the TwiML containing the <Enqueue> verb (putting the caller into the queue). As part of that generation process you could add some code that uses a technology like socket.io or signalr to sent a real-time notification to the browser client telling the agent that a new caller has just been enqueued.
Hope that helps.

Twilio Queue management issue / best practice

We are setting up a call center using Twilio.
At the end of the greetings and menus, our users are redirected to a queue waiting for the next available agent.
We would like the system to:
- Call automatically the next available agent. This is to prevent the agent from dialing the queue to know if users are waiting.
- Be able to change the order of the queue. Our users have different priorities.
How can we get this done? What are the best practices?
FYI: We are using PHP, TWIML and we DO NOT have our own IPBX (Not able to use SIP Protocol).
Thanks,
Dimitri
Twilio evangelist here.
There are a few ways you could do this, but my suggestion would be to use the action attribute of the Enqueue verb.
The action attribute lets you tell Twilio about a URL that you want it to request when a caller leaves the Queue. As part of this request, Twilio will pass you a parameter named QueueSid. Using the QueueSid, you can make a request to Queues endpoint in the Twilio API, see if the current_size of the Queue is greater than zero, and if it is initiate a call out to the next available agent.
Hope that helps.

Resources