@tiledesk/tiledesk-voice-twilio-connector 0.1.14-rc5 → 0.1.14-rc7
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 +37 -2
- package/package.json +1 -1
- package/tiledesk/TiledeskTwilioTranslator.js +3 -3
package/index.js
CHANGED
|
@@ -381,14 +381,14 @@ router.post('/speechresult/:callSid', async (req, res) => {
|
|
|
381
381
|
console.log('Time to send messagge ( ', usertext, '): ', endSend - startSend, '[ms] at time', new Date())
|
|
382
382
|
//generate Tiledesk wait message
|
|
383
383
|
let delayTime = await voiceChannel.getNextDelayTimeForCallId(callSid)
|
|
384
|
-
message = await tdChannel.generateWaitTdMessage(from,
|
|
384
|
+
message = await tdChannel.generateWaitTdMessage(from, delayTime)
|
|
385
385
|
//update delayIndex for wait command message time
|
|
386
386
|
await voiceChannel.saveDelayIndexForCallId(callSid)
|
|
387
387
|
|
|
388
388
|
}else {
|
|
389
389
|
|
|
390
390
|
let delayTime = await voiceChannel.getNextDelayTimeForCallId(callSid)
|
|
391
|
-
message = await tdChannel.generateWaitTdMessage(from,
|
|
391
|
+
message = await tdChannel.generateWaitTdMessage(from, delayTime)
|
|
392
392
|
//update delayIndex for wait command message time
|
|
393
393
|
await voiceChannel.saveDelayIndexForCallId(from)
|
|
394
394
|
}
|
|
@@ -764,6 +764,41 @@ router.post('/twilio/status',async (req, res) => {
|
|
|
764
764
|
|
|
765
765
|
})
|
|
766
766
|
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
router.post('/testbase/:id_project',async (req, res) => {
|
|
770
|
+
let start_call = new Date().getTime();
|
|
771
|
+
console.log('/testbase at: ', new Date())
|
|
772
|
+
|
|
773
|
+
|
|
774
|
+
let twiml = '<Response>' +
|
|
775
|
+
'<Gather input="speech" action="https://tiledesk-voice-twilio-connector.glitch.me/speechresult2/CAc6aec6904b5b9c7341d0b95a687c5dd9" method="POST" language="it-IT" speechTimeout="1" >' +
|
|
776
|
+
'<Say voice="Polly.Bianca" language="it-IT">Dimmi qualcosa</Say>' +
|
|
777
|
+
'</Gather>' +
|
|
778
|
+
'</Response>'
|
|
779
|
+
|
|
780
|
+
res.set('Content-Type', 'text/xml');
|
|
781
|
+
res.status(200).send(twiml);
|
|
782
|
+
|
|
783
|
+
let end_call = new Date().getTime();
|
|
784
|
+
console.log('Time to responde to /testbase/<id_project>/ : ', end_call-start_call, '[ms] at time', new Date())
|
|
785
|
+
|
|
786
|
+
});
|
|
787
|
+
|
|
788
|
+
router.post('/speechresult2/:callSid',async (req, res) => {
|
|
789
|
+
winston.verbose('+++++++++++(voice) called POST /speechresult2/ ', req.body)
|
|
790
|
+
let start_call = new Date();
|
|
791
|
+
console.log('/speechresult2 at: ', new Date(), 'with text:', req.body.SpeechResult)
|
|
792
|
+
|
|
793
|
+
let twiml = '<Response>' +
|
|
794
|
+
'<Say voice="Polly.Bianca" language="it-IT">Ciao</Say>' +
|
|
795
|
+
'</Response>'
|
|
796
|
+
|
|
797
|
+
res.set('Content-Type', 'text/xml');
|
|
798
|
+
res.status(200).send(twiml);
|
|
799
|
+
|
|
800
|
+
});
|
|
801
|
+
|
|
767
802
|
router.post('/twilio/fail',async (req, res) => {
|
|
768
803
|
winston.verbose('+++++++++++(voice) called POST twilio/fail ', req.params)
|
|
769
804
|
winston.debug('+++++++++++(voice) called POST twilio/fail ', req.body)
|
package/package.json
CHANGED
|
@@ -267,11 +267,11 @@ class TiledeskTwilioTranslator {
|
|
|
267
267
|
gather.att("action", this.BASE_URL + '/speechresult/' + xmlAttributes.callSid + queryUrl)
|
|
268
268
|
.att("method", "POST")
|
|
269
269
|
.att("language", xmlAttributes.voiceLanguage)
|
|
270
|
-
.att('speechTimeout', "
|
|
270
|
+
.att('speechTimeout', "0")
|
|
271
271
|
|
|
272
|
-
if(xmlAttributes && xmlAttributes.noInputTimeout){
|
|
272
|
+
/*if(xmlAttributes && xmlAttributes.noInputTimeout){
|
|
273
273
|
gather.att("timeout", xmlAttributes.noInputTimeout/1000 ).up();
|
|
274
|
-
}
|
|
274
|
+
}*/
|
|
275
275
|
/*if(xmlAttributes && xmlAttributes.incompleteSpeechTimeout){
|
|
276
276
|
gather.att("speechTimeout", xmlAttributes.incompleteSpeechTimeout/1000 ).up();
|
|
277
277
|
}*/
|