Handling connection errors in Speech SDK

Jasmin Hadzajlic 0 Reputation points
2024-05-29T13:16:12.9766667+00:00

Hi, we are using Speech SDK (version 1.35.0, C++) for "speech to text". We use SpeechRecognizer->StartKeywordRecognitionAsync. While running the application, we lose connection sometimes and sometimes internet connection is okay, but we get error response from server. Through Canceled event we get connection errors, sometimes ConnectionFailure (5), sometimes ServiceTimeout (6). How should we recover from these to have initial state again (StartKeywordRecognitionAsync running)? When we get Canceled event, sometimes it recovers automatically, sometimes doesn't. We tried to StopKeywordRecognitionAsync and start it again and that works, but sometimes we get weird results. We also tried to use Connection class manually, but that also didn't help. What is the best way of tracking state of connection to server and the best way of recovering from lost connection, server timeout, etc?

Thanks in advance.

Azure AI Speech
Azure AI Speech
An Azure service that integrates speech processing into apps and services.
1,516 questions
{count} votes