siprec icon indicating copy to clipboard operation
siprec copied to clipboard

Whisper CLI provider fails on every live call

Open kristianhadberg opened this issue 1 month ago • 9 comments

I'm trying to configure IZI SIPREC to transcribe SIPREC calls at as-close-to realtime as possible. I've followed the documentation, but I have issue getting the STT provider to work. I'm using a locally running whisper model via docker, that is invoked via a simple HTTP wrapper. (I have also tried using a Scaleway Whisper API). The HTTP wrapper is seemingly never invoked (if i try to log a message at the start of http-wrapper, it never shows). I can invoke the script manually and it works.

I'm testing using a .sh script that places a SIPREC call, and forwards audio using the rtp_audio_sender.py script. The audio is being recorded just fine, so the SIPREC part works.

{"call_uuid":"[email protected]_leg0","level":"info","message":"Routing STT stream to provider","requested":"","resolved":"whisper","timestamp":"2026-11-03T10:59:58.522408878Z"}
{"attempt":1,"call_uuid":"[email protected]_leg0","level":"info","message":"Starting transcription","provider":"whisper","timestamp":"2026-11-03T10:59:58.522665352Z"}
{"call_uuid":"[email protected]_leg0","level":"info","message":"RTP timeout monitor exiting via ctx.Done()","timestamp":"2026-11-03T11:00:13.523787809Z"}
{"call_uuid":"[email protected]_leg0","level":"info","message":"RTP timeout monitor exited","timestamp":"2026-11-03T11:00:13.523967909Z"}
{"call_uuid":"[email protected]_leg0","circuit_name":"stt_whisper","component":"stt_circuit_breaker","duration":15006892726,"error":"whisper command failed: context canceled: ","level":"error","message":"STT provider failed","provider":"whisper","state":"closed","timestamp":"2026-11-03T11:00:13.52992884Z"}
{"attempt":1,"call_uuid":"[email protected]_leg0","duration_ms":15010,"error":true,"level":"info","message":"Transcription attempt completed","provider":"whisper","timestamp":"2026-11-03T11:00:13.532907772Z"}
{"attempt":1,"call_uuid":"[email protected]_leg0","error":"whisper command failed: context canceled: ","level":"warning","message":"STT provider failed, evaluating fallback options","provider":"whisper","timestamp":"2026-11-03T11:00:13.533284153Z"}
{"attempt":1,"audit":true,"audit_action":"transcription","audit_category":"stt","audit_outcome":"failure","call_id":"[email protected]_leg0","error":"whisper command failed: context canceled: ","fields.timestamp":"2026-11-03T11:00:13.533388418Z","level":"info","message":"audit.event","provider":"whisper","session_id":"[email protected]","span_id":"a39ee1bff92b390f","tenant":"unknown","timestamp":"2026-11-03T11:00:13.533428515Z","trace_id":"8af438bc18f366ed5014c20e9645f208","users":["Alice","Bob"]}

This is my config.yaml

network:
  host: "0.0.0.0"

  ports:
    - 5060

  rtp_port_min: 10000
  rtp_port_max: 20000

  rtp_timeout: 30s

http:
  port: 8080

recording:
  directory: "/app/recordings"
  combine_legs: true

logging:
  level: "info"
  format: "json"

async_stt:
  enabled: true

stt:
  supported_vendors:
    - whisper
  default_vendor: "whisper"
  whisper:
    enabled: true
    binary_path: "/usr/local/bin/whisper-http.sh"
    model: "base"
    output_format: "json"
    sample_rate: 8000
    channels: 1

Here is the .sh script:

#!/bin/sh
set -eu
SERVER="http://127.0.0.1:8081"
AUDIO_PATH="$1"
OUTPUT_DIR="."
FORMAT="json"
shift
while [ $# -gt 0 ]; do
  case "$1" in
    --output_dir)    OUTPUT_DIR="$2"; shift 2 ;;
    --output_format) FORMAT="$2"; shift 2 ;;
    *) shift ;;
  esac
done
BASE="$(basename "${AUDIO_PATH%.*}")"
curl -sf --connect-timeout 5 --max-time 280 -X POST "${SERVER}/inference" \
  -F "file=@${AUDIO_PATH}" \
  -F "response_format=${FORMAT}" \
  -o "${OUTPUT_DIR}/${BASE}.${FORMAT}"

