@tiledesk/tiledesk-voice-twilio-connector 0.1.10 → 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 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.info("(vxml) called POST /nextblock" , req.body);
189
- winston.info("(vxml) called POST /nextblock query", req.query);
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.info("(voice) called POST /menu", req.body);
291
- winston.info("(voice) called POST /menu query" , req.query);
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.info("(voice) called POST /handle", req.body);
395
- winston.info("(voice) called POST /handle query -->", req.query);
396
- winston.info("(voice) called POST /handle params-->", req.params);
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.info("(voice) called POST /event" , req.params);
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
- console.log('case no input.. redirect '+ queryString)
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.info("(vxml) called GET /transcript query-->" , req.query);
734
- winston.info("(vxml) called GET /transcript body -->" , req.body);
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.info("(vxml) called GET /test" , req.query);
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.info('(voice) Connect Redis Error ' + err);
907
+ winston.debug('(voice) Connect Redis Error ' + err);
909
908
  })
910
909
  /*
911
910
  redis_client.on('connect', () => {
912
- winston.info('Redis Connected!'); // Connected!
911
+ winston.debug('Redis Connected!'); // Connected!
913
912
  });
914
913
  */
915
914
  redis_client.on('ready', () => {
916
- winston.info("(voice) Redis ready!")
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.info("(voice) API_URL: " + API_URL)
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.info("(voice) BASE_URL: " + BASE_URL);
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.info("(voice) KVBaseMongo reused exsisting db connection");
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.info("(voice) KVBaseMongo successfully connected.");
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.info("(voice) Unable to start API route.")
992
+ winston.error("(voice) Unable to start API route.")
994
993
  }
995
994
  })
996
995
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-voice-twilio-connector",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "Tiledesk VOICE Twilio connector",
5
5
  "license": "MIT",
6
6
  "author": "Gabriele Panico",
@@ -239,7 +239,7 @@ class TiledeskTwilioTranslator {
239
239
 
240
240
  async delayVXMLConverter(rootEle, message, xmlAttributes){
241
241
  const command = message.attributes.commands[0]
242
- rootEle.ele("Redirect", {Method: "POST"}, this.BASE_URL + '/nextblock/' + xmlAttributes.callSid).up()
242
+ rootEle.ele("Redirect", {method: "POST"}, this.BASE_URL + '/nextblock/' + xmlAttributes.callSid).up()
243
243
 
244
244
  return rootEle.end({ pretty: true });
245
245
  }
@@ -250,7 +250,7 @@ class TiledeskTwilioTranslator {
250
250
  const prompt = this.promptVXML(rootEle, message, xmlAttributes);
251
251
 
252
252
  const queryUrl = '?intentName='+ querystring.encode(xmlAttributes.intentName) + '&previousIntentTimestamp='+Date.now();
253
- rootEle.ele("Redirect", {Method: "POST"}, this.BASE_URL + '/nextblock/' + xmlAttributes.callSid + queryUrl).up()
253
+ rootEle.ele("Redirect", {method: "POST"}, this.BASE_URL + '/nextblock/' + xmlAttributes.callSid + queryUrl).up()
254
254
  //prompt.ele("submit", { fetchhint: "safe", expr: "proxyBaseUrl +'/nextblock/' + session.connection.calltoken", method: "post", namelist: "usertext session intentName previousIntentTimestamp" });
255
255
 
256
256
  return rootEle.end({ pretty: true });