update to latest realtimedb-helpers

This commit is contained in:
Dave Horton
2021-02-08 15:36:30 -05:00
parent 873729edb1
commit 0cff553310
4 changed files with 41 additions and 41 deletions

View File

@@ -214,27 +214,27 @@ class Dialogflow extends Task {
salt: cs.callSid salt: cs.callSid
}; };
this.logger.debug({obj}, 'Dialogflow:_onIntent - playing message via tts'); this.logger.debug({obj}, 'Dialogflow:_onIntent - playing message via tts');
const fp = await synthAudio(obj); const {filepath} = await synthAudio(obj);
if (fp) cs.trackTmpFile(fp); if (filepath) cs.trackTmpFile(filepath);
if (this.playInProgress) { if (this.playInProgress) {
await ep.api('uuid_break', ep.uuid).catch((err) => this.logger.info(err, 'Error killing audio')); await ep.api('uuid_break', ep.uuid).catch((err) => this.logger.info(err, 'Error killing audio'));
} }
this.playInProgress = true; this.playInProgress = true;
this.curentAudioFile = fp; this.curentAudioFile = filepath;
this.logger.debug(`starting to play tts ${fp}`); this.logger.debug(`starting to play tts ${filepath}`);
if (this.events.includes('start-play')) { if (this.events.includes('start-play')) {
this._performHook(cs, this.eventHook, {event: 'start-play', data: {path: fp}}); this._performHook(cs, this.eventHook, {event: 'start-play', data: {path: filepath}});
} }
await ep.play(fp); await ep.play(filepath);
if (this.events.includes('stop-play')) { if (this.events.includes('stop-play')) {
this._performHook(cs, this.eventHook, {event: 'stop-play', data: {path: fp}}); this._performHook(cs, this.eventHook, {event: 'stop-play', data: {path: filepath}});
} }
this.logger.debug(`finished ${fp}`); this.logger.debug(`finished ${filepath}`);
if (this.curentAudioFile === fp) { if (this.curentAudioFile === filepath) {
this.playInProgress = false; this.playInProgress = false;
if (this.queuedTasks) { if (this.queuedTasks) {
this.logger.debug('finished playing audio and we have queued tasks'); this.logger.debug('finished playing audio and we have queued tasks');

View File

@@ -184,20 +184,20 @@ class Lex extends Task {
try { try {
this.logger.debug(`tts with ${this.vendor} ${this.voice}`); this.logger.debug(`tts with ${this.vendor} ${this.voice}`);
const fp = await synthAudio({ const {filepath} = await synthAudio({
text: msg, text: msg,
vendor: this.vendor, vendor: this.vendor,
language: this.language, language: this.language,
voice: this.voice, voice: this.voice,
salt: cs.callSid salt: cs.callSid
}); });
if (fp) cs.trackTmpFile(fp); if (filepath) cs.trackTmpFile(filepath);
if (this.events.includes('start-play')) { if (this.events.includes('start-play')) {
this._performHook(cs, this.eventHook, {event: 'start-play', data: {path: fp}}); this._performHook(cs, this.eventHook, {event: 'start-play', data: {path: filepath}});
} }
await ep.play(fp); await ep.play(filepath);
if (this.events.includes('stop-play')) { if (this.events.includes('stop-play')) {
this._performHook(cs, this.eventHook, {event: 'stop-play', data: {path: fp}}); this._performHook(cs, this.eventHook, {event: 'stop-play', data: {path: filepath}});
} }
this.logger.debug(`finished tts, sending play_done ${this.vendor} ${this.voice}`); this.logger.debug(`finished tts, sending play_done ${this.vendor} ${this.voice}`);
this.ep.api('aws_lex_play_done', this.ep.uuid) this.ep.api('aws_lex_play_done', this.ep.uuid)

50
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{ {
"name": "jambonz-feature-server", "name": "jambonz-feature-server",
"version": "0.2.5", "version": "0.2.6",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@@ -298,11 +298,11 @@
} }
}, },
"@grpc/grpc-js": { "@grpc/grpc-js": {
"version": "1.2.5", "version": "1.2.6",
"resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.2.5.tgz", "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.2.6.tgz",
"integrity": "sha512-CBCNwedw8McnEBq9jvoiJikws16WN0OiHFejQPovY71XkFWSiIqgvydYiDwpvIYDJmhPQ7qZNzW9BPndhXbx1Q==", "integrity": "sha512-wfYwFy7CvVEmBKzeDX1kQQYrv5NBpe8Z+VwXipFvqof3lCXKch7k+4T3grKtptaH5GQ5KP9iKwPr9hMDSynIUw==",
"requires": { "requires": {
"@types/node": "^12.12.47", "@types/node": ">=12.12.47",
"google-auth-library": "^6.1.1", "google-auth-library": "^6.1.1",
"semver": "^6.2.0" "semver": "^6.2.0"
} }
@@ -354,21 +354,21 @@
}, },
"dependencies": { "dependencies": {
"redis-commands": { "redis-commands": {
"version": "1.6.0", "version": "1.7.0",
"resolved": "https://registry.npmjs.org/redis-commands/-/redis-commands-1.6.0.tgz", "resolved": "https://registry.npmjs.org/redis-commands/-/redis-commands-1.7.0.tgz",
"integrity": "sha512-2jnZ0IkjZxvguITjFTrGiLyzQZcTvaw8DAaCXxZq/dsHXz7KfMQ3OUJy7Tz9vnRtZRVz6VRCPDvruvU8Ts44wQ==" "integrity": "sha512-nJWqw3bTFy21hX/CPKHth6sfhZbdiHP6bTawSgQBlKOVRG7EZkfHbbHwQJnrE4vsQf0CMNE+3gJ4Fmm16vdVlQ=="
} }
} }
}, },
"@jambonz/realtimedb-helpers": { "@jambonz/realtimedb-helpers": {
"version": "0.3.0", "version": "0.4.0",
"resolved": "https://registry.npmjs.org/@jambonz/realtimedb-helpers/-/realtimedb-helpers-0.3.0.tgz", "resolved": "https://registry.npmjs.org/@jambonz/realtimedb-helpers/-/realtimedb-helpers-0.4.0.tgz",
"integrity": "sha512-gn2S1zu0bg/UrmqOXb4K9YISZWSip1rOEITaGWCV9p211d05XBBOUYuD5RlUVGwP48dOHtGVQp8NW+f0GLxdEA==", "integrity": "sha512-MA+JFC6oV1DpgxtSgoZBMVCz5EJkSOxjV6c6OZRXv219gvMFwbvbMPnh4f7Fhry8jbwKA4CMl5HXwmY5fp7iEQ==",
"requires": { "requires": {
"@google-cloud/text-to-speech": "^3.1.3", "@google-cloud/text-to-speech": "^3.1.3",
"@jambonz/promisify-redis": "0.0.6", "@jambonz/promisify-redis": "0.0.6",
"@jambonz/stats-collector": "^0.1.4", "@jambonz/stats-collector": "^0.1.5",
"aws-sdk": "^2.810.0", "aws-sdk": "^2.840.0",
"debug": "^4.3.1", "debug": "^4.3.1",
"redis": "^2.8.0" "redis": "^2.8.0"
} }
@@ -448,9 +448,9 @@
"integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==" "integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w=="
}, },
"@types/node": { "@types/node": {
"version": "12.19.15", "version": "14.14.25",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.19.15.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.25.tgz",
"integrity": "sha512-lowukE3GUI+VSYSu6VcBXl14d61Rp5hA1D+61r16qnwC0lYNSqdxcvRh0pswejorHfS+HgwBasM8jLXz0/aOsw==" "integrity": "sha512-EPpXLOVqDvisVxtlbvzfyqSsFeQxltFbluZNRndIb8tr9KiBnYNLzrc1N3pyKUCww2RNrfHDViqDWWE1LCJQtQ=="
}, },
"abort-controller": { "abort-controller": {
"version": "3.0.0", "version": "3.0.0",
@@ -593,9 +593,9 @@
"integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==" "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ=="
}, },
"aws-sdk": { "aws-sdk": {
"version": "2.834.0", "version": "2.840.0",
"resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.834.0.tgz", "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.840.0.tgz",
"integrity": "sha512-9WRULrn4qAmgXI+tEW/IG5s/6ixJGZqjPOrmJsFZQev7/WRkxAZmJAjcwd4Ifm/jsJbXx2FSwO76gOPEvu2LqA==", "integrity": "sha512-ngesHJqb0PXYjJNnCsAX4yLkR6JFQJB+3eDGwh3mYRjcq9voix5RfbCFQT1lwWu7bcMBPCrRIA2lJkkTMYXq+A==",
"requires": { "requires": {
"buffer": "4.9.2", "buffer": "4.9.2",
"events": "1.1.1", "events": "1.1.1",
@@ -1883,9 +1883,9 @@
} }
}, },
"google-gax": { "google-gax": {
"version": "2.10.0", "version": "2.10.2",
"resolved": "https://registry.npmjs.org/google-gax/-/google-gax-2.10.0.tgz", "resolved": "https://registry.npmjs.org/google-gax/-/google-gax-2.10.2.tgz",
"integrity": "sha512-K+1JK5ofNl5k30LsI8UQb/DeLMEbhL/SWirCx0L9pnMcApSfAjRAO7yajXT5X1vicxDBnNSwKs+cu4elxpYraw==", "integrity": "sha512-adECud3d5jsk24SvPkKQG3Kw1szpy4We0OqKfsdBHKWlSWhdY4hVQEOG7iBBp469Zm327fzz7NZz8BMLOYZJHg==",
"requires": { "requires": {
"@grpc/grpc-js": "~1.2.0", "@grpc/grpc-js": "~1.2.0",
"@grpc/proto-loader": "^0.5.1", "@grpc/proto-loader": "^0.5.1",
@@ -2963,9 +2963,9 @@
}, },
"dependencies": { "dependencies": {
"@types/node": { "@types/node": {
"version": "13.13.40", "version": "13.13.41",
"resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.40.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.41.tgz",
"integrity": "sha512-eKaRo87lu1yAXrzEJl0zcJxfUMDT5/mZalFyOkT44rnQps41eS2pfWzbaulSPpQLFNy29bFqn+Y5lOTL8ATlEQ==" "integrity": "sha512-qLT9IvHiXJfdrje9VmsLzun7cQ65obsBTmtU3EOnCSLFOoSHx1hpiRHoBnpdbyFqnzqdUUIv81JcEJQCB8un9g=="
} }
} }
}, },

View File

@@ -1,6 +1,6 @@
{ {
"name": "jambonz-feature-server", "name": "jambonz-feature-server",
"version": "0.2.5", "version": "0.2.6",
"main": "app.js", "main": "app.js",
"engines": { "engines": {
"node": ">= 10.16.0" "node": ">= 10.16.0"
@@ -27,7 +27,7 @@
}, },
"dependencies": { "dependencies": {
"@jambonz/db-helpers": "^0.5.10", "@jambonz/db-helpers": "^0.5.10",
"@jambonz/realtimedb-helpers": "^0.3.0", "@jambonz/realtimedb-helpers": "^0.4.0",
"@jambonz/stats-collector": "^0.1.5", "@jambonz/stats-collector": "^0.1.5",
"bent": "^7.3.12", "bent": "^7.3.12",
"cidr-matcher": "^2.1.1", "cidr-matcher": "^2.1.1",