According to Twilio Docs I'm trying develop a Call-center Application But The TaskRouter JS
v1.13/taskrouter.min.js Not supporting as twilio explain in document https://www.twilio.com/docs/taskrouter/js-sdk/worker#reservation-created
worker.on("reservation.created", function(reservation) {
console.log(reservation.task.attributes) // NOT FOUND
console.log(reservation.task.priority) // NOT FOUND
console.log(reservation.task.age) // NOT FOUND
console.log(reservation.task.sid) // NOT FOUND
console.log(reservation.sid) // RETURNS task sid
});
reservation.sid print task sid & If I remove .task It returns respective output related to task But here I expect reservation related output.
Below are twilio client SDK are currently used in my application.
There was two different issue but It related to each other.
First I remove
- https://media.twiliocdn.com/taskrouter/js/v1.0/taskrouter.worker.min.js
It fixed
worker.on("reservation.created", function(reservation) { console.log(reservation.task.attributes) // FOUND console.log(reservation.task.priority) // FOUND console.log(reservation.task.age) // FOUND console.log(reservation.task.sid) // FOUND console.log(reservation.sid) // RETURNS reservation sid });
BUT After I remove taskrouter.worker.min.js , I faced another issue (i.e worker event stopped working)
worker.on("ready", function(worker) { });
Because both version use different key to get event value
/v1.13/taskrouter.min.js for example worker.activityName
/v1.0/taskrouter.worker.min.js for example worker.activity_name
Secondly , I need to update all key according to /v1.13/taskrouter.min.js in my client side Js
For example, Replace worker.activity_name with updated key worker.activityName according to v1.13
This resolve all of my issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With