16

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.

  1. https://media.twiliocdn.com/sdk/js/sync/releases/0.5.10/twilio-sync.js
  2. https://media.twiliocdn.com/sdk/js/client/releases/1.4.31/twilio.min.js
  3. https://media.twiliocdn.com/taskrouter/js/v1.13/taskrouter.min.js
  4. https://media.twiliocdn.com/taskrouter/js/v1.0/taskrouter.worker.min.js
Samuel Dion-Girardeau
  • 2,790
  • 1
  • 29
  • 37
SamDev
  • 185
  • 2
  • 11
  • The code you've shared is exactly as it appears in your application? – thanksd May 23 '18 at 16:58
  • @thanksd yes, this event trigger at the time taskrouter create reservation but reservation.task.attributes, ... values are not found & reservation.sid providing task.sid value!!!. – SamDev May 24 '18 at 06:38
  • This is very unusual that how a cloud messaging provider don't support it's won technical documentation & also I'm going to create the technical support ticket - Twilio. – SamDev May 24 '18 at 06:45
  • Can you share the link for your support ticket? – thanksd May 29 '18 at 13:23
  • @thanksd According to Twilio ticket response "As per discussion with engineering, the issue is that you are including https://media.twiliocdn.com/taskrouter/js/v1.0/taskrouter.worker.min.js in your application. If you remove that, everything is expected to work as documented. It looks to be an old version of the SDK, and it initially returned a task object instead of a reservation for the method mentioned. Because both the old and the current are included, the old is overwriting some of the functions used by the current SDK." – SamDev May 30 '18 at 07:06
  • v1.0/taskrouter.worker.min.js Javascript SDK providing worker events to the registered on Worker object https://media.twiliocdn.com/taskrouter/js/v1.0/taskrouter.worker.min.js – SamDev May 30 '18 at 07:09
  • If I remove '.. v1.0/taskrouter.worker.min.js ' these above worker https://www.twilio.com/docs/taskrouter/js-sdk/worker#worker-events event functionality stopped working. @thanksd Ticket stile on progress, They have some issue with latest v1.13 SDK & Twilio ticket response on own mistake is very very slow. – SamDev May 30 '18 at 07:13
  • What do you mean when you say the "event functionality stopped working"? The callback wasn't firing? – thanksd Jun 01 '18 at 13:18
  • @thanksd Yes, After remove '.. v1.0/taskrouter.worker.min.js ' ,worker stop receiving event callback in existence implementation. "worker.on("activity.update", function (worker) { ...// }" Callback stopped firing. – SamDev Jun 03 '18 at 18:29
  • Have you managed to solve this yet? If not, I'd love to try to help get you over the line. I'm a developer evangelist at Twilio. – philnash Jun 29 '18 at 05:19
  • yes, thanks @philnash – SamDev Jul 06 '18 at 08:55
  • Cool! Thanks for letting me know and glad you could move on with your app! – philnash Jul 06 '18 at 08:56
  • @SamDev please post how you managed to solve this. –  Jul 29 '18 at 10:53
  • Sure @joshuamabina – SamDev Aug 15 '18 at 10:09
  • @philnash , As you know Issues never stop Development. In this situation, we just need use our brain little more 0.%, Otherwise It's kills your times :) – SamDev Aug 15 '18 at 11:00

1 Answers1

1

There was two different issue but It related to each other.

First I remove

  1. 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

  1. /v1.13/taskrouter.min.js for example worker.activityName

  2. /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.

SamDev
  • 185
  • 2
  • 11