Offline, self-hosted voicemail-to-text for PBX systems. Send a voicemail file,
get the transcript delivered to your webhook. Powered by whisper.cpp. No cloud,
no GPU, MIT-licensed.
It listens to the message, and calls your automation back with the text.
Why: PBX systems like 3CX and Yeastar leave voicemails as audio files. This service transcribes them locally and hands the text to your automation platform (built for Activepieces' wait-for-webhook, works with anything).
- Fully offline transcription (
whisper.cpp, CPU-only). - Single small container; SQLite queue; one job at a time.
- Multipart upload in, signed webhook out.
- Handles telephony WAV (PCM/ADPCM) and MP3 via ffmpeg normalisation.
- Multilingual model by default — good with te reo Māori names mixed into English.
- Auto-generated secrets on first boot; audio deleted after transcription; 1-hour retention.
docker run -d --name echoback \
-p 8080:80 -v echoback_data:/data \
ghcr.io/attunesolutions/echoback:latest
docker logs echoback # grab the one-time secretsThe first boot prints both secrets once:
================ SAVE THESE — SHOWN ONCE ================
API_TOKEN: k7Qp.... (use as: Authorization: Bearer <token>)
WEBHOOK_SECRET: 9fA2.... (verify X-Signature with this)
========================================================
Front it with a reverse proxy for HTTPS, then POST a voicemail:
curl -X POST https://voicemail.example.com/jobs \
-H "Authorization: Bearer $API_TOKEN" \
-F "file=@voicemail.wav" \
-F "callback_url=https://your-activepieces/resume/abc123"{
"job_id": "b3f1c2a7-9d4e-4f8a-8c11-2e6d5a0b1234",
"job_ref": null,
"status": "queued",
"status_url": "/jobs/b3f1c2a7-9d4e-4f8a-8c11-2e6d5a0b1234"
}The transcript is POSTed to your callback_url when ready.
docker-compose.yml is a convenience wrapper around the same
container — nothing about the service needs it. Configuration comes from .env:
cp .env.example .env # edit, then:
docker compose up -dTwo things worth knowing before you edit that file:
-
.envreaches the container only because of theenv_file:entry. Compose loads.envautomatically for${VAR}substitution inside the compose file; that is a separate mechanism and passes nothing to the container. Values underenvironment:override.env, so keep configuration in one place. -
Swapping the named volume for a bind mount needs a
chown. The image prepares/datafor uid 10001, but a bind-mounted host directory keeps its own ownership and the container cannot write to it:PermissionError: [Errno 13] Permission denied: '/data/secrets.tmp'mkdir -p ./data && sudo chown -R 10001:10001 ./data
All endpoints require Authorization: Bearer <API_TOKEN> except GET /health.
multipart/form-data:
| Field | Required | Description |
|---|---|---|
file |
yes | Voicemail audio, any codec ffmpeg can decode. Max MAX_UPLOAD_MB (25). |
callback_url |
yes | Absolute http(s) URL the result is POSTed to. Must pass the address policy (below). |
model |
no | Model override from MODEL_ALLOWLIST. Defaults to MODEL_DEFAULT. |
job_ref |
no | Your correlation id, echoed back verbatim. Max 256 characters. |
vocabulary_hint |
no | Words the transcriber should expect (see below). Max 1000 characters. Defaults to VOCABULARY_HINT. |
Responses: 202 queued · 400 bad field / unknown model / malformed URL ·
401 bad token · 413 file over the cap · 429 queue at MAX_QUEUE_DEPTH.
Errors are {"error": {"code": "...", "message": "..."}}. Codes:
MISSING_FILE, EMPTY_FILE, INVALID_CALLBACK_URL, CALLBACK_HOST_NOT_ALLOWED,
MODEL_NOT_ALLOWED, INVALID_JOB_REF, INVALID_VOCABULARY_HINT, UNAUTHORIZED,
PAYLOAD_TOO_LARGE, QUEUE_FULL.
status_url is a path by default and an absolute URL when HOST_URL is set.
The service POSTs to whatever URL you give it, so an unrestricted callback_url is
a server-side request forgery primitive for anyone holding the API token. The
policy:
- Allowed: any public address, and private LAN ranges (
10.x,192.168.x,172.16–31.x) — a self-hosted Activepieces next to this service is the expected receiver. - Refused (
400 CALLBACK_HOST_NOT_ALLOWED): loopback (127.0.0.0/8,::1), link-local (169.254.0.0/16,fe80::/10— this is what blocks the cloud metadata endpoint), unspecified, multicast, and reserved addresses. URLs with embedded credentials are refused too. - Hostnames are resolved and every address they resolve to must pass, so a DNS name pointing at a blocked address is refused. A host that cannot be resolved is refused rather than accepted on faith.
CALLBACK_ALLOWED_HOSTSnarrows this to a named set. A leading dot matches subdomains:.example.comadmitsflows.example.com. The address policy still applies on top — allow-listing a host does not license it to point at loopback.HOST_URL, when set, also refuses acallback_urlaimed back at this service.
Resolution happens at submission. A host that changes its DNS answer afterwards (rebinding) is not re-checked at delivery time — the bearer token remains the primary trust boundary.
The hint is passed to whisper as the initial prompt. It biases decoding towards words it contains — no training, no model changes, and no guarantee. Two things belong in it:
- Domain vocabulary the caller is likely to use — the terms, product names, and jargon your organisation says out loud but a general model spells wrong.
- A handful of proper nouns you already expect for this specific call, such as the one or two account or contact names you resolved from the caller ID before submitting the job.
Send a shortlist, not your whole database. Whisper truncates the prompt at about 224 tokens (≈900 characters), so a long list loses its tail — and a pile of unrelated names dilutes the bias and invites the model to hallucinate one that was never said. A useful hint reads like a fragment of domain speech, not a data dump.
invoice, purchase order, back-order, RMA, dispatch; Acme Holdings, A. Patel
The hint is stored on the job row for the retention window and handed to the
engine. It is never returned by GET /jobs/{id}, included in the webhook, or
written to logs: it typically carries personal data, and echoing it back would
widen exposure for no benefit.
A debug and reconciliation fallback; the webhook is the primary delivery path.
Works only inside the retention window — afterwards the row is purged and this
returns 404.
{
"job_id": "b3f1c2a7-...",
"job_ref": "vm-2026-08-01-0042",
"status": "done",
"text": "Hi, it's Aroha calling from ...",
"model": "small",
"duration_ms": 30120,
"created_at": "2026-08-01T09:15:03Z",
"completed_at": "2026-08-01T09:15:11Z",
"delivered_at": "2026-08-01T09:15:12Z",
"error": null
}completed_at is when transcription finished; delivered_at is when your receiver
acknowledged the webhook, and is null until then.
status is one of:
| Status | Meaning |
|---|---|
queued |
Accepted, waiting for the worker. |
processing |
Being normalised and transcribed. |
transcribed |
Transcript ready and returned here, but the webhook is not yet acked. |
done |
Transcript delivered — your receiver answered 2xx. |
failed |
Transcription failed; error is populated. |
callback_failed |
Result exists, delivery gave up after WEBHOOK_ATTEMPTS. |
text is populated for transcribed, done, and callback_failed. If you poll
this endpoint rather than waiting for the webhook, treat transcribed the same as
done.
No auth. Suitable as a container health check.
{
"status": "ok",
"queue_depth": 0,
"worker": "idle",
"model_default": "small",
"engine": "ready",
"version": "1.0.0"
}worker is idle, busy, or stopped; stopped means the background loop is no
longer running and status reports degraded. engine is ready or down.
engine is ready once the resident whisper-server is up, down if it failed
to start — jobs processed while it is down fail with ENGINE_UNAVAILABLE.
On a terminal transcription state the service POSTs JSON to callback_url with
headers X-Signature: sha256=<hex>, X-Job-Id and User-Agent: echoback/<version>.
Success:
{
"job_id": "b3f1c2a7-...",
"job_ref": "vm-2026-08-01-0042",
"status": "done",
"text": "Hi, it's Aroha calling from ...",
"model": "small",
"duration_ms": 30120,
"completed_at": "2026-08-01T09:15:11Z",
"error": null
}Failure — always sent, so a waiting flow branches instead of hanging:
{
"job_id": "b3f1c2a7-...",
"job_ref": "vm-2026-08-01-0042",
"status": "failed",
"text": null,
"model": "small",
"duration_ms": null,
"completed_at": "2026-08-01T09:15:07Z",
"error": {
"code": "AUDIO_DECODE_FAILED",
"message": "ffmpeg could not decode the uploaded file"
}
}Failure codes: AUDIO_DECODE_FAILED, AUDIO_MISSING, MODEL_UNAVAILABLE,
ENGINE_UNAVAILABLE, TRANSCRIPTION_FAILED.
Delivery is acknowledged. Only a 2xx from your receiver counts as delivered —
a job becomes done when you confirm receipt, not when the transcript is produced.
Redirects are not followed, so a 3xx is treated as a failed attempt, as is any
4xx/5xx, connection error, or timeout.
Retries. A failed attempt is retried up to WEBHOOK_ATTEMPTS times — 8 by
default — with the delay doubling from WEBHOOK_BACKOFF: 2s, 4s, 8s, 16s, 32s, 64s
and 128s between attempts, so eight attempts span just over four minutes. That is
sized to outlast a receiver restarting, not a receiver being down. After the last
attempt the job becomes callback_failed; the transcript stays fetchable from
GET /jobs/{job_id} until the retention window closes.
Duplicates. If the container restarts between your 2xx and the ack being
recorded, the same result is delivered again. Deduplicate on job_id.
import hashlib, hmac
def valid(secret: str, raw_body: bytes, header: str) -> bool:
expected = "sha256=" + hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, header or "")Sign over the raw request body, not a re-serialised copy.
This needs a small custom piece. Nothing on the flow canvas can both mint a resume
URL and hand you the callback body: the Approval piece's Wait for Approval
discards everything except a query parameter, and Respond and Wait for Next
Webhook only surfaces its resume URL to the caller of a /sync webhook. One
custom action does the whole exchange.
The action runs twice — once to submit, once when the callback resumes it:
- Submit. Create a
WEBHOOKwaitpoint, build its resume URL, POST the voicemail to/jobswith that URL ascallback_url, then pause. Pausing releases the Activepieces worker and stops the wait counting againstAP_FLOW_TIMEOUT_SECONDS, so a slow queue costs nothing. - Resume. Echoback POSTs the result and the run wakes up. Read
job_idfrom the callback body and ignore the rest of it. - Re-fetch.
GET /jobs/{job_id}with the API token, and use that as the transcript. Raise on any status other thandoneortranscribedso the step fails visibly and honours the flow's retry and continue-on-failure settings.
Step 3 is the part worth keeping. The Activepieces resume endpoint is unauthenticated by design — the URL is the capability — so a body arriving there is only as trustworthy as that URL is secret. Re-fetching over the authenticated API means a leaked resume URL can wake the flow but cannot dictate what it thinks was said. Treat the callback as a doorbell, not a delivery.
Keep the API token in the piece's own connection (PieceAuth.SecretText), which
Activepieces encrypts at rest. The stock HTTP piece cannot do this — OAuth2 is its
only connection type — so a bearer token configured there would sit in the flow
JSON in plain text.
Two things to get right before the first run:
AP_FRONTEND_URLmust be the externally reachable URL. Resume URLs are built from it, and itslocalhostdefault is loopback, which this service refuses outright with400 CALLBACK_HOST_NOT_ALLOWED.- Set
CALLBACK_ALLOWED_HOSTSto the Activepieces host. Every resume URL shares one origin, so there is no reason to leave the callback target open.
If delivery fails every attempt the run stays paused until
AP_PAUSED_FLOW_TIMEOUT_DAYS elapses — echoback has stopped trying, and nothing
will wake it. The transcript is still fetchable until retention closes.
A known upstream quirk: calling a resume URL after a piece has already failed can let the flow continue past the failed step. Echoback always sends an explicit
status(and anerrorobject on failure), so branch onstatus == "done"and treat everything else as the failure path.
| Variable | Default | Description |
|---|---|---|
PORT |
80 |
HTTP listen port. TLS is expected to be terminated upstream. |
HOST_URL |
unset | Public URL of this service, as fronted by your proxy (e.g. https://voicemail.example.com). Makes status_url absolute and blocks self-directed callbacks. |
CALLBACK_ALLOWED_HOSTS |
unset | Comma-separated hosts callback_url may target. Unset = any host that passes the address policy. Leading dot matches subdomains. |
MAX_QUEUE_MB |
2048 |
Total queued audio on disk before POST /jobs returns 429. |
MODEL_DEFAULT |
small |
Default whisper model when none supplied. |
MODEL_ALLOWLIST |
see below | Comma-separated allowed model names. |
MAX_UPLOAD_MB |
25 |
Upload size cap. |
MAX_QUEUE_DEPTH |
1000 |
Queue depth at which POST /jobs returns 429. |
RETENTION_MINUTES |
60 |
How long a completed job row is kept before purge. |
WEBHOOK_ATTEMPTS |
8 |
Max webhook delivery attempts. |
WEBHOOK_BACKOFF |
2 |
Base backoff seconds (doubles each attempt). |
API_TOKEN |
generated | Override to supply your own bearer token. |
WEBHOOK_SECRET |
generated | Override to supply your own HMAC secret. |
ROTATE_SECRETS |
false |
Force secret regeneration on boot. |
DATA_DIR |
/data |
Volume mount for jobs.db, secrets, and temp audio. |
LOG_LEVEL |
info |
Logging verbosity. |
VOCABULARY_HINT |
unset | Service-wide default hint, used when a job sends none. |
| MAX_VOCABULARY_HINT_CHARS | 1000 | Cap on vocabulary_hint; longer values are rejected. |
Copy .env.example to .env for a documented starting point —
.env is gitignored, the template is not, so real secrets never get committed.
Default MODEL_ALLOWLIST: tiny, base, small, medium and their .en
variants. MODEL_DEFAULT must be a member of the allow-list.
Engine wiring, rarely changed: MODEL_DIR (/models), WHISPER_SERVER_BIN,
WHISPER_CLI_BIN, WHISPER_HOST, WHISPER_PORT (8910), WHISPER_THREADS
(0 = let whisper.cpp decide), WHISPER_STARTUP_TIMEOUT,
WHISPER_REQUEST_TIMEOUT, FFMPEG_BIN, WEBHOOK_TIMEOUT,
SWEEP_INTERVAL_SECONDS.
TLS is deliberately not handled in-container: front the service with a reverse
proxy (Pangolin, Caddy, nginx) that terminates HTTPS and point it at
http://<host>:8080.
Weights are downloaded at build time and baked in, so runtime is fully offline.
The published image carries small only. To bake more:
docker build --build-arg MODELS="small medium" -t echoback:with-medium .Requesting an allow-listed model that is not baked in fails that job with
MODEL_UNAVAILABLE. The default model stays loaded in a resident
whisper-server child process; a non-default model override is transcribed with
a one-shot whisper-cli run, which is slower but keeps memory to one resident
model.
- Uploaded audio is deleted from disk immediately after transcription, success or failure.
- The job row (including the transcript) is purged
RETENTION_MINUTESafter completion. That window exists only so the status endpoint and webhook retries work. - Logs carry
job_id, status, timings and error codes — never audio or transcript text.
- Concurrency is 1 by design. Bursts queue up in FIFO order;
MAX_QUEUE_DEPTHis the backstop that keeps a runaway PBX from filling the disk. - Crash recovery: a job left
processingby a container that died is reset toqueuedon the next start and retried. - Secrets live in
DATA_DIR/secrets.json(mode 600), never in the image. EnvAPI_TOKEN/WEBHOOK_SECRETtake precedence and are not written to disk. SetROTATE_SECRETS=truefor one boot to regenerate and reprint. - The container runs as an unprivileged user (uid 10001) with
CAP_NET_BIND_SERVICEso the defaultPORT=80still binds. If your runtime drops capabilities, setPORTabove 1024. DATA_DIRmust be writable by uid 10001. A named volume inherits that from the image and needs nothing; a bind mount keeps the host directory's ownership and must bechown 10001:10001'd first, or boot fails onsecrets.tmpwithPermission denied.
uv venv && uv pip install -e ".[dev]" # or: python -m venv .venv && pip install -e ".[dev]"
.venv/bin/pytest -q # unit tests, no ffmpeg or models needed
.venv/bin/ruff check . && .venv/bin/ruff format --check .The test suite stubs the ffmpeg and whisper.cpp binaries, so it runs anywhere. The
docker-build CI job exercises the real engine end to end: it builds the image with
the tiny model, submits an 8 kHz telephony-style WAV, and verifies the signed
callback.
Synthetic audio proves the pipeline works; it says nothing about how well the model
handles your actual callers. Drop real voicemails into tests/samples/ — the
directory is gitignored, so recordings never get committed — and run them through
the real engine:
./scripts/transcribe-samples.sh # uses the built image; no local deps
MODEL=medium ./scripts/transcribe-samples.sh # needs that model baked into the image
pytest tests/test_samples.py -s # uses local ffmpeg + whisper.cpp insteadEach prints the file, audio duration, transcription time and transcript, so you can compare models on the same recordings. The pytest route skips itself when the binaries or weights are not on the machine. The same CLI works on any file:
python -m echoback.transcribe --model small --json voicemail.mp3Run the service locally against real binaries with:
DATA_DIR=./data MODEL_DIR=./models PORT=8080 .venv/bin/python -m echoback.mainThe git tag is the version. Nothing in the tree carries a version number — don't go looking for one to bump:
git tag -a v1.2.3 -m "Echoback 1.2.3"
git push origin v1.2.3That publishes 1.2.3, 1.2 and latest to GHCR for both architectures, stamps
the version into the package (so /health and the webhook User-Agent report it),
and opens the GitHub Release with the pull command and image digest.
hatch-vcs derives the version from the tag at build time. The image build is the
one exception: .dockerignore keeps .git out of the build context, so the release
workflow passes the version it read from the tag in as a build argument. Pushes to
main are not releases — they only move edge and sha-<commit>, and their
packages are versioned 0.0.0+sha.<commit>.
MIT — see LICENSE and THIRD_PARTY_LICENSES. ffmpeg is invoked as a CLI subprocess only, never linked, so its LGPL/GPL terms do not extend to this code.