fixed google asr max duration exceeded or no audio raised jambonz_transcribe::error (#120)

Co-authored-by: root <root@af6633a5cfe8>
This commit is contained in:
Hoan Luu Huu
2024-10-03 19:04:40 +07:00
committed by GitHub
parent 3f06a24b5d
commit f7f8f52283

View File

@@ -233,6 +233,10 @@ static void *SWITCH_THREAD_FUNC grpc_read_thread(switch_thread_t *thread, void *
auto speech_event_type = response.speech_event_type();
if (response.has_error()) {
Status status = response.error();
//error 11 is handled in finished session, avoid sending jambonz_transcribe::error event for this here.
if (11 == status.code()) {
continue;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "grpc_read_thread: error %s (%d)\n", status.message().c_str(), status.code()) ;
cJSON* json = cJSON_CreateObject();
cJSON_AddStringToObject(json, "type", "error");