Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to not offer a task to specific worker on Twilio

Tags:

twilio

I am new in Twilio and i have been facing an issue while designing outbound dialer currently preview dialing. If a worker rejects a task than the same task should not be offered to that worker again. How do i handle this case?

like image 542
Faisal Avatar asked Jul 13 '16 16:07

Faisal


1 Answers

Typically if a worker rejects the task, the worker should be moved to an unavailable activity. Otherwise, if the worker is the only available and qualified worker, TaskRouter will continue to create new reservations.

You can specify a new activitySid upon rejection, so that the worker is moved to an unavailable activity at the same time:

https://www.twilio.com/docs/api/taskrouter/worker-js#reservation-reject

Here, making the worker activity unavailable would simply mean the worker will not be able to get any task.

But let's look at a more complicated use case where a Worker can accept, reject or cancel tasks. They need to be available to make this choice.

If you have only that agent, and they are available, then there is no way to prevent that agent from receiving the Task, unless you manipulate the Task attributes or worker attributes so that TaskRouter doesn’t assign the Task. For example, you could update TaskAttributes to have a rejected worker SID list, and then in the workflow say that worker.sid NOT IN task.rejectedWorkerSids.

And the ability to do this Target Workers Expression just shipped as a bug fix today! It should look like:

worker.sid NOT IN task.rejectedWorkers
like image 57
Megan Speir Avatar answered Oct 13 '22 01:10

Megan Speir