@tiledesk/tiledesk-server 2.8.8 → 2.8.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,12 +12,35 @@ jobs:
12
12
  steps:
13
13
  - name: Check out the repo
14
14
  uses: actions/checkout@v2
15
- - name: Push to Docker Hub
16
- uses: docker/build-push-action@v1
17
- with:
15
+
16
+ - name: Login to Docker Hub
17
+ uses: docker/login-action@v3
18
+ with:
18
19
  username: ${{ secrets.DOCKER_USERNAME }}
19
20
  password: ${{ secrets.DOCKER_PASSWORD }}
20
- build_args: NPM_TOKEN=${{ secrets.NPM_TOKEN }}
21
- dockerfile: Dockerfile-en
22
21
  repository: tiledeskrepo/tiledesk-server-enterprise
23
22
  tag_with_ref: true
23
+
24
+ - name: Log Voice Token
25
+ run: |
26
+ echo "Voice token log: ${{ secrets.VOICE_TOKEN }}"
27
+
28
+ - name: Generate Docker metadata
29
+ id: meta
30
+ uses: docker/metadata-action@v3
31
+ with:
32
+ images: tiledeskrepo/tiledesk-server-enterprise
33
+ tags: |
34
+ type=ref,event=branch
35
+ type=semver,pattern={{version}}
36
+
37
+ - name: Push to Docker Hub
38
+ uses: docker/build-push-action@v4
39
+ with:
40
+ context: .
41
+ file: ./Dockerfile-en
42
+ push: true
43
+ build-args: |
44
+ NPM_TOKEN=${{ secrets.NPM_TOKEN }}
45
+ VOICE_TOKEN=${{ secrets.VOICE_TOKEN }}
46
+ tags: ${{ steps.meta.outputs.tags }}
package/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@
5
5
  🚀 IN PRODUCTION 🚀
6
6
  (https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.77)
7
7
 
8
+ # 2.9.0
9
+ - Added Twilio SMS route
10
+ - Added VXML Voice route (hidden)
11
+
8
12
  # 2.8.8
9
13
  - Changed default prompt for kb q&a
10
14
 
package/Dockerfile-en CHANGED
@@ -7,9 +7,15 @@ RUN apt-get update
7
7
  # Create app directory
8
8
  WORKDIR /usr/src/app
9
9
 
10
+ # Accept build arguments
10
11
  ARG NPM_TOKEN
12
+ ARG VOICE_TOKEN
13
+
11
14
  COPY .npmrc_ .npmrc
12
15
 
16
+ # Set environment variable based on build argument
17
+ ENV VOICE_TOKEN=${VOICE_TOKEN}
18
+
13
19
  # Install app dependencies
14
20
  # A wildcard is used to ensure both package.json AND package-lock.json are copied
15
21
  # where available (npm@5+)
package/deploy.sh CHANGED
@@ -1,5 +1,5 @@
1
1
  git pull
2
- npm version patch
2
+ npm version minor
3
3
  version=`node -e 'console.log(require("./package.json").version)'`
4
4
  echo "version $version"
5
5
 
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.8.8",
4
+ "version": "2.8.9",
5
5
  "scripts": {
6
6
  "start": "node ./bin/www",
7
7
  "pretest": "mongodb-runner start",
@@ -36,7 +36,7 @@
36
36
  "@tiledesk-ent/tiledesk-server-visitorcounter": "^1.1.1"
37
37
  },
