Skip to content

Voice agents

A phone line for your voice agent.

An AI voice agent needs a few things from a phone call: clean audio at its own rate, a way to stop talking when the caller does, and the call's digits and transfers. Sipral gives it those from one process, with no media server.

What an agent needs from the call

Audio at the rate the service speaks

The call hands out and takes 16-bit PCM at 8, 16, 24 or 48 kHz, whatever codec the far end chose. G.711, G.722 and Opus are converted inside the library, both ways.

Barge-in that stops at once

The agent’s audio is paced a codec frame at a time with at most 40 ms queued, so when the caller starts talking the agent goes quiet within a frame.

Digits, transfer and the outcome

Keypad digits in both forms, a transfer the agent asks for passed to the PBX, and how the call ended told back to the PBX.

No media server in between

One process registers to the PBX, answers the calls and talks to the agent. No device, no audio thread to feed, many calls side by side.

Answering machines told apart

On the calls an agent places, the library tells a person from an answering machine and hears the beep: hang up, leave a message at the beep, or connect anyway, set per account.

Fast, and measured for a week

The first audio frame reaches the agent 31.5 ms after the INVITE, and the agent’s reply is on the wire 20.4 ms after it writes it. Seven days of calls against Asterisk: 3,337 calls, no error, memory flat.

Four ways to connect it

Direct connectors

A call joined to the realtime speech APIs of five voice-agent services over their WebSocket protocols, with reconnection and events. A new service is one small class.

Read the documentation

SIP bridge

For an agent that answers SIP itself: Sipral takes the PBX line and calls the agent, digits, transfer and outcome included. Run from one configuration file, an agent per account.

Read the documentation

Pipecat transport

A call as a Pipecat transport, so every speech service Pipecat supports is one pipeline away.

Read the documentation

Entirely on your machine

An example agent with no key and no account: whisper.cpp listens, a small model in Ollama answers, Pocket TTS speaks. Linux or Mac, no graphics card.

Read the documentation

The connectors, the bridge and the Pipecat transport are Python packages that ship in the repository with Sipral 1.2, over the sipral package from PyPI.

Hear it in five minutes

From a checkout of the repository, one command answers calls from any softphone, or on a PBX extension. With no key the call is answered by a local echo agent that plays your voice back, so the whole path is heard working; with a key for a realtime speech service, the same command answers with the real agent.

Or keep everything on one machine, with no key and no paid service: whisper.cpp listens, a small model in Ollama answers, and Kyutai's Pocket TTS speaks, loaded once and streamed into the call as it is made, on Linux as on a Mac. On an Apple M2 the caller hears the answer begin in under a second, 0.62 to 0.80 seconds after the question, against 3.4 to 5.1 seconds with macOS's own voice. It speaks English, French, German, Spanish, Portuguese, Italian and Dutch; for other languages, Romanian among them, the same agent uses a speech service instead.

terminal bash
python3 -m pip install sipral websockets
export PYTHONPATH=integrations/agents
python3 -m sipral_agents.demo