mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2026-10-04 02:04:18 +00:00
fix Speech credential test for azure (#322)
This commit is contained in:
@@ -613,7 +613,7 @@ router.get('/:sid/test', async(req, res) => {
|
|||||||
}
|
}
|
||||||
if (cred.use_for_stt) {
|
if (cred.use_for_stt) {
|
||||||
try {
|
try {
|
||||||
await testMicrosoftStt(logger, {api_key, region});
|
await testMicrosoftStt(logger, {api_key, region, use_custom_stt, custom_stt_endpoint_url});
|
||||||
results.stt.status = 'ok';
|
results.stt.status = 'ok';
|
||||||
SpeechCredential.sttTestResult(sid, true);
|
SpeechCredential.sttTestResult(sid, true);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -117,9 +117,10 @@ const testDeepgramStt = async(logger, credentials) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const testMicrosoftStt = async(logger, credentials) => {
|
const testMicrosoftStt = async(logger, credentials) => {
|
||||||
const {api_key, region} = credentials;
|
const {api_key, region, use_custom_stt, custom_stt_endpoint_url} = credentials;
|
||||||
|
const speechConfig = use_custom_stt ? sdk.SpeechConfig.fromEndpoint(
|
||||||
const speechConfig = sdk.SpeechConfig.fromSubscription(api_key, region);
|
new URL(custom_stt_endpoint_url), api_key) :
|
||||||
|
sdk.SpeechConfig.fromSubscription(api_key, region);
|
||||||
const audioConfig = sdk.AudioConfig.fromWavFileInput(fs.readFileSync(`${__dirname}/../../data/test_audio.wav`));
|
const audioConfig = sdk.AudioConfig.fromWavFileInput(fs.readFileSync(`${__dirname}/../../data/test_audio.wav`));
|
||||||
speechConfig.speechRecognitionLanguage = 'en-US';
|
speechConfig.speechRecognitionLanguage = 'en-US';
|
||||||
|
|
||||||
@@ -189,7 +190,7 @@ const testAwsStt = async(logger, getAwsAuthToken, credentials) => {
|
|||||||
const response = await client.send(command);
|
const response = await client.send(command);
|
||||||
return response;
|
return response;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.info({err}, 'testMicrosoftTts - failed to list voices for region ${region}');
|
logger.info({err}, 'testAwsStt - failed to list voices for region ${region}');
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -202,7 +203,8 @@ const testMicrosoftTts = async(logger, synthAudio, credentials) => {
|
|||||||
credentials,
|
credentials,
|
||||||
language: 'en-US',
|
language: 'en-US',
|
||||||
voice: 'en-US-JennyMultilingualNeural',
|
voice: 'en-US-JennyMultilingualNeural',
|
||||||
text: 'Hi there and welcome to jambones!'
|
text: 'Hi there and welcome to jambones!',
|
||||||
|
renderForCaching: true
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user