I'm using twiliotaskrouter13.min.js to initiate a worker using
this.workerClient = new Twilio.TaskRouter.Worker(
token,
this.twilioConfig.debugging,
this.twilioConfig.workerActivities.offline,
this.twilioConfig.workerActivities.offline,
true
);
The expected behaviour is that when the websocket gets dropped, the agent is automatically moved to "Offline" state
Adding Connecting and Disconnecting Activities, and closing Existing >Sessions
var worker = new Twilio.TaskRouter.Worker(WORKER_TOKEN, false, "WAxxx", "WAyyy", true);
https://www.twilio.com/docs/taskrouter/js-sdk/worker#taskrouterworker
However, it seems that this is not the current behaviour, I tested with several workers and it looks like the worker remains in the current state after the websocket gets disconnected.
Does anybody know if we're missing something? Maybe a different config or a timeout somewhere?
I ran into the same problem a while back, sent a message to support, and got this answer:
The documentation lacks some details on how the
disconnecActivitySid
works. I ended up adding aunload
event listener to the page and also modified the webhook to update the worker's activity to Away when the worker misses 10 reservations in a row.The task assignment callback can return an instruction to reject the task and an unavailable activity so that the worker stops receiving new tasks. For instance,
{ instruction: 'reject', activity_sid: '<away_activity_sid' }
.