allow azure stt custom speech endpoint id to be passed as property in recognizer

This commit is contained in:
Dave Horton
2022-10-05 21:57:14 +01:00
parent 8a2b2962f8
commit b2cac47d05
3 changed files with 11 additions and 2 deletions

View File

@@ -82,6 +82,7 @@ class TaskGather extends Task {
this.requestSnr = recognizer.requestSnr || false; this.requestSnr = recognizer.requestSnr || false;
this.initialSpeechTimeoutMs = recognizer.initialSpeechTimeoutMs || 0; this.initialSpeechTimeoutMs = recognizer.initialSpeechTimeoutMs || 0;
this.azureServiceEndpoint = recognizer.azureServiceEndpoint; this.azureServiceEndpoint = recognizer.azureServiceEndpoint;
this.azureSttEndpointId = recognizer.azureSttEndpointId;
} }
else { else {
this.hints = []; this.hints = [];
@@ -364,7 +365,10 @@ class TaskGather extends Task {
'AZURE_SUBSCRIPTION_KEY': api_key, 'AZURE_SUBSCRIPTION_KEY': api_key,
'AZURE_REGION': region 'AZURE_REGION': region
}); });
if (use_custom_stt && custom_stt_endpoint) { if (this.azureSttEndpointId) {
Object.assign(opts, {'AZURE_SERVICE_ENDPOINT_ID': this.azureSttEndpointId});
}
else if (use_custom_stt && custom_stt_endpoint) {
Object.assign(opts, {'AZURE_SERVICE_ENDPOINT_ID': custom_stt_endpoint}); Object.assign(opts, {'AZURE_SERVICE_ENDPOINT_ID': custom_stt_endpoint});
} }
} }

View File

@@ -497,6 +497,7 @@
"requestSnr": "boolean", "requestSnr": "boolean",
"initialSpeechTimeoutMs": "number", "initialSpeechTimeoutMs": "number",
"azureServiceEndpoint": "string", "azureServiceEndpoint": "string",
"azureSttEndpointId": "string",
"asrDtmfTerminationDigit": "string", "asrDtmfTerminationDigit": "string",
"asrTimeout": "number" "asrTimeout": "number"
}, },

View File

@@ -54,6 +54,7 @@ class TaskTranscribe extends Task {
this.requestSnr = recognizer.requestSnr || false; this.requestSnr = recognizer.requestSnr || false;
this.initialSpeechTimeoutMs = recognizer.initialSpeechTimeoutMs || 0; this.initialSpeechTimeoutMs = recognizer.initialSpeechTimeoutMs || 0;
this.azureServiceEndpoint = recognizer.azureServiceEndpoint; this.azureServiceEndpoint = recognizer.azureServiceEndpoint;
this.azureSttEndpointId = recognizer.azureSttEndpointId;
} }
get name() { return TaskName.Transcribe; } get name() { return TaskName.Transcribe; }
@@ -237,7 +238,10 @@ class TaskTranscribe extends Task {
'AZURE_SUBSCRIPTION_KEY': api_key, 'AZURE_SUBSCRIPTION_KEY': api_key,
'AZURE_REGION': region 'AZURE_REGION': region
}); });
if (use_custom_stt && custom_stt_endpoint) { if (this.azureSttEndpointId) {
Object.assign(opts, {'AZURE_SERVICE_ENDPOINT_ID': this.azureSttEndpointId});
}
else if (use_custom_stt && custom_stt_endpoint) {
Object.assign(opts, {'AZURE_SERVICE_ENDPOINT_ID': custom_stt_endpoint}); Object.assign(opts, {'AZURE_SERVICE_ENDPOINT_ID': custom_stt_endpoint});
} }
if (this.hints && this.hints.length > 0) { if (this.hints && this.hints.length > 0) {