I am using Twilio Studio to configure an IVR system and was successfully able to do that. Now I am trying to create a queue with few agents so that the calls are not missed. I was able to create a Task Router and create a queue under that, as follows.
I have added two agents to the queue as follows
Now when I make a call, I can hear the music, but the calls are not coming through to the phone. Not sure what I have to do now
Twilio developer evangelist here.
The task workflow goes something a little like this:
Call comes into queue -> Task created -> Task is pending -> Workflow finds Worker -> Reservation created -> Reservation accepted -> Call is routed to worker
From what I can tell, you've done everything but accept the reservation for your worker.
To do that you need to set the Assignment Callback URL for your Workflow. Then, when the reservation is created for a worker Twilio will send a webhook (HTTP request) to that URL. Your application can then accept the reservation and dequeue it immediately, or do a bunch of other things. I recommend you read through the documentation on Task Lifecycle: workflows and assignment for an overview followed by how to Handle Assignment Callbacks for how to put that into action and produce your assignment callback handler.
The simplest thing you can respond with is the dequeue instruction which will connect the call to your worker's contact_uri. That would look like this:
{ "instruction": "dequeue" }
Let me know if this helps at all.
Related
Has anyone completed or found a guide on routing/ accepting a task router reservation?
Example flow:
Call # > picked up by Twilio Studio and enqueued to TaskRouter Workspace with attributes > task router workflow associates to a taskrouter queue and finds available agent > [i need to connect this call to the workers attribute which is their sip:phonenumber
I'm trying to avoid an aws server and lambda while keeping this entire orchestration native to twilio via function.
Twilio developer evangelist here.
The docs on dealing with the TaskRouter reservation callback are here. When you receive the callback you need to respond with JSON describing the action you want to do.
The simplest instruction to connect the call from task to the worker that receives the reservation is to use the dequeue instruction. In a Twilio Function that would look like this:
exports.handler = function (context, event, callback) {
callback(null, {
instruction: "dequeue"
});
}
To make this connect, your worker needs a contact_uri attribute that points to their address, in this case their SIP phone number. Alternatively, you can add a to attribute to the dequeue instruction with the address.
I am creating Autopilot which greets the user when a Twilio number is called.
Then Autopilot will ask the user if he wants to connect with the agent according to the answer of the user. If user say yes then Autopilot will transfer the call to task router. By seeing Twilio example i Have reached to handoff the call to task router.
The problem is that I cannot specify Matching Task. In a Taskrouter workflow, I have 2 to 3 filter I want to pass matching task so that A particular filter is run of the workflow
Currently, I am using the below command For handoff.
"handoff": {
"channel": "voice",
"uri": "taskrouter://workflowid",
}
Here I need to able to pass matching task (An addition parameter) something like selected_agent === 'lorem' which will tell the workflow which Particular task(Filter) to run
From the documentation (the Dialogue Payload is a task attribute):
When handing off an Autopilot voice session to Task Router or Flex,
you need to provide the destination the Task Router workflow Sid. When
the Hand-off is executed the Autopilot session is terminated, the call
is enqueued with the Dialogue Payload as a task attribute.
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?
Currently using Twilio TaskRouter to build a telephony call center to route the calls.
My target was:
When a task kept pending for a certain time(i.e: no workers are available for reservation), redirect it to voicemail
When a task is reserved but the the worker didn't response to it, redirect it to voicemail
My Current Implementation was:
Specify both task timeout and reservation timeout
When task timeout / reservation timeout callback is triggered, query the Redirect Instruction reservation api to redirect it to a TwiML of recording voicemail.
But the problem was:
When a task is in pending status, no reservation was created so that I could not access the reservation to perform a redirect
When a reservation is timed out, trying to perform a redirect would receive an execption from Twilio saying that the reservation was nolonger available for redirecting
Twilio developer evangelist here.
There's two issues here, as you've said at the end. You're either trying to move a reservation that doesn't exist or redirecting a reservation that isn't available to redirect.
I think you can achieve your goals by using the workflow instead.
First up, consider the task side of things. You give a task a timeout. When it does timeout the normal behaviour for a task is to move to the next queue that it matches in the workflow.
I'd suggest setting up a final queue that has one permanently available worker object (but not real person) in it. When you get an assignment callback for a reservation for a task in that queue then you can use the redirect assignment to send the call to some TwiML that returns a <Record> to take a message. Your TwiML application can also call the REST API to accept the reservation.
That works for tasks that are never assigned from the initial queue to a worker. For the reservation timeout side of things, consider this.
When a reservation times out, the task goes back into its original queue for assignment again. The task remains under the same original timeout that we defined for it above, so will eventually move to our voicemail queue when the task itself times out. This has the same effect for the caller, as they never know when a reservation is assigned as they'll just be experiencing the wait music in the queue they are in.
Does that make sense at all?
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.