bugfix: dep in bluebird was causing issue, update to latest synthAudio

This commit is contained in:
Dave Horton
2021-02-10 09:39:20 -05:00
parent f8e84b5ad0
commit a7e0fb2e8a
5 changed files with 46 additions and 24 deletions

View File

@@ -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');

View File

@@ -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

View File

@@ -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;
}