Twilio worker activity not changing from Busy to Idle after task is closed

Viewed 491

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?

1 Answers

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!

Related