@tiledesk/tiledesk-voice-twilio-connector 0.1.11 → 0.1.12
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 +20 -21
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -185,8 +185,8 @@ router.post('/webhook/:id_project', async (req, res) => {
|
|
|
185
185
|
|
|
186
186
|
|
|
187
187
|
router.post('/nextblock/:callSid/', async(req, res) => {
|
|
188
|
-
winston.
|
|
189
|
-
winston.
|
|
188
|
+
winston.debug("(vxml) called POST /nextblock" , req.body);
|
|
189
|
+
winston.debug("(vxml) called POST /nextblock query", req.query);
|
|
190
190
|
|
|
191
191
|
let usertext = req.body.SpeechResult;
|
|
192
192
|
let confidence = req.body.Confidence
|
|
@@ -287,8 +287,8 @@ router.post('/nextblock/:callSid/', async(req, res) => {
|
|
|
287
287
|
|
|
288
288
|
|
|
289
289
|
router.post('/menublock/:callSid', async (req, res) => {
|
|
290
|
-
winston.
|
|
291
|
-
winston.
|
|
290
|
+
winston.debug("(voice) called POST /menu", req.body);
|
|
291
|
+
winston.debug("(voice) called POST /menu query" , req.query);
|
|
292
292
|
|
|
293
293
|
let message_text = '';
|
|
294
294
|
let attributes = {};
|
|
@@ -372,7 +372,6 @@ router.post('/menublock/:callSid', async (req, res) => {
|
|
|
372
372
|
channel: { name: CHANNEL_NAME },
|
|
373
373
|
attributes: attributes
|
|
374
374
|
};
|
|
375
|
-
console.log('messssss', tiledeskMessage)
|
|
376
375
|
let tdMessage = await tdChannel.send(tiledeskMessage, user.token, conversation_id);
|
|
377
376
|
|
|
378
377
|
//generate Tiledesk wait message
|
|
@@ -391,9 +390,9 @@ router.post('/menublock/:callSid', async (req, res) => {
|
|
|
391
390
|
});
|
|
392
391
|
|
|
393
392
|
router.post('/handle/:callSid/:event', async (req, res) => {
|
|
394
|
-
winston.
|
|
395
|
-
winston.
|
|
396
|
-
winston.
|
|
393
|
+
winston.debug("(voice) called POST /handle", req.body);
|
|
394
|
+
winston.debug("(voice) called POST /handle query -->", req.query);
|
|
395
|
+
winston.debug("(voice) called POST /handle params-->", req.params);
|
|
397
396
|
|
|
398
397
|
let event = req.params.event;
|
|
399
398
|
let callSid = req.params.callSid;
|
|
@@ -468,7 +467,7 @@ router.post('/handle/:callSid/:event', async (req, res) => {
|
|
|
468
467
|
|
|
469
468
|
/* ----> catch Event block <----- */
|
|
470
469
|
router.post('/event/:callSid/:event', async(req, res)=> {
|
|
471
|
-
winston.
|
|
470
|
+
winston.debug("(voice) called POST /event" , req.params);
|
|
472
471
|
winston.debug("(voice) called POST /event query" , req.query);
|
|
473
472
|
winston.debug("(voice) called POST /event body" , req.body);
|
|
474
473
|
|
|
@@ -690,7 +689,7 @@ router.post('/record/:callSid/',async (req, res) => {
|
|
|
690
689
|
if(!textMessage){
|
|
691
690
|
//case NO_INPUT
|
|
692
691
|
const queryString = utils.buildQueryString(req.query);
|
|
693
|
-
|
|
692
|
+
winston.debug('case no input.. redirect '+ queryString)
|
|
694
693
|
|
|
695
694
|
return await axios({
|
|
696
695
|
url: "http://localhost:3000/handle/" + callSid + '/no_input'+ queryString,
|
|
@@ -730,8 +729,8 @@ router.post('/record/:callSid/',async (req, res) => {
|
|
|
730
729
|
|
|
731
730
|
|
|
732
731
|
router.get('/addon/transcript', async (req, res) => {
|
|
733
|
-
winston.
|
|
734
|
-
winston.
|
|
732
|
+
winston.debug("(vxml) called GET /transcript query-->" , req.query);
|
|
733
|
+
winston.debug("(vxml) called GET /transcript body -->" , req.body);
|
|
735
734
|
|
|
736
735
|
res.status(200).send('ok');
|
|
737
736
|
|
|
@@ -739,7 +738,7 @@ router.get('/addon/transcript', async (req, res) => {
|
|
|
739
738
|
|
|
740
739
|
/** --> only for test purpose <-- **/
|
|
741
740
|
router.get('/test', async (req, res) => {
|
|
742
|
-
winston.
|
|
741
|
+
winston.debug("(vxml) called GET /test" , req.query);
|
|
743
742
|
|
|
744
743
|
let project_id = req.query.id_project;
|
|
745
744
|
let callSid = req.body.CallSid;
|
|
@@ -905,15 +904,15 @@ async function connectRedis() {
|
|
|
905
904
|
|
|
906
905
|
|
|
907
906
|
redis_client.on('error', err => {
|
|
908
|
-
winston.
|
|
907
|
+
winston.debug('(voice) Connect Redis Error ' + err);
|
|
909
908
|
})
|
|
910
909
|
/*
|
|
911
910
|
redis_client.on('connect', () => {
|
|
912
|
-
winston.
|
|
911
|
+
winston.debug('Redis Connected!'); // Connected!
|
|
913
912
|
});
|
|
914
913
|
*/
|
|
915
914
|
redis_client.on('ready', () => {
|
|
916
|
-
winston.
|
|
915
|
+
winston.debug("(voice) Redis ready!")
|
|
917
916
|
})
|
|
918
917
|
await redis_client.connect(); // only for v4
|
|
919
918
|
require('bluebird').promisifyAll(redis_client)
|
|
@@ -934,14 +933,14 @@ async function startApp(settings, callback) {
|
|
|
934
933
|
} else {
|
|
935
934
|
API_URL = settings.API_URL;
|
|
936
935
|
}
|
|
937
|
-
winston.
|
|
936
|
+
winston.debug("(voice) API_URL: " + API_URL)
|
|
938
937
|
|
|
939
938
|
if (!settings.BASE_URL) {
|
|
940
939
|
winston.error("(voice) BASE_URL is mandatory. Exit...");
|
|
941
940
|
return callback('Missing parameter: BASE_URL');
|
|
942
941
|
} else {
|
|
943
942
|
BASE_URL = settings.BASE_URL;
|
|
944
|
-
winston.
|
|
943
|
+
winston.debug("(voice) BASE_URL: " + BASE_URL);
|
|
945
944
|
}
|
|
946
945
|
|
|
947
946
|
if (settings.BRAND_NAME) {
|
|
@@ -965,14 +964,14 @@ async function startApp(settings, callback) {
|
|
|
965
964
|
|
|
966
965
|
if (settings.dbconnection) {
|
|
967
966
|
db.reuseConnection(settings.dbconnection, () => {
|
|
968
|
-
winston.
|
|
967
|
+
winston.debug("(voice) KVBaseMongo reused exsisting db connection");
|
|
969
968
|
if (callback) {
|
|
970
969
|
callback(null);
|
|
971
970
|
}
|
|
972
971
|
})
|
|
973
972
|
} else {
|
|
974
973
|
db.connect(settings.MONGODB_URI, () => {
|
|
975
|
-
winston.
|
|
974
|
+
winston.debug("(voice) KVBaseMongo successfully connected.");
|
|
976
975
|
|
|
977
976
|
if (callback) {
|
|
978
977
|
callback(null);
|
|
@@ -990,7 +989,7 @@ async function startApp(settings, callback) {
|
|
|
990
989
|
if (!err) {
|
|
991
990
|
winston.info("Manage route succesfully started.");
|
|
992
991
|
} else {
|
|
993
|
-
winston.
|
|
992
|
+
winston.error("(voice) Unable to start API route.")
|
|
994
993
|
}
|
|
995
994
|
})
|
|
996
995
|
|