@tiledesk/tiledesk-server 2.9.28 → 2.9.30

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/CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@
5
5
  🚀 IN PRODUCTION 🚀
6
6
  (https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.77)
7
7
 
8
+ # 2.9.30
9
+ - Restore Voice and SMS modules
10
+
11
+ # 2.9.29
12
+ - Fixed bug: try to update non existant project user (bot)
13
+
8
14
  # 2.9.28
9
15
  - Updated number_assigned_request count logic (removed incr/decr)
10
16
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-server",
3
3
  "description": "The Tiledesk server module",
4
- "version": "2.9.28",
4
+ "version": "2.9.30",
5
5
  "scripts": {
6
6
  "start": "node ./bin/www",
7
7
  "pretest": "mongodb-runner start",
@@ -33,11 +33,11 @@ class PubModulesManager {
33
33
  this.telegram = undefined;
34
34
  this.telegramRoute = undefined;
35
35
 
36
- // this.sms = undefined;
37
- // this.smsRoute = undefined;
36
+ this.sms = undefined;
37
+ this.smsRoute = undefined;
38
38
 
39
- // this.voice = undefined;
40
- // this.voiceRoute = undefined;
39
+ this.voice = undefined;
40
+ this.voiceRoute = undefined;
41
41
 
42
42
  this.mqttTest = undefined;
43
43
  this.mqttTestRoute = undefined;
@@ -97,14 +97,14 @@ class PubModulesManager {
97
97
  app.use('/modules/telegram', this.telegramRoute);
98
98
  winston.info("PubModulesManager telegramRoute controller loaded");
99
99
  }
100
- // if (this.smsRoute) {
101
- // app.use('/modules/sms', this.smsRoute);
102
- // winston.info("PubModulesManager smsRoute controller loaded");
103
- // }
104
- // if (this.voiceRoute) {
105
- // app.use('/modules/voice', this.voiceRoute);
106
- // winston.info("PubModulesManager voiceRoute controller loaded");
107
- // }
100
+ if (this.smsRoute) {
101
+ app.use('/modules/sms', this.smsRoute);
102
+ winston.info("PubModulesManager smsRoute controller loaded");
103
+ }
104
+ if (this.voiceRoute) {
105
+ app.use('/modules/voice', this.voiceRoute);
106
+ winston.info("PubModulesManager voiceRoute controller loaded");
107
+ }
108
108
  if (this.mqttTestRoute) {
109
109
  app.use('/modules/mqttTest', this.mqttTestRoute);
110
110
  winston.info("PubModulesManager mqttTestRoute controller loaded");
@@ -345,40 +345,40 @@ class PubModulesManager {
345
345
  }
346
346
  }
347
347
 
348
- // if (process.env.VOICE_TOKEN === process.env.VOICE_SECRET) {
349
- // try {
350
- // this.voice = require('./voice');
351
- // winston.info("this.voice: " + this.voice);
352
- // this.voice.listener.listen(config);
348
+ if (process.env.VOICE_TOKEN === process.env.VOICE_SECRET) {
349
+ try {
350
+ this.voice = require('./voice');
351
+ winston.info("this.voice: " + this.voice);
352
+ this.voice.listener.listen(config);
353
353
 
354
- // this.voiceRoute = this.voice.voiceRoute;
354
+ this.voiceRoute = this.voice.voiceRoute;
355
355
 
356
- // winston.info("PubModulesManager initialized apps (voice).")
357
- // } catch(err) {
358
- // console.log("\n Unable to start voice connector: ", err);
359
- // if (err.code == 'MODULE_NOT_FOUND') {
360
- // winston.info("PubModulesManager init apps module not found ");
361
- // } else {
362
- // winston.info("PubModulesManager error initializing init apps module", err);
363
- // }
364
- // }
365
- // }
356
+ winston.info("PubModulesManager initialized apps (voice).")
357
+ } catch(err) {
358
+ console.log("\n Unable to start voice connector: ", err);
359
+ if (err.code == 'MODULE_NOT_FOUND') {
360
+ winston.info("PubModulesManager init apps module not found ");
361
+ } else {
362
+ winston.info("PubModulesManager error initializing init apps module", err);
363
+ }
364
+ }
365
+ }
366
366
 
367
- // try {
368
- // this.sms = require('./sms');
369
- // winston.info("this.sms: " + this.sms);
370
- // this.sms.listener.listen(config);
367
+ try {
368
+ this.sms = require('./sms');
369
+ winston.info("this.sms: " + this.sms);
370
+ this.sms.listener.listen(config);
371
371
 
372
- // this.smsRoute = this.sms.smsRoute;
372
+ this.smsRoute = this.sms.smsRoute;
373
373
 
374
- // winston.info("PubModulesManager initialized apps (sms).")
375
- // } catch(err) {
376
- // if (err.code == 'MODULE_NOT_FOUND') {
377
- // winston.info("PubModulesManager init apps module not found ");
378
- // } else {
379
- // winston.info("PubModulesManager error initializing init apps module", err);
380
- // }
381
- // }
374
+ winston.info("PubModulesManager initialized apps (sms).")
375
+ } catch(err) {
376
+ if (err.code == 'MODULE_NOT_FOUND') {
377
+ winston.info("PubModulesManager init apps module not found ");
378
+ } else {
379
+ winston.info("PubModulesManager error initializing init apps module", err);
380
+ }
381
+ }
382
382
 
383
383
  try {
384
384
  this.mqttTest = require('./mqttTest');
@@ -43,10 +43,15 @@ class Listener {
43
43
  // New version of updateProjectUser() method.
44
44
  // This will not increment or decrement the number_assigned_requests field but search the exact number of assigned conversation to the project user
45
45
  updateProjectUser(id_user, id_project, operation) {
46
- winston.debug("Route queue updateProjectUser start operation: " + operation + "id_user " + id_user + " id_project " + id_project);
46
+ // winston.debug("Route queue updateProjectUser start operation: " + operation + "id_user " + id_user + " id_project " + id_project);
47
47
 
48
+ // escludi id_user che iniziano con bot_
49
+ if (id_user.startsWith('bot_')) {
50
+ return winston.warn("Chatbot is not a project_user. Skip update.")
51
+ }
52
+
48
53
  return Request.countDocuments({ id_project: id_project, participantsAgents: id_user, status: { $lt: 1000 } }, (err, requestsCount) => {
49
- console.log("requestsCount for id_user: ", id_user, "and project: ", id_project, "-->", requestsCount);
54
+ winston.verbose("requestsCount for id_user: ", id_user, "and project: ", id_project, "-->", requestsCount);
50
55
  if (err) {
51
56
  return winston.error(err);
52
57
  }