mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
bugfix: handle gather/transcribe where vendor not explicitly specified #187
This commit is contained in:
@@ -145,7 +145,9 @@ class TaskGather extends Task {
|
|||||||
this.ep = ep;
|
this.ep = ep;
|
||||||
if ('default' === this.vendor || !this.vendor) this.vendor = cs.speechRecognizerVendor;
|
if ('default' === this.vendor || !this.vendor) this.vendor = cs.speechRecognizerVendor;
|
||||||
if ('default' === this.language || !this.language) this.language = cs.speechRecognizerLanguage;
|
if ('default' === this.language || !this.language) this.language = cs.speechRecognizerLanguage;
|
||||||
|
if (!this.data.recognizer.vendor) {
|
||||||
|
this.data.recognizer.vendor = this.vendor;
|
||||||
|
}
|
||||||
if (this.needsStt && !this.sttCredentials) this.sttCredentials = cs.getSpeechCredentials(this.vendor, 'stt');
|
if (this.needsStt && !this.sttCredentials) this.sttCredentials = cs.getSpeechCredentials(this.vendor, 'stt');
|
||||||
if (this.needsStt && !this.sttCredentials) {
|
if (this.needsStt && !this.sttCredentials) {
|
||||||
const {writeAlerts, AlertType} = cs.srf.locals;
|
const {writeAlerts, AlertType} = cs.srf.locals;
|
||||||
|
|||||||
@@ -66,6 +66,9 @@ class TaskTranscribe extends Task {
|
|||||||
this.ep2 = ep2;
|
this.ep2 = ep2;
|
||||||
if ('default' === this.vendor || !this.vendor) this.vendor = cs.speechRecognizerVendor;
|
if ('default' === this.vendor || !this.vendor) this.vendor = cs.speechRecognizerVendor;
|
||||||
if ('default' === this.language || !this.language) this.language = cs.speechRecognizerLanguage;
|
if ('default' === this.language || !this.language) this.language = cs.speechRecognizerLanguage;
|
||||||
|
if (!this.data.recognizer.vendor) {
|
||||||
|
this.data.recognizer.vendor = this.vendor;
|
||||||
|
}
|
||||||
this.sttCredentials = cs.getSpeechCredentials(this.vendor, 'stt');
|
this.sttCredentials = cs.getSpeechCredentials(this.vendor, 'stt');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
14
package-lock.json
generated
14
package-lock.json
generated
@@ -11,7 +11,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jambonz/db-helpers": "^0.7.3",
|
"@jambonz/db-helpers": "^0.7.3",
|
||||||
"@jambonz/http-health-check": "^0.0.1",
|
"@jambonz/http-health-check": "^0.0.1",
|
||||||
"@jambonz/realtimedb-helpers": "^0.5.5",
|
"@jambonz/realtimedb-helpers": "^0.5.7",
|
||||||
"@jambonz/stats-collector": "^0.1.6",
|
"@jambonz/stats-collector": "^0.1.6",
|
||||||
"@jambonz/time-series": "^0.2.5",
|
"@jambonz/time-series": "^0.2.5",
|
||||||
"@opentelemetry/api": "^1.2.0",
|
"@opentelemetry/api": "^1.2.0",
|
||||||
@@ -543,9 +543,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@jambonz/realtimedb-helpers": {
|
"node_modules/@jambonz/realtimedb-helpers": {
|
||||||
"version": "0.5.5",
|
"version": "0.5.7",
|
||||||
"resolved": "https://registry.npmjs.org/@jambonz/realtimedb-helpers/-/realtimedb-helpers-0.5.5.tgz",
|
"resolved": "https://registry.npmjs.org/@jambonz/realtimedb-helpers/-/realtimedb-helpers-0.5.7.tgz",
|
||||||
"integrity": "sha512-tQJfTqN1FtFfKR9ceBYuQ9yddCDshBGVI6v1N/IxOyhTywyueNFXg6JMIOx0Rci7UqIDhtcBjl5R64zWgTo04A==",
|
"integrity": "sha512-TOTnFWSa4ronCdQTWfB8c5VI6DXcBEyDA4vbZnzkVAzSP90NpRPOPrvo2tEZxcGSlVIjBZew7rWgWyqkSwUT/Q==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@google-cloud/text-to-speech": "^4.0.3",
|
"@google-cloud/text-to-speech": "^4.0.3",
|
||||||
"@grpc/grpc-js": "^1.7.3",
|
"@grpc/grpc-js": "^1.7.3",
|
||||||
@@ -6888,9 +6888,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@jambonz/realtimedb-helpers": {
|
"@jambonz/realtimedb-helpers": {
|
||||||
"version": "0.5.5",
|
"version": "0.5.7",
|
||||||
"resolved": "https://registry.npmjs.org/@jambonz/realtimedb-helpers/-/realtimedb-helpers-0.5.5.tgz",
|
"resolved": "https://registry.npmjs.org/@jambonz/realtimedb-helpers/-/realtimedb-helpers-0.5.7.tgz",
|
||||||
"integrity": "sha512-tQJfTqN1FtFfKR9ceBYuQ9yddCDshBGVI6v1N/IxOyhTywyueNFXg6JMIOx0Rci7UqIDhtcBjl5R64zWgTo04A==",
|
"integrity": "sha512-TOTnFWSa4ronCdQTWfB8c5VI6DXcBEyDA4vbZnzkVAzSP90NpRPOPrvo2tEZxcGSlVIjBZew7rWgWyqkSwUT/Q==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@google-cloud/text-to-speech": "^4.0.3",
|
"@google-cloud/text-to-speech": "^4.0.3",
|
||||||
"@grpc/grpc-js": "^1.7.3",
|
"@grpc/grpc-js": "^1.7.3",
|
||||||
|
|||||||
@@ -25,8 +25,8 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jambonz/db-helpers": "^0.7.3",
|
"@jambonz/db-helpers": "^0.7.3",
|
||||||
"@jambonz/realtimedb-helpers": "^0.5.5",
|
|
||||||
"@jambonz/http-health-check": "^0.0.1",
|
"@jambonz/http-health-check": "^0.0.1",
|
||||||
|
"@jambonz/realtimedb-helpers": "^0.5.7",
|
||||||
"@jambonz/stats-collector": "^0.1.6",
|
"@jambonz/stats-collector": "^0.1.6",
|
||||||
"@jambonz/time-series": "^0.2.5",
|
"@jambonz/time-series": "^0.2.5",
|
||||||
"@opentelemetry/api": "^1.2.0",
|
"@opentelemetry/api": "^1.2.0",
|
||||||
|
|||||||
@@ -56,6 +56,41 @@ test('\'gather\' test - google', async(t) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('\'gather\' test - default (google)', async(t) => {
|
||||||
|
if (!process.env.GCP_JSON_KEY) {
|
||||||
|
t.pass('skipping google tests');
|
||||||
|
return t.end();
|
||||||
|
}
|
||||||
|
clearModule.all();
|
||||||
|
const {srf, disconnect} = require('../app');
|
||||||
|
|
||||||
|
try {
|
||||||
|
await connect(srf);
|
||||||
|
// GIVEN
|
||||||
|
let verbs = [
|
||||||
|
{
|
||||||
|
"verb": "gather",
|
||||||
|
"input": ["speech"],
|
||||||
|
"timeout": 10,
|
||||||
|
"actionHook": "/actionHook"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
let from = "gather_success";
|
||||||
|
provisionCallHook(from, verbs);
|
||||||
|
// THEN
|
||||||
|
await sippUac('uac-gather-account-creds-success.xml', '172.38.0.10', from);
|
||||||
|
let obj = await getJSON(`http://127.0.0.1:3100/lastRequest/${from}_actionHook`);
|
||||||
|
t.ok(obj.body.speech.alternatives[0].transcript = 'I\'d like to speak to customer support',
|
||||||
|
'gather: succeeds when using default (google) credentials');
|
||||||
|
|
||||||
|
disconnect();
|
||||||
|
} catch (err) {
|
||||||
|
console.log(`error received: ${err}`);
|
||||||
|
disconnect();
|
||||||
|
t.error(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
test('\'gather\' test - microsoft', async(t) => {
|
test('\'gather\' test - microsoft', async(t) => {
|
||||||
if (!process.env.MICROSOFT_REGION || !process.env.MICROSOFT_API_KEY) {
|
if (!process.env.MICROSOFT_REGION || !process.env.MICROSOFT_API_KEY) {
|
||||||
t.pass('skipping microsoft tests');
|
t.pass('skipping microsoft tests');
|
||||||
|
|||||||
Reference in New Issue
Block a user