@tiledesk/tiledesk-voice-twilio-connector 0.1.14-rc4 → 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.
- package/index.js +9 -6
- 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
|
|
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
|
|