Compare commits

...

2 Commits

Author SHA1 Message Date
Dave Horton 06ab877f68 fix aws race condition when 2 start transcribes are sent at the same instant 2024-03-11 13:57:15 -04:00
Hoan Luu Huu 92dd3fc854 enable azure language identification mode (#15)
Signed-off-by: Quan HL <quan.luuhoang8@gmail.com>
2024-03-08 10:12:33 -05:00
2 changed files with 8 additions and 1 deletions
+1 -1
View File
@@ -326,8 +326,8 @@ static void *SWITCH_THREAD_FUNC aws_transcribe_thread(switch_thread_t *thread, v
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "transcribe_thread: Error allocating streamer\n");
return nullptr;
}
if (!cb->vad) pStreamer->connect();
cb->streamer = pStreamer;
if (!cb->vad) pStreamer->connect();
pStreamer->processData(); //blocks until done
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "transcribe_thread: stopping cb %p\n", (void *) cb);
@@ -135,6 +135,13 @@ public:
properties.SetProperty(PropertyId::Speech_SegmentationSilenceTimeoutMs, segmentationInterval);
}
//https://learn.microsoft.com/en-us/azure/ai-services/speech-service/language-identification?tabs=once&pivots=programming-language-cpp#at-start-and-continuous-language-identification
const char* languageIdMode = switch_channel_get_variable(channel, "AZURE_LANGUAGE_ID_MODE");
if (languageIdMode) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(psession), SWITCH_LOG_DEBUG, "setting SpeechServiceConnection_LanguageIdMode to %s \n", languageIdMode);
properties.SetProperty(PropertyId::SpeechServiceConnection_LanguageIdMode, languageIdMode);
}
// recognition mode - readonly according to Azure docs:
// https://docs.microsoft.com/en-us/javascript/api/microsoft-cognitiveservices-speech-sdk/propertyid?view=azure-node-latest
/*