@tiledesk/tiledesk-voice-twilio-connector 0.1.14-rc3 → 0.1.14-rc5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +18 -7
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -262,7 +262,7 @@ router.post('/nextblock/:callSid/', async(req, res) => {
262
262
 
263
263
  let message = {}, queue = []
264
264
  queue = await tdChannel.getMessagesFromQueue(conversation_id)
265
- winston.verbose('/NEXT controllo coda--> '+ queue.length + ' ' + usertext)
265
+ winston.verbose('/NEXT controllo coda--> '+ queue.length + ' for text:' + usertext)
266
266
  if(queue.length === 0 && (usertext === '' || !usertext)){
267
267
  winston.debug('QUEUE is empty--> ',queue)
268
268
 
@@ -324,9 +324,10 @@ router.post('/nextblock/:callSid/', async(req, res) => {
324
324
 
325
325
  router.post('/speechresult/:callSid', async (req, res) => {
326
326
 
327
- let startTime = new Date();
327
+ let start_call = new Date();
328
328
  winston.verbose("(vxml) called POST /speechresult ", req.body);
329
329
  winston.verbose("(vxml) called POST /speechresult query ", req.query);
330
+ console.log('/speechresult at: ', new Date(), 'with text:', req.body.SpeechResult)
330
331
 
331
332
  let usertext = req.body.SpeechResult;
332
333
  let confidence = req.body.Confidence
@@ -373,8 +374,11 @@ router.post('/speechresult/:callSid', async (req, res) => {
373
374
  type: 'text',
374
375
  channel: { name: CHANNEL_NAME }
375
376
  };
377
+ let startSend= new Date().getTime()
376
378
  let tdMessage = await tdChannel.send(tiledeskMessage, user.token, conversation_id);
377
379
  winston.debug("message sent : ", tdMessage);
380
+ let endSend = new Date().getTime();
381
+ console.log('Time to send messagge ( ', usertext, '): ', endSend - startSend, '[ms] at time', new Date())
378
382
  //generate Tiledesk wait message
379
383
  let delayTime = await voiceChannel.getNextDelayTimeForCallId(callSid)
380
384
  message = await tdChannel.generateWaitTdMessage(from, 50)
@@ -393,14 +397,13 @@ router.post('/speechresult/:callSid', async (req, res) => {
393
397
  let messageToVXML = await tdTranslator.toVXML(message, callSid, vxmlAttributes)
394
398
  winston.debug("(voice) VXML to SEND: "+ messageToVXML);
395
399
 
396
- let endTime = new Date()
397
- let diffTIme = endTime - startTime
398
- winston.verbose("(voice) send response to TWILIO in : " + diffTIme + "ms");
399
400
 
400
401
  // Render the response as XML in reply to the webhook request
401
402
  res.set('Content-Type', 'text/xml');
402
403
  res.status(200).send(messageToVXML);
403
-
404
+
405
+ let end_call = new Date()
406
+ console.log('Time to responde to /speechresult/:callSid : ', end_call-start_call, '[ms]')
404
407
 
405
408
  })
406
409
 
@@ -408,7 +411,9 @@ router.post('/speechresult/:callSid', async (req, res) => {
408
411
  router.post('/menublock/:callSid', async (req, res) => {
409
412
  winston.verbose("(voice) called POST /menu", req.body);
410
413
  winston.verbose("(voice) called POST /menu query" , req.query);
411
-
414
+ let start_call = new Date().getTime();
415
+ console.log('/menublock at: ', new Date(), 'with text:', req.body.Digits)
416
+
412
417
  let message_text = '';
413
418
  let attributes = {};
414
419
  let button = {}
@@ -483,6 +488,7 @@ router.post('/menublock/:callSid', async (req, res) => {
483
488
  BASE_URL: BASE_URL
484
489
  });
485
490
 
491
+ let startSend = new Date().getTime();
486
492
  //send message to tiledesk
487
493
  let tiledeskMessage= {
488
494
  text:message_text,
@@ -492,6 +498,8 @@ router.post('/menublock/:callSid', async (req, res) => {
492
498
  attributes: attributes
493
499
  };
494
500
  let tdMessage = await tdChannel.send(tiledeskMessage, user.token, conversation_id);
501
+ let endSend = new Date().getTime();
502
+ console.log('(menu) Time to send messagge ( ', message_text, '): ', endSend - startSend, '[ms] at time', new Date())
495
503
 
496
504
  //generate Tiledesk wait message
497
505
  let delayTime = await voiceChannel.getNextDelayTimeForCallId(callSid)
@@ -505,6 +513,9 @@ router.post('/menublock/:callSid', async (req, res) => {
505
513
 
506
514
  res.set('Content-Type', 'text/xml');
507
515
  res.status(200).send(messageToVXML);
516
+
517
+ let end_call = new Date().getTime();
518
+ console.log('Time to responde to /menublock/<call_id>/ : ', end_call-start_call, '[ms]')
508
519
 
509
520
  });
510
521
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-voice-twilio-connector",
3
- "version": "0.1.14-rc3",
3
+ "version": "0.1.14-rc5",
4
4
  "description": "Tiledesk VOICE Twilio connector",
5
5
  "license": "MIT",
6
6
  "author": "Gabriele Panico",