DominaresTools

All tools / AI cost & reliability

callrelay

Answer phone calls with a Gemini Live voice agent on Twilio, with limits on call length, tokens and daily spend.

Buy callrelay for $99

One payment of $99, plus sales tax where it applies, and every future update. Delivered as a private GitHub repository you're invited to.

Runs inside Lina. Extracted from the audio bridge and cost limits of the phone line that answers Lina's own calls.

See it work

callrelay 1.1.2demo mode
python3 callrelay/examples/server.py --demo 2>/dev/null | grep -v "^   <"
1. A webhook without a valid Twilio signature is refused: HTTP 403.
2. The signed webhook is admitted. TwiML:
3. A stream without a valid token is closed before it is accepted (code 1008).
4. Caller audio reaches the agent (6 chunks, resampled to 16 kHz); it looks something up: 'Open Monday to Friday, 9 am to 5 pm. Closed on public holidays.'
5. Four minutes in, the watchdog has the agent warn the caller the call will end soon.
6. At five minutes the agent says goodbye, Twilio confirms it played (mark), and the stream closes. 4 audio frames went back to the caller as 8 kHz mu-law.

What the agent was asked to say, in order:
  - Greet the caller briefly and ask how you can help.
  - Let the caller know the call will end in about a minute, and ask if there is anything else you can quickly help with.
  - Thank the caller for calling, tell them the call is ending now, and say a brief goodbye.
Replaying the same stream URL is refused: the token was single-use.
Demo mode, not a live system: callrelay 1.1.2, run on 2026-10-05. The reference server's --demo, a simulated call with no network and no accounts; the single-use stream token in the TwiML is left out.

What it does

Tested building blocks and a small reference server for taking inbound calls with a Gemini Live voice agent on Twilio. A time limit (five minutes by default) runs during every call and a cap on calls at once is checked before one is admitted; a token budget and a daily spend ceiling, both off until you set them, add further limits, with spend priced from a table you supply. Building blocks for handing a call to a person, taking a voicemail and reporting what past calls cost are included.

Audio that doesn't click
Per-call resamplers convert Twilio's 8 kHz mu-law to 16 kHz PCM on the way in and 24 kHz on the way out, carrying filter state between chunks. Works on Python 3.10 to 3.14.
Only admitted calls reach the paid stream
Twilio webhook signatures are checked with the standard library, and the media WebSocket needs a short-lived, single-use token bound to the call. A bad token is refused before the socket is accepted.
Cost limits that fail closed
A time limit with a spoken warning before the hang-up, an optional token budget, a cap on calls at once and a daily spend ceiling. A ceiling set to something that isn't a number refuses calls instead of switching itself off.
Estimates from your own prices
Each call's cost is worked out from a price table you fill in, and the estimate says what it left out. callrelay ships no prices, so none go stale.
A Live bridge you can test
A session config with voice activity detection, barge-in and transcription, a parser for audio, transcripts, tool calls and usage, and an async bridge that keeps listening after the first turn. The core runs without google-genai.
Logs that don't leak callers
A logging filter masks emails, phone numbers, card numbers (even read out in groups) and ID numbers, and cuts long transcripts to a short prefix.
A reference server with a demo
examples/server.py handles the webhook, the media stream, barge-in, the watchdog, a spoken AI disclosure (on by default) and one example tool. --demo runs a whole simulated call with no network. The server does not use the routing pieces below; you wire those in.
Hand a call to a person
decide_transfer hands off only the kinds of caller you choose, and only when a number is set. It never dials the line the call came in on, the caller or your own line, and it recognises its own forward coming back. put_through_on_promise transfers once per call when the agent really promises to put the caller through, and offers a callback if the transfer is refused. The transfer is tested against a local stand-in, not live Twilio.
Voicemail and a fallback
Voicemail TwiML plays a recording notice and records the caller's message. callrelay fallback --serve is a static server for Twilio's fallback URL that reads, logs and echoes nothing, so a caller still hears something when your webhook is down.
A cost report
callrelay cost-report totals each day's cost over a window in your time zone from the spend file and recommends a daily spend limit: three times the busiest day, rounded up, never below a floor.

What you get

callrelay 1.1.2: the Python library, the callrelay command and a reference Starlette server with a runnable demo, with 593 automated tests.

A commercial license. Use it and change it in your own projects and your clients' projects. Don't share or resell the source. Read the license.

Every update. New versions land in the same repository; git pull to get them.

Requirements

Python 3.10 or newer. The core needs the standard library, plus audioop-lts on Python 3.13 or newer, which installs with it. The [server] extra adds Starlette and uvicorn for the reference server, and [gemini] adds google-genai for the Live connection. You bring your own Twilio and Gemini accounts.

How buying works

  1. Enter your GitHub username. You'll see the account before you pay, so you can check it's yours.
  2. Pay $99, plus any sales tax shown at checkout, on Stripe's checkout page.
  3. Accept the invitation GitHub emails you. Signed in as that account, you'll also find it at github.com/dominares-tools/callrelay/invitations. Invitations expire after 7 days; you can get a new one any time.
  4. Clone and install:
    git clone https://github.com/dominares-tools/callrelay.git

    Private repo: sign in to GitHub on this computer first. Run gh auth login and choose HTTPS, or give git a personal access token when it asks for a password. To use an SSH key instead, clone git@github.com:dominares-tools/callrelay.git.

    python3 -m venv .venv && . .venv/bin/activate
    pip install ./callrelay

Questions

Do I need GitHub?

Yes. Access is a read-only invitation to a private repository, sent to the GitHub account you choose.

Can I get a refund?

Yes, within 14 days, no questions asked. Access ends when the refund goes through. Refund policy.

Who takes the payment?

Payments are handled by Stripe, which works out sales tax. Your receipt and card statement show Link (LINK.COM*), Stripe's checkout service.

Something wrong?

Email support@dominares.org. Every buyer of a tool shares its repository, so support happens by email rather than in GitHub issues.