Twilio Queue management issue / best practice - twilio

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.

Related

Twilio Flex. Start a stream once an agent has accepted a task

so, the flow is, I call enqueue Twiml verb. It creates a task and assigning to a specific agent. I have a task router callback on reservation.accepted event. I got it, but once I update a customer call with Stream Twiml - it's removing a customer from the conference which Flex creates. I'd like to avoid it somehow. To avoid that I update a customer participant with end_conference_on_exit: false attribute. Then I update a customer call with Stream and Dial.conference to get a customer back to a conference which I do not like. Is there any easier way to implement it ?
Twilio developer evangelist here.
Updating a call like that will always take it out of it's current TwiML flow and you would have to redirect back to where it was, like you have already implemented.
I know this is not starting the stream after the task is accepted, but I think the best way to implement this right now is to use the fork stream Studio widget directly before the send to Flex widget in the Studio Voice IVR flow.

Handling 3 call queues in twilio in an elegant way

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?

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.

Resources