drachtio/drachtio-freeswitch-modules

Better deepgram error reporting

davehorton opened this issue · 0 comments

If an invalid model/language combination is specified, deepgram rejects the connection request and (probably) provides some error info in the HTTP non-success response, but all mod_deepgram__transcribe logs is that the HS upgrade failed, e.g.

2023-04-26 12:32:00.805091 [DEBUG] dg_transcribe_glue.cpp:265 path: /v1/listen?tier=base&model=conversationalai&language=es&interim_results=true&encoding=linear16&sample_rate=8000
2023-04-26 12:32:00.805091 [DEBUG] dg_transcribe_glue.cpp:306 (1) no resampling needed for this call
2023-04-26 12:32:00.805091 [DEBUG] dg_transcribe_glue.cpp:309 (1) fork_data_init
2023-04-26 12:32:00.805091 [DEBUG] dg_transcribe_glue.cpp:381 connecting now
2023-04-26 12:32:00.805091 [DEBUG] dg_transcribe_glue.cpp:383 connection in progress
2023-04-26 12:32:00.805091 [DEBUG] mod_deepgram_transcribe.c:41 Got SWITCH_ABC_TYPE_INIT.
2023-04-26 12:32:00.805091 [DEBUG] switch_core_media_bug.c:970 Attaching BUG to sofia/drachtio_mrf/nobody@10.12.3.200:5060
2023-04-26 12:32:00.805091 [DEBUG] mod_deepgram_transcribe.c:98 added media bug for dg transcribe
2023-04-26 12:32:00.825081 [DEBUG] switch_core_io.c:448 Setting BUG Codec PCMA:8
2023-04-26 12:32:01.185081 [NOTICE] dg_transcribe_glue.cpp:223 connection failed: HS: ws upgrade response not 101

We should log more details from the http response and if a header or reason is provided send that back to the calling application