Compare commits

...

4 Commits

Author SHA1 Message Date
Dave Horton
bfc8a99950 bugfix: ws error max connections error causes a crash 2022-11-01 11:33:03 -04:00
Dave Horton
9097c6d6ac bugfix when running multiple instances in EC2 2022-10-31 14:42:53 -04:00
Dave Horton
15b2fdd5a8 update to db-helpers@0.7.0 with caching option 2022-10-31 11:43:07 -04:00
Dave Horton
979e17c814 add support for Azure audio logging in gather and transcribe 2022-10-31 11:08:16 -04:00
7 changed files with 33 additions and 13 deletions

View File

@@ -83,6 +83,7 @@ class TaskGather extends Task {
this.initialSpeechTimeoutMs = recognizer.initialSpeechTimeoutMs || 0;
this.azureServiceEndpoint = recognizer.azureServiceEndpoint;
this.azureSttEndpointId = recognizer.azureSttEndpointId;
this.azureAudioLogging = recognizer.audioLogging;
}
else {
this.hints = [];
@@ -381,6 +382,7 @@ class TaskGather extends Task {
else {
opts.AZURE_SPEECH_ALTERNATIVE_LANGUAGE_CODES = '';
}
if (this.azureAudioLogging) opts.AZURE_AUDIO_LOGGING = 1;
if (this.requestSnr) opts.AZURE_REQUEST_SNR = 1;
if (this.profanityOption && this.profanityOption !== 'raw') opts.AZURE_PROFANITY_OPTION = this.profanityOption;
if (this.azureServiceEndpoint) opts.AZURE_SERVICE_ENDPOINT = this.azureServiceEndpoint;

View File

@@ -509,7 +509,8 @@
"azureServiceEndpoint": "string",
"azureSttEndpointId": "string",
"asrDtmfTerminationDigit": "string",
"asrTimeout": "number"
"asrTimeout": "number",
"audioLogging": "boolean"
},
"required": [
"vendor"

View File

@@ -55,6 +55,7 @@ class TaskTranscribe extends Task {
this.initialSpeechTimeoutMs = recognizer.initialSpeechTimeoutMs || 0;
this.azureServiceEndpoint = recognizer.azureServiceEndpoint;
this.azureSttEndpointId = recognizer.azureSttEndpointId;
this.azureAudioLogging = recognizer.audioLogging;
}
get name() { return TaskName.Transcribe; }
@@ -249,6 +250,7 @@ class TaskTranscribe extends Task {
}
if (this.altLanguages.length > 0) opts.AZURE_SPEECH_ALTERNATIVE_LANGUAGE_CODES = this.altLanguages.join(',');
else opts.AZURE_SPEECH_ALTERNATIVE_LANGUAGE_CODES = '';
if (this.azureAudioLogging) opts.AZURE_AUDIO_LOGGING = 1;
if (this.requestSnr) opts.AZURE_REQUEST_SNR = 1;
if (this.profanityOption !== 'raw') opts.AZURE_PROFANITY_OPTION = this.profanityOption;
if (this.initialSpeechTimeoutMs > 0) opts.AZURE_INITIAL_SPEECH_TIMEOUT_MS = this.initialSpeechTimeoutMs;

View File

@@ -36,7 +36,7 @@ class SnsNotifier extends Emitter {
logger.info(`SNS lifecycle server failed to bind port on ${e.port}, will try next port`);
const server = this._doListen(logger, app, ++e.port, resolve);
server.on('error', this._handleErrors.bind(null, logger, app, resolve, reject));
server.on('error', this._handleErrors.bind(this, logger, app, resolve, reject));
return;
}
reject(e);
@@ -120,7 +120,7 @@ class SnsNotifier extends Emitter {
});
return new Promise((resolve, reject) => {
const server = this._doListen(this.logger, app, PORT, resolve);
server.on('error', this._handleErrors.bind(null, this.logger, app, resolve, reject));
server.on('error', this._handleErrors.bind(this, this.logger, app, resolve, reject));
});
} catch (err) {

View File

@@ -69,7 +69,7 @@ class WsRequestor extends BaseRequestor {
this.connectInProgress = true;
this.logger.debug(`WsRequestor:request(${this.id}) - connecting since we do not have a connection`);
if (this.connections >= MAX_RECONNECTS) {
throw new Error(`max attempts connecting to ${this.url}`);
return Promise.reject(`max attempts connecting to ${this.url}`);
}
try {
const startAt = process.hrtime();
@@ -79,7 +79,7 @@ class WsRequestor extends BaseRequestor {
} catch (err) {
this.logger.info({url, err}, 'WsRequestor:request - failed connecting');
this.connectInProgress = false;
throw err;
return Promise.reject(err);
}
}
assert(this.ws);

29
package-lock.json generated
View File

@@ -9,7 +9,7 @@
"version": "v0.7.7",
"license": "MIT",
"dependencies": {
"@jambonz/db-helpers": "^0.6.19",
"@jambonz/db-helpers": "^0.7.0",
"@jambonz/http-health-check": "^0.0.1",
"@jambonz/realtimedb-helpers": "^0.4.35",
"@jambonz/stats-collector": "^0.1.6",
@@ -509,13 +509,14 @@
}
},
"node_modules/@jambonz/db-helpers": {
"version": "0.6.19",
"resolved": "https://registry.npmjs.org/@jambonz/db-helpers/-/db-helpers-0.6.19.tgz",
"integrity": "sha512-mR9PqPY4aEoeTtUuZI1+4r+k1BFKoe0Dl9pyeAEvm7KSlRMHCVWbOzVE8WfoifC9dZ9541iW5pseqqip3QMkyw==",
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@jambonz/db-helpers/-/db-helpers-0.7.0.tgz",
"integrity": "sha512-Fj0q8qEwW2xKCtOyDkzKLl6kvBASFTeLljc+LW1hoF47pe+IFc3ZXPL3ntqwX39YgFCMayeUrJMdio+1GYsECA==",
"dependencies": {
"cidr-matcher": "^2.1.1",
"debug": "^4.3.3",
"mysql2": "^2.3.3",
"node-object-hash": "^2.3.10",
"uuid": "^8.3.2"
}
},
@@ -4641,6 +4642,14 @@
"resolved": "https://registry.npmjs.org/node-noop/-/node-noop-0.0.1.tgz",
"integrity": "sha512-kAUvIRxZyDYFTLqGj+7zqXduG89vtqGmNMt9qDMvYH3H8uNTCOTz5ZN1q2Yg8++fWbzv+ERtYVqaOH42Ag5OpA=="
},
"node_modules/node-object-hash": {
"version": "2.3.10",
"resolved": "https://registry.npmjs.org/node-object-hash/-/node-object-hash-2.3.10.tgz",
"integrity": "sha512-jY5dPJzw6NHd/KPSfPKJ+IHoFS81/tJ43r34ZeNMXGzCOM8jwQDCD12HYayKIB6MuznrnqIYy2e891NA2g0ibA==",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/node-preload": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/node-preload/-/node-preload-0.2.1.tgz",
@@ -7043,13 +7052,14 @@
"dev": true
},
"@jambonz/db-helpers": {
"version": "0.6.19",
"resolved": "https://registry.npmjs.org/@jambonz/db-helpers/-/db-helpers-0.6.19.tgz",
"integrity": "sha512-mR9PqPY4aEoeTtUuZI1+4r+k1BFKoe0Dl9pyeAEvm7KSlRMHCVWbOzVE8WfoifC9dZ9541iW5pseqqip3QMkyw==",
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/@jambonz/db-helpers/-/db-helpers-0.7.0.tgz",
"integrity": "sha512-Fj0q8qEwW2xKCtOyDkzKLl6kvBASFTeLljc+LW1hoF47pe+IFc3ZXPL3ntqwX39YgFCMayeUrJMdio+1GYsECA==",
"requires": {
"cidr-matcher": "^2.1.1",
"debug": "^4.3.3",
"mysql2": "^2.3.3",
"node-object-hash": "^2.3.10",
"uuid": "^8.3.2"
}
},
@@ -10192,6 +10202,11 @@
"resolved": "https://registry.npmjs.org/node-noop/-/node-noop-0.0.1.tgz",
"integrity": "sha512-kAUvIRxZyDYFTLqGj+7zqXduG89vtqGmNMt9qDMvYH3H8uNTCOTz5ZN1q2Yg8++fWbzv+ERtYVqaOH42Ag5OpA=="
},
"node-object-hash": {
"version": "2.3.10",
"resolved": "https://registry.npmjs.org/node-object-hash/-/node-object-hash-2.3.10.tgz",
"integrity": "sha512-jY5dPJzw6NHd/KPSfPKJ+IHoFS81/tJ43r34ZeNMXGzCOM8jwQDCD12HYayKIB6MuznrnqIYy2e891NA2g0ibA=="
},
"node-preload": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/node-preload/-/node-preload-0.2.1.tgz",

View File

@@ -25,7 +25,7 @@
},
"dependencies": {
"@jambonz/http-health-check": "^0.0.1",
"@jambonz/db-helpers": "^0.6.19",
"@jambonz/db-helpers": "^0.7.0",
"@jambonz/realtimedb-helpers": "^0.4.35",
"@jambonz/stats-collector": "^0.1.6",
"@jambonz/time-series": "^0.2.5",