APIPython · FastAPI · TwiML

A self-hosted, Twilio-compatible SMS & Voice API.

A self-hosted, open-source programmable SMS and Voice API that mirrors Twilio’s REST shape. Build and test messaging, TwiML voice flows, and signed webhooks locally against an offline simulator, then plug in SMTP, SIP, or a carrier later.

Built for: Developers and AI-agent builders who want a local or self-hosted Twilio-compatible control plane with zero per-message dev costs.

Recorded tour of the Relaycomm web console (Messages, Calls & TwiML, Webhooks, and Simulator & Adapters tabs).Run with Docker Compose ↗
  • Twilio REST shape/2010-04-01/Accounts/{AccountSid} with SM…, CA…, RE… SIDs
  • Signed webhooksHMAC-SHA1 matching X-Twilio-Signature + X-Relaycomm-Signature
  • 4 adapter modessimulator (default offline), smtp_gateway, sip_stub, and optional passthrough
  • 12 passing testsVerified via pytest across auth, CRUD, TwiML verbs, XXE protection, and adapters
Problem & solution

Develop and test voice & SMS flows without burning carrier fees.

The problem

Every test run costs credits.

Testing TwiML menus, <Gather> callbacks, and HMAC webhook verification usually requires live phone numbers, ngrok tunnels, and paid carrier credits on every test run.

The fix

One container, fully offline.

A single FastAPI + SQLite container gives you Basic-Auth REST endpoints, an offline TwiML interpreter with SimulatedDigits, signed callback logs, and a built-in web console.

Verified capabilities

What the code actually does.

Messages API

POST / GET / DELETE Messages with segment counting and To / From filters.

Calls API

Calls plus Trace.json and Recordings.json.

Constant-time auth

HTTP Basic Auth with path AccountSid enforcement.

Hardened TwiML engine

Parsed with defusedxml (XXE blocked, max redirect depth 10). Supports <Say>, <Play>, <Gather>, <Dial>, <Record>, <Pause>, <Redirect>, <Hangup/>.

Signed callbacks

Signs status, action, and inbound callbacks, logged in SQLite WAL storage.

Adapters & one-command run

simulator (100% offline), smtp_gateway (Mailpit or carrier email-to-SMS), sip_stub (Asterisk ARI / FreeSWITCH ESL payloads) + optional Telnyx/Vonage passthrough. Ships with a Dockerfile and docker compose up --build.

How it works

Local first, carrier later.

  1. Run it

    docker compose up --build, or Python 3.11+ on your own machine or server.

  2. Point your code at it

    Use the Twilio-shaped REST paths and SIDs; test TwiML flows against the offline simulator.

  3. Verify webhooks

    Callbacks are HMAC-signed, so your handlers can check X-Twilio-Signature.

  4. Attach a carrier later

    Swap in smtp_gateway, sip_stub, or a passthrough adapter when you’re ready.

Honest scope

Important limitations

  • Relaycomm is an independent open-source MIT project, not a Twilio product.
  • It does not reach real public telephone numbers unless you attach and configure a carrier or SIP trunk; that path is not configured out of the box.
  • No public hosted instance is deployed; run it locally or on your own server via Python 3.11+ or Docker Compose.
FAQ

Questions, answered plainly.

Is this affiliated with Twilio?

No. Relaycomm is an independent MIT-licensed project that mirrors Twilio’s REST shape.

Can it send real texts or place real calls?

Not out of the box. Real phone numbers require attaching and configuring a carrier or SIP trunk.

Is there a hosted version?

No. You run it locally or on your own server.

What’s tested?

12 pytest tests across auth, CRUD, TwiML verbs, XXE protection, and adapters.

Setup help

Integrate or host Relaycomm.

Free and MIT-licensed on GitHub. Need help wiring a custom SIP trunk, agent telephony workflow, or self-hosted deployment? Tell me what you’re building below.

  1. 1Send the form — about 30 seconds — or email if you prefer. Kevin reads every one.
  2. 2Kevin reads it and replies personally.
  3. 3We agree scope in writing before any work starts.

Kevin replies within 1 business day. Prefer email? kfairley9999@gmail.com

Get setup help