3

We are using Twilio Task Router with Multitasking disabled Workspace and only default Task Channel set as Available for all Workers. After the Task Reservation is Accepted the Worker activity goes from Reserved to Busy, as expected. But finally when the Task status is updated to 'Completed', the Worker activity is not getting changed to Idle as expected, but instead it stays in Busy activity. Is this a bug or the expected behavior? Or are we missing any configuration?

Nick
  • 222
  • 1
  • 2
  • 10

1 Answers1

2

Twilio engineer on the TaskRouter team here! Yes, this is expected behavior for single-tasking.

What you'll find is that when the Reservation is assigned, the Worker it's assigned to will move to the the "Busy" Activity for that TaskQueue (or whatever Activity is specified for assignment, which can be change via the API here, or you can set it via the Console here), as you've described.

When a Task completes, however, there is no guarantee in a single-tasking environment that the Worker is actually ready to take work again at that moment—they may be, but that depends on your workflow. So we need confirmation before assigning Tasks to them again. This is why the Worker's Activity needs to be manually set back to "Idle" before they will start receiving Tasks again.

One of the easiest ways to do this, if this is the workflow you want, is to listen for the task.completed event, either at your EventCallbackUrl or via the JS SDK, and issue an Activity update to "Idle" for the associated Worker at that time.

Hope this answers your question!

alexdlaird
  • 1,174
  • 12
  • 34
  • Thanks for your clarification. This requirement is very much realistic and Worker state transitions should be implicit behavior of a Task Routing solution rather than manual, I believe. At least it should be made configurable for the Workflow (say Task Competion Activity). Probably an enhancement.. – Nick Oct 29 '18 at 05:59
  • I have updated the documentation regarding Task Queues to clarify that this is not the default behavior for single-tasking and hopefully at shed at least some light on why that is the case. – alexdlaird Oct 29 '18 at 15:01
  • The link for listening to the `task.completed` event provided by @alexdlaird is actually a method to complete a task rather than listening to an event. So I want to know where can I find the events related to Tasks such as `task.completed` or `task.canceled` in the JS SDK? – Vishal Chugh Aug 04 '20 at 11:02