@tiledesk/tiledesk-voice-twilio-connector 0.1.26-rc6 → 0.1.26-rc8
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 +6 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -227,7 +227,7 @@ router.post('/webhook/:id_project', async (req, res) => {
|
|
|
227
227
|
|
|
228
228
|
//await for a response message from tiledesk queue
|
|
229
229
|
let start_time_get_message = new Date()
|
|
230
|
-
let message = await getMessage(
|
|
230
|
+
let message = await getMessage(callSid, from, project_id, conversation_id)
|
|
231
231
|
let end_time_get_message = new Date()
|
|
232
232
|
winston.verbose('Time to getMessage from queue in /:project_id/start : ' + end_time_get_message-start_time_get_message + '[ms] --- at time:' + new Date())
|
|
233
233
|
|
|
@@ -442,7 +442,7 @@ router.post('/nextblock/:callSid/', async(req, res) => {
|
|
|
442
442
|
|
|
443
443
|
})
|
|
444
444
|
|
|
445
|
-
async function getMessage(
|
|
445
|
+
async function getMessage(callSid, ani, project_id, conversation_id){
|
|
446
446
|
const startTime = Date.now();
|
|
447
447
|
|
|
448
448
|
const tdChannel = new TiledeskChannel({
|
|
@@ -476,7 +476,7 @@ async function getMessage(callId, ani, project_id, conversation_id){
|
|
|
476
476
|
|
|
477
477
|
// remove message from queue and reset delayIndex
|
|
478
478
|
await tdChannel.removeMessageFromQueue(conversation_id, message._id)
|
|
479
|
-
await voiceChannel.clearDelayTimeForCallId(
|
|
479
|
+
await voiceChannel.clearDelayTimeForCallId(callSid)
|
|
480
480
|
|
|
481
481
|
return message;
|
|
482
482
|
}
|
|
@@ -497,7 +497,7 @@ async function getMessage(callId, ani, project_id, conversation_id){
|
|
|
497
497
|
|
|
498
498
|
// remove message from queue and reset delayIndex
|
|
499
499
|
await tdChannel.removeMessageFromQueue(conversation_id, message._id)
|
|
500
|
-
await voiceChannel.clearDelayTimeForCallId(
|
|
500
|
+
await voiceChannel.clearDelayTimeForCallId(callSid)
|
|
501
501
|
|
|
502
502
|
return message;
|
|
503
503
|
})();
|
|
@@ -507,10 +507,10 @@ async function getMessage(callId, ani, project_id, conversation_id){
|
|
|
507
507
|
winston.debug("[getMessage] Subscription timeout, generating waitTdMessage...");
|
|
508
508
|
|
|
509
509
|
//CASE: queue is empty --> generate Tiledesk wait message and manage delayTime
|
|
510
|
-
const delayTime = await voiceChannel.getNextDelayTimeForCallId(
|
|
510
|
+
const delayTime = await voiceChannel.getNextDelayTimeForCallId(callSid);
|
|
511
511
|
const waitMessage = await tdChannel.generateWaitTdMessage(ani, delayTime);
|
|
512
512
|
//update delayIndex for wait command message time
|
|
513
|
-
await voiceChannel.saveDelayIndexForCallId(
|
|
513
|
+
await voiceChannel.saveDelayIndexForCallId(callSid);
|
|
514
514
|
|
|
515
515
|
resolve(waitMessage);
|
|
516
516
|
}, MAX_POLLING_TIME * 1000); // MAX_POLLING_TIME is in seconds
|