Docs / Platform

Telephony

Most of the people Waridi is built for will meet it on a phone call. This page covers putting an agent on a phone number over SIP, connecting from a browser or app over WebRTC, and streaming raw call audio yourself.

Audio on phone lines

Phone networks carry narrowband audio. Use these settings for anything that touches a phone line:

Setting Value
Codec G.711 μ-law (mulaw, PCMU). A-law (PCMA) is accepted over SIP
Sample rate 8000 Hz, mono
Frame size 20 ms (160 bytes) recommended
TTS output format: "mulaw", sample_rate: 8000
STT / stream input encoding: "mulaw", sample_rate: 8000

Sikia is trained on real narrowband call audio, so there is no need to upsample before you send it.

SIP

Every agent gets a SIP URI when it is created:

sip:agt_01J9ZB4X7N@sip.waridi.io

Point an inbound route on your SIP trunk or PBX at that URI. Calls are answered by the agent with its greeting.

Detail Value
Transport TLS on port 5061 (recommended), UDP or TCP on 5060
Media SRTP when using TLS, RTP otherwise
Codecs offered PCMU, PCMA, Opus
Authentication IP allowlist or SIP digest credentials, set per agent in Studio
Transfers SIP REFER to the handoff number
DTMF RFC 2833. Keypresses reach your webhook as dtmf events

Caller ID, the dialled number and any custom SIP headers starting with X- are passed to your tool webhooks, so you can look up the caller before the agent speaks.

WebRTC in the browser

For web and mobile apps, your server creates a short-lived session and the client connects with WebRTC. Your secret API key never leaves your server.

# server.py: create a session and return the client secret to your frontend
from waridi import Waridi

client = Waridi()

def create_waridi_session():
    session = client.agents.sessions.create(agent_id="agt_01J9ZB4X7N")
    return {"client_secret": session.client_secret}  # expires in 10 minutes
// browser.ts: connect with the client secret from your server
import { WaridiCall } from "@waridi/sdk/web";

const { client_secret } = await fetch("/api/waridi-session").then((r) => r.json());

const call = await WaridiCall.connect({ clientSecret: client_secret });
call.on("transcript.final", (e) => console.log(e.role, e.text));

hangUpButton.onclick = () => call.end();
curl -X POST https://api.waridi.io/v1/agents/agt_01J9ZB4X7N/sessions \
  -H "Authorization: Bearer $WARIDI_API_KEY"

The browser SDK handles microphone permission, echo cancellation and Opus at 48 kHz.

Bring your own media stream

If your telephony provider can fork call audio to a WebSocket, send it straight to wss://api.waridi.io/v1/stream with encoding: "mulaw" and sample_rate: 8000. Reply audio comes back in the same format, ready to play into the call. See Streaming.

Phone numbers

During early access you bring your own numbers through your existing carrier or SIP provider. Local Tanzanian and Kenyan numbers provided by Waridi are planned for later. Tell us at hello@waridi.io if you need them.