kristianhadberg avatar Nov 03 '26 11:11 kristianhadberg

Let me look into it? which version are you using?

On Tue, Nov 3, 2026 at 6:14 AM Kristian Hadberg @.***> wrote:

kristianhadberg created an issue (loreste/siprec#47) https://github.com/loreste/siprec/issues/47

I'm trying to configure IZI SIPREC to transcribe SIPREC calls at as-close-to realtime as possible. I've followed the documentation, but I have issue getting the STT provider to work. I'm using a locally running whisper model via docker, that is invoked via a simple HTTP wrapper. (I have also tried using a Scaleway Whisper API). The HTTP wrapper is seemingly never invoked (if i try to log a message at the start of http-wrapper, it never shows). I can invoke the script manually and it works.

I'm testing using a .sh script that places a SIPREC call, and forwards audio using the rtp_audio_sender.py script. The audio is being recorded just fine, so the SIPREC part works.

@._leg0","level":"info","message":"Routing STT stream to provider","requested":"","resolved":"whisper","timestamp":"2026-11-03T10:59:58.522408878Z"} @._leg0","level":"info","message":"Starting transcription","provider":"whisper","timestamp":"2026-11-03T10:59:58.522665352Z"} @._leg0","level":"info","message":"RTP timeout monitor exiting via ctx.Done()","timestamp":"2026-11-03T11:00:13.523787809Z"} @._leg0","level":"info","message":"RTP timeout monitor exited","timestamp":"2026-11-03T11:00:13.523967909Z"} @._leg0","circuit_name":"stt_whisper","component":"stt_circuit_breaker","duration":15006892726 <(500)%20689-2726>,"error":"whisper command failed: context canceled: ","level":"error","message":"STT provider failed","provider":"whisper","state":"closed","timestamp":"2026-11-03T11:00:13.52992884Z"} @._leg0","duration_ms":15010,"error":true,"level":"info","message":"Transcription attempt completed","provider":"whisper","timestamp":"2026-11-03T11:00:13.532907772Z"} @._leg0","error":"whisper command failed: context canceled: ","level":"warning","message":"STT provider failed, evaluating fallback options","provider":"whisper","timestamp":"2026-11-03T11:00:13.533284153Z"} @._leg0","error":"whisper command failed: context canceled: @.***","span_id":"a39ee1bff92b390f","tenant":"unknown","timestamp":"2026-11-03T11:00:13.533428515Z","trace_id":"8af438bc18f366ed5014c20e9645f208","users":["Alice","Bob"]}

This is my config.yaml

network: host: "0.0.0.0"

ports: - 5060

rtp_port_min: 10000 rtp_port_max: 20000

rtp_timeout: 30s

http: port: 8080

recording: directory: "/app/recordings" combine_legs: true

logging: level: "info" format: "json"

async_stt: enabled: true

stt: supported_vendors: - whisper default_vendor: "whisper" whisper: enabled: true binary_path: "/usr/local/bin/whisper-http.sh" model: "base" output_format: "json" sample_rate: 8000 channels: 1

Here is the .sh script:

#!/bin/sh set -eu SERVER="http://127.0.0.1:8081" AUDIO_PATH="$1" OUTPUT_DIR="." FORMAT="json" shift while [ $# -gt 0 ]; do case "$1" in --output_dir) OUTPUT_DIR="$2"; shift 2 ;; --output_format) FORMAT="$2"; shift 2 ;; ) shift ;; esac done BASE="$(basename "${AUDIO_PATH%.}")" curl -sf --connect-timeout 5 --max-time 280 -X POST "${SERVER}/inference"
-F "file=@${AUDIO_PATH}"
-F "response_format=${FORMAT}"
-o "${OUTPUT_DIR}/${BASE}.${FORMAT}"

— Reply to this email directly, view it on GitHub https://github.com/loreste/siprec/issues/47?email_source=notifications&email_token=ABOBAMD3FFSY4FST57SXYFL5XG42NA5CNFSL4Z3JMQ5C6L3HNF2C22DVMIXUS43TOVSS6NRRHAYTIMRYGQ2DNJTSMVQXG33OVJZXKYTTMNZGSYTFMSSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOBAMBNBHMR2SP3GQOBMVL5XG42NAVCNFSNUABFKJSXA33TNF2G64TZHM4DGMBWGIZTIOBUHNEXG43VMU5TMMJYGE2DEOBUGQ3KC5QC . You are receiving this because you are subscribed to this thread.Message ID: @.***>

