I am attempting to move the Taskrouter task from "wrapping" to "completed" programmatically when the agent is done with their post-call duties. Other method calls to worker or reservation work, but when trying to call either worker.completeTask or reservation.task.completed, I receive a CORS policy error "No 'Access-Control-Allow-Origin" header present. Since taskrouter.js is an external Twilio script and I can't change it, is there any way to get this to work?
After spending hours scouring the Twilio docs earlier today, I finally posted this question in frustration. Then, literally, 30 minutes after posting it, I was working on something else and came across the solution.
When generating my capability token, I was doing it as their tutorial suggested:
$workerCapability = new Twilio\Jwt\TaskRouter\WorkerCapability(
$accountSid, $authToken, $workspaceSid, $workerSid);
$workerCapability->allowActivityUpdates();
$workerToken = $workerCapability->generateToken();
The stumble led me to an additional capability, so the updated code is:
$workerCapability = new Twilio\Jwt\TaskRouter\WorkerCapability(
$accountSid, $authToken, $workspaceSid, $workerSid);
$workerCapability->allowActivityUpdates();
$workerCapability->allowReservationUpdates();
$workerToken = $workerCapability->generateToken();