Objective: Manually route tasks (calls) in some specific queue WQ_i within some timeout
How: Update a task in Task Router by setting worker sid to known_worker_sid
After going through the documentation of Twilio Task Router, I came to know that:
- A task can be updated after the creation
- If we set
known_worker_sidin a task, Task Router will route to that specific worker
So, to achieve the objective, I want to use task update, Known Worker Routing and customize the Workflow definition. Let's have the following workflow:
{
"task_routing":{
"filters":[
{
"expression": "type == 'WQ_i'",
"targets":[
{
"queue": "SID_of_WQ_i",
"timeout": "300",
"expression": "0==1" ===> Some always false expression
},
{
"queue": "SID_of_WQ_i",
"timeout": "60"
}
]
}
],
"default_filter":{
"queue": "<default task queue sid>"
}
}
}
As per my understanding, this workflow will allow me to manually route (by updating the task and setting known_worker_sid) every task in queue WQ_i within 300 seconds. However, if I cannot update the task within 300 seconds, it will fall to the next target having the same queue but Task Router can create reservation for any available worker.
Questions:
- What does the Task Router do with the task if a worker with sid set to
known_worker_sidis unavailable (busy or not logged-in)? - Will the
"expression": "0==1"(or some other expression which always evaluates to false) stop Task Router from creating reservations on that target till timeout?
Review the Lifecycle of a Task document. If a known_worker_sid is unavailable, it will go to the next available worker. This is described in the known agent routing document.
If you do not have workers available, you can have Taskrouter keep them on hold or send the caller to a voicemail and use the voicemail process to create a task. This Queued Callback and Voicemail document outlines the process which will work with or without Flex.