diff --git a/mod_google_transcribe/google_glue_v1.cpp b/mod_google_transcribe/google_glue_v1.cpp index 9b910ed..a4e18f4 100644 --- a/mod_google_transcribe/google_glue_v1.cpp +++ b/mod_google_transcribe/google_glue_v1.cpp @@ -236,6 +236,7 @@ static void *SWITCH_THREAD_FUNC grpc_read_thread(switch_thread_t *thread, void * 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"); + cJSON_AddStringToObject(json, "error_cause", "stream_response"); cJSON_AddStringToObject(json, "error", status.message().c_str()); char* jsonString = cJSON_PrintUnformatted(json); cb->responseHandler(session, jsonString, cb->bugname); @@ -339,9 +340,10 @@ static void *SWITCH_THREAD_FUNC grpc_read_thread(switch_thread_t *thread, void * cb->responseHandler(session, "no_audio", cb->bugname); } } - else { + else if (status.error_code() != 0) { cJSON* json = cJSON_CreateObject(); cJSON_AddStringToObject(json, "type", "error"); + cJSON_AddStringToObject(json, "error_cause", "stream_close"); cJSON_AddItemToObject(json, "error_code", cJSON_CreateNumber(status.error_code())); cJSON_AddStringToObject(json, "error_message", status.error_message().c_str()); char* jsonString = cJSON_PrintUnformatted(json); diff --git a/mod_google_transcribe/google_glue_v2.cpp b/mod_google_transcribe/google_glue_v2.cpp index 665ab1f..5e58c2f 100644 --- a/mod_google_transcribe/google_glue_v2.cpp +++ b/mod_google_transcribe/google_glue_v2.cpp @@ -349,6 +349,7 @@ static void *SWITCH_THREAD_FUNC grpc_read_thread(switch_thread_t *thread, void * else if (status.error_code() != 0) { cJSON* json = cJSON_CreateObject(); cJSON_AddStringToObject(json, "type", "error"); + cJSON_AddStringToObject(json, "error_cause", "stream_close"); cJSON_AddItemToObject(json, "error_code", cJSON_CreateNumber(status.error_code())); cJSON_AddStringToObject(json, "error_message", status.error_message().c_str()); char* jsonString = cJSON_PrintUnformatted(json);