loreste avatar Nov 03 '26 13:11 loreste

1.3.1

kristianhadberg avatar Nov 03 '26 13:11 kristianhadberg

Thanks for the detailed report and the wrapper script — they helped track this down.

The fix is now on main in e6917abf85327e311e7d64bdc40d0e08400c251b. The circuit breaker was applying a short request timeout to the whole audio stream, which explains the failure around 15 seconds. Whisper could also receive an already-canceled context at call end, preventing the wrapper from running. Both paths are fixed: captured audio is finalized and transcription gets its own timeout after the call ends.

One detail worth clarifying: the Whisper CLI provider buffers the call before invoking the executable, including when that executable is an HTTP wrapper. You should now get a final transcript after the audio stream ends, but this provider won't produce partial transcripts during the call. For that, you'll need a streaming STT backend.

I've added regression tests for call-end cancellation, EOF handling, and timeouts, and updated the docs. The tests pass with the race detector, though I haven't tested against your particular Whisper server.

Could you try a build from the latest main and let me know whether your wrapper runs and produces the final transcript after hangup?

loreste avatar Nov 03 '26 13:11 loreste

I built the image with the changes and it works now. Thank you for the quick response

kristianhadberg avatar Nov 03 '26 15:11 kristianhadberg

thank you

loreste avatar Nov 03 '26 15:11 loreste

To add to this. Is it possible to just use the SIPREC part and somehow connect to recieve the audio packets "live"? Ultimately with the goal to build our own transcription pipeline and just use IZI to recieve the audio from the phone calls?

kristianhadberg avatar Nov 04 '26 11:11 kristianhadberg

Yes

On Wed, Nov 4, 2026, 6:47 AM Kristian Hadberg @.***> wrote:

kristianhadberg left a comment (loreste/siprec#47) https://github.com/loreste/siprec/issues/47#issuecomment-6629771730

To add to this. Is it possible to just use the SIPREC part and somehow connect to recieve the audio packets "live"? Ultimately with the goal to build our own transcription pipeline and just use IZI to recieve the audio from the phone calls?

— Reply to this email directly, view it on GitHub https://github.com/loreste/siprec/issues/47?email_source=notifications&email_token=ABOBAMDN4ARFULGXPADIRZT5XMJL7A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMNRSHE3TOMJXGMYKM4TFMFZW63VMON2GC5DFL5RWQYLOM5S2KZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-6629771730, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOBAME4Y2YDM4O3TI3FDEL5XMJL7AVCNFSNUABFKJSXA33TNF2G64TZHM4DGMBWGIZTIOBUHNEXG43VMU5TMMJYGE2DEOBUGQ3KC5QC . You are receiving this because you modified the open/close state.Message ID: @.***>

loreste avatar Nov 04 '26 15:11 loreste

Is there documentation on this? Sorry to bother you

kristianhadberg avatar Nov 09 '26 09:11 kristianhadberg

sorry I was out, there should be some docs in the projects

On Mon, Nov 9, 2026 at 4:26 AM Kristian Hadberg @.***> wrote:

kristianhadberg left a comment (loreste/siprec#47) https://github.com/loreste/siprec/issues/47#issuecomment-6736608790

Is there documentation on this? Sorry to bother you

— Reply to this email directly, view it on GitHub https://github.com/loreste/siprec/issues/47?email_source=notifications&email_token=ABOBAMGRJQTVVVSWLAT2O735YGES5A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMNZTGY3DAOBXHEYKM4TFMFZW63VMON2GC5DFL5RWQYLOM5S2KZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-6736608790, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOBAMGUDDFJX3BOYSOEMAD5YGES5AVCNFSNUABFKJSXA33TNF2G64TZHM4DGMBWGIZTIOBUHNEXG43VMU5TMMJYGE2DEOBUGQ3KC5QC . You are receiving this because you modified the open/close state.Message ID: @.***>

loreste avatar Nov 09 '26 23:11 loreste