diff --git a/lib/tasks/say.js b/lib/tasks/say.js index 97a341e5..17b1834c 100644 --- a/lib/tasks/say.js +++ b/lib/tasks/say.js @@ -21,26 +21,26 @@ class TaskSay extends Task { this.ep = ep; try { // synthesize all of the text elements - const filepath = (await Promise.all(this.text.map(async(text) => { - const fp = await synthAudio({ + const files = (await Promise.all(this.text.map(async(text) => { + const {filePath} = await synthAudio({ text, vendor: this.synthesizer.vendor || cs.speechSynthesisVendor, language: this.synthesizer.language || cs.speechSynthesisLanguage, voice: this.synthesizer.voice || cs.speechSynthesisVoice, salt: cs.callSid }).catch((err) => this.logger.error(err, 'Error synthesizing text')); - if (fp) cs.trackTmpFile(fp); - return fp; + if (filePath) cs.trackTmpFile(filePath); + return filePath; }))) .filter((fp) => fp && fp.length); - this.logger.debug({filepath}, 'synthesized files for tts'); + this.logger.debug({files}, 'synthesized files for tts'); while (!this.killed && this.loop-- && this.ep.connected) { let segment = 0; do { - await ep.play(filepath[segment]); - } while (!this.killed && ++segment < filepath.length); + await ep.play(files[segment]); + } while (!this.killed && ++segment < files.length); } } catch (err) { this.logger.info(err, 'TaskSay:exec error'); diff --git a/lib/utils/place-outdial.js b/lib/utils/place-outdial.js index 43bef76c..ffe4dcfc 100644 --- a/lib/utils/place-outdial.js +++ b/lib/utils/place-outdial.js @@ -6,7 +6,7 @@ const CallInfo = require('../session/call-info'); const assert = require('assert'); const ConfirmCallSession = require('../session/confirm-call-session'); const selectSbc = require('./select-sbc'); -const Registrar = require('jambonz-mw-registrar'); +const Registrar = require('@jambonz/mw-registrar'); const registrar = new Registrar({ host: process.env.JAMBONES_REDIS_HOST, port: process.env.JAMBONES_REDIS_PORT || 6379 diff --git a/lib/utils/requestor.js b/lib/utils/requestor.js index 40244ebd..1761a9c4 100644 --- a/lib/utils/requestor.js +++ b/lib/utils/requestor.js @@ -79,7 +79,7 @@ class Requestor { await this.post(url, params, this.authHeader) : await bent(method, 'buffer', 200, 201, 202)(url, params, basicAuth(username, password)); } catch (err) { - this.logger.info({baseUrl: this.baseUrl, url: err.statusCode}, + this.logger.info({baseUrl: this.baseUrl, url, statusCode: err.statusCode}, `web callback returned unexpected error code ${err.statusCode}`); throw err; } diff --git a/package-lock.json b/package-lock.json index 64adaa5a..bac1cf83 100644 --- a/package-lock.json +++ b/package-lock.json @@ -345,6 +345,37 @@ "uuid": "^8.3.2" } }, + "@jambonz/mw-registrar": { + "version": "0.1.9", + "resolved": "https://registry.npmjs.org/@jambonz/mw-registrar/-/mw-registrar-0.1.9.tgz", + "integrity": "sha512-nis3pobFMkkzDyeHaoyo1exOX9iq9oZ3Kg6K50mZiqNM+G1/Wy+Pv1n5RNXn6Q/LDk4YCkqmGfLv9dzOypDoKA==", + "requires": { + "@jambonz/promisify-redis": "0.0.6", + "debug": "^4.3.1", + "redis": "^3.0.2" + }, + "dependencies": { + "redis": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/redis/-/redis-3.0.2.tgz", + "integrity": "sha512-PNhLCrjU6vKVuMOyFu7oSP296mwBkcE6lrAjruBYG5LgdSqtRBoVQIylrMyVZD/lkF24RSNNatzvYag6HRBHjQ==", + "requires": { + "denque": "^1.4.1", + "redis-commands": "^1.5.0", + "redis-errors": "^1.2.0", + "redis-parser": "^3.0.0" + } + }, + "redis-parser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/redis-parser/-/redis-parser-3.0.0.tgz", + "integrity": "sha1-tm2CjNyv5rS4pCin3vTGvKwxyLQ=", + "requires": { + "redis-errors": "^1.0.0" + } + } + } + }, "@jambonz/promisify-redis": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/@jambonz/promisify-redis/-/promisify-redis-0.0.6.tgz", @@ -748,11 +779,6 @@ } } }, - "bluebird": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", - "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" - }, "body-parser": { "version": "1.19.0", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", @@ -2565,15 +2591,6 @@ "istanbul-lib-report": "^3.0.0" } }, - "jambonz-mw-registrar": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/jambonz-mw-registrar/-/jambonz-mw-registrar-0.1.3.tgz", - "integrity": "sha512-HzC8EbsoMoZRBvFlkmVAQrm3/2khYBQRUFIL0ji/ficsV4Ts0e0ABaByitR2fEj8+q3K9d2d0iBq1AAfUee/yg==", - "requires": { - "bluebird": "^3.5.5", - "redis": "^2.8.0" - } - }, "jmespath": { "version": "0.15.0", "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.15.0.tgz", @@ -3295,6 +3312,11 @@ "resolved": "https://registry.npmjs.org/redis-commands/-/redis-commands-1.5.0.tgz", "integrity": "sha512-6KxamqpZ468MeQC3bkWmCB1fp56XL64D4Kf0zJSwDZbVLLm7KFkoIcHrgRvQ+sk8dnhySs7+yBg94yIkAK7aJg==" }, + "redis-errors": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/redis-errors/-/redis-errors-1.2.0.tgz", + "integrity": "sha1-62LSrbFeTq9GEMBK/hUpOEJQq60=" + }, "redis-parser": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/redis-parser/-/redis-parser-2.6.0.tgz", diff --git a/package.json b/package.json index 7a879179..180b93c5 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ }, "dependencies": { "@jambonz/db-helpers": "^0.5.10", + "@jambonz/mw-registrar": "^0.1.9", "@jambonz/realtimedb-helpers": "^0.4.0", "@jambonz/stats-collector": "^0.1.5", "aws-sdk": "^2.840.0", @@ -38,7 +39,6 @@ "drachtio-srf": "^4.4.47", "express": "^4.17.1", "ip": "^1.1.5", - "jambonz-mw-registrar": "^0.1.3", "moment": "^2.29.1", "parse-url": "^5.0.2", "pino": "^6.11.0",