38
38
  "dependencies": {
39
- "@tiledesk/tiledesk-apps": "^1.0.17",
39
+ "@tiledesk/tiledesk-apps": "^1.0.22",
40
40
  "@tiledesk/tiledesk-chat21-app": "^1.1.8",
41
41
  "@tiledesk/tiledesk-chatbot-templates": "^0.1.2",
42
42
  "@tiledesk/tiledesk-chatbot-util": "^0.8.33",
@@ -51,6 +51,8 @@
51
51
  "@tiledesk/tiledesk-tybot-connector": "^0.2.83",
52
52
  "@tiledesk/tiledesk-whatsapp-connector": "^0.1.72",
53
53
  "@tiledesk/tiledesk-whatsapp-jobworker": "^0.0.8",
54
+ "@tiledesk/tiledesk-sms-connector": "^0.1.6",
55
+ "@tiledesk/tiledesk-vxml-connector": "^0.1.37",
54
56
  "amqplib": "^0.5.5",
55
57
  "app-root-path": "^3.0.0",
56
58
  "bcrypt-nodejs": "0.0.3",
@@ -28,7 +28,8 @@ class Listener {
28
28
  apps.startApp({
29
29
  ACCESS_TOKEN_SECRET: process.env.APPS_ACCESS_TOKEN_SECRET || configSecretOrPubicKay,
30
30
  MONGODB_URI: process.env.APPS_MONGODB_URI || config.databaseUri,
31
- KALEYRA_ENABLED: process.env.KALEYRA_ENABLED || config.kaleyra_enabled
31
+ KALEYRA_ENABLED: process.env.KALEYRA_ENABLED || config.kaleyra_enabled,
32
+ VOICE_ENABLED: process.env.VOICE_ENABLED || false
32
33
  }, () => {
33
34
  winston.info("Tiledesk Apps proxy server succesfully started.")
34
35
  })
@@ -33,6 +33,12 @@ class PubModulesManager {
33
33
  this.telegram = undefined;
34
34
  this.telegramRoute = undefined;
35
35
 
36
+ this.sms = undefined;
37
+ this.smsRoute = undefined;
38
+
39
+ this.voice = undefined;
40
+ this.voiceRoute = undefined;
41
+
36
42
  this.mqttTest = undefined;
37
43
  this.mqttTestRoute = undefined;
38
44
 
@@ -91,6 +97,14 @@ class PubModulesManager {
91
97
  app.use('/modules/telegram', this.telegramRoute);
92
98
  winston.info("PubModulesManager telegramRoute controller loaded");
93
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
+ }
94
108
  if (this.mqttTestRoute) {
95
109
  app.use('/modules/mqttTest', this.mqttTestRoute);
96
110
  winston.info("PubModulesManager mqttTestRoute controller loaded");
@@ -331,6 +345,41 @@ class PubModulesManager {
331
345
  }
332
346
  }
333
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);
353
+
354
+ this.voiceRoute = this.voice.voiceRoute;
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
+ }
366
+
367
+ try {
368
+ this.sms = require('./sms');
369
+ winston.info("this.sms: " + this.sms);
370
+ this.sms.listener.listen(config);
371
+
372
+ this.smsRoute = this.sms.smsRoute;
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
+ }
382
+
334
383
  try {
335
384
  this.mqttTest = require('./mqttTest');
336
385
  winston.info("this.mqttTest: " + this.mqttTest);
@@ -0,0 +1,7 @@
1
+ const listener = require("./listener");
2
+
3
+ const sms = require("@tiledesk/tiledesk-sms-connector");
4
+ const smsRoute = sms.router;
5
+
6
+
7
+ module.exports = { listener: listener, smsRoute: smsRoute }
@@ -0,0 +1,55 @@
1
+ const sms = require("@tiledesk/tiledesk-sms-connector");
2
+ var winston = require('../../config/winston');
3
+ var configGlobal = require('../../config/global');
4
+ const mongoose = require("mongoose");
5
+
6
+ const apiUrl = process.env.API_URL || configGlobal.apiUrl;
7
+ winston.info('SMS apiUrl: ' + apiUrl);
8
+
9
+ const dbConnection = mongoose.connection;
10
+
11
+ class Listener {
12
+
13
+ listen(config) {
14
+ winston.info("SMS Listener listen");
15
+ if (config.databaseUri) {
16
+ winston.debug("SMS config databaseUri: " + config.databaseUri);
17
+ }
18
+
19
+ var port = process.env.CACHE_REDIS_PORT || 6379;
20
+ winston.debug("Redis port: "+ port);
21
+
22
+ var host = process.env.CACHE_REDIS_HOST || "127.0.0.1"
23
+ winston.debug("Redis host: "+ host);
24
+
25
+ var password = process.env.CACHE_REDIS_PASSWORD;
26
+ winston.debug("Redis password: "+ password);
27
+
28
+ let brand_name = null;
29
+ if (process.env.BRAND_NAME) {
30
+ brand_name = process.env.BRAND_NAME
31
+ }
32
+
33
+ let log = process.env.SMS_LOG || false
34
+ winston.debug("SMS log: " + log);
35
+
36
+
37
+ sms.startApp({
38
+ MONGODB_URI: config.databaseUri,
39
+ dbconnection: dbConnection,
40
+ API_URL: apiUrl,
41
+ BASE_URL: apiUrl + "/modules/sms",
42
+ BRAND_NAME: brand_name,
43
+ REDIS_HOST: host,
44
+ REDIS_PORT: port,
45
+ REDIS_PASSWORD: password,
46
+ log: log
47
+ })
48
+
49
+ }
50
+ }
51
+
52
+ var listener = new Listener();
53
+
54
+ module.exports = listener;
55
+
@@ -0,0 +1,7 @@
1
+ const listener = require("./listener");
2
+
3
+ const voice = require("@tiledesk/tiledesk-vxml-connector");
4
+ const voiceRoute = voice.router;
5
+
6
+
7
+ module.exports = { listener: listener, voiceRoute: voiceRoute }
@@ -0,0 +1,63 @@
1
+ const voice = require("@tiledesk/tiledesk-vxml-connector");
2
+ var winston = require('../../config/winston');
3
+ var configGlobal = require('../../config/global');
4
+ const mongoose = require("mongoose");
5
+
6
+ const apiUrl = process.env.API_URL || configGlobal.apiUrl;
7
+ winston.info('Voice apiUrl: ' + apiUrl);
8
+
9
+ const dbConnection = mongoose.connection;
10
+
11
+ class Listener {
12
+
13
+ listen(config) {
14
+ winston.info("Voice Listener listen");
15
+ if (config.databaseUri) {
16
+ winston.debug("Voice config databaseUri: " + config.databaseUri);
17
+ }
18
+
19
+ var pooling_delay = process.env.BASE_POOLING_DELAY || 250;
20
+ winston.debug("Pooling_delay: "+ pooling_delay);
21
+
22
+ var port = process.env.CACHE_REDIS_PORT || 6379;
23
+ winston.debug("Redis port: "+ port);
24
+
25
+ var host = process.env.CACHE_REDIS_HOST || "127.0.0.1"
26
+ winston.debug("Redis host: "+ host);
27
+
28
+ var password = process.env.CACHE_REDIS_PASSWORD;
29
+ winston.debug("Redis password: "+ password);
30
+
31
+ let brand_name = null;
32
+ if (process.env.BRAND_NAME) {
33
+ brand_name = process.env.BRAND_NAME
34
+ }
35
+
36
+ let log = process.env.VXML_LOG || false
37
+ winston.debug("Voice log: "+ log);
38
+
39
+ voice.startApp({
40
+ MONGODB_URI: config.databaseUri,
41
+ dbconnection: dbConnection,
42
+ API_URL: apiUrl,
43
+ BASE_URL: apiUrl + "/modules/voice",
44
+ REDIS_HOST: host,
45
+ REDIS_PORT: port,
46
+ REDIS_PASSWORD: password,
47
+ BRAND_NAME: brand_name,
48
+ BASE_POOLING_DELAY: pooling_delay,
49
+ log: log
50
+ }, (err) => {
51
+ if (!err) {
52
+ winston.info("Tiledesk Voice Connector proxy server succesfully started.");
53
+ } else {
54
+ winston.info("unable to start Tiledesk Voice Connector. " + err);
55
+ }
56
+ })
57
+
58
+ }
59
+ }
60
+
61
+ var listener = new Listener();
62
+
63
+ module.exports = listener;