DvaarikVoice API

Integrations / SignalWire

SignalWire to an AI voice agent

Use SignalWire's Twilio-compatible media streams with an AI voice agent, without writing a second integration. Setu handles the SignalWire dialect and hands the voice engine plain PCM16, including the flush that makes barge-in work.

path /signalwire · 8 kHz · written from the vendor's published reference

What SignalWire sends and expects

Wire format
JSON text frames, base64 μ-law — Twilio-compatible
Sample rate
8 kHz
Flush playback on interruption
{"event":"clear","streamSid":…}

Carriers queue seconds of audio ahead of the caller. Without this frame, an interrupted caller keeps hearing a sentence the agent gave up on two seconds ago.

The trap

There is no separate adapter to learn. SignalWire's compatibility API speaks the Twilio dialect, so the same code path serves both — which also means the same no-query-string rule applies to the stream URL.

Wiring it up

Return compatibility-API XML from your voice webhook, exactly as you would for Twilio.

1 · run the bridge

your server
export DVAARIK_API_KEY=dvk_live_...
export AGENT_PROMPT="You are Riya, the receptionist at Sunrise Dental."
npx @dvaarik/setu

2 · point SignalWire at it

SignalWire config
<Response>
  <Connect>
    <Stream url="wss://your-host/signalwire" />
  </Connect>
</Response>

Then call the number. Audio goes to the Voice API, the agent answers from your prompt, and the reply streams back on the same socket — billed from your prepaid balance at ₹1.50 to ₹3.75 a minute depending on the voice grade. Nothing about your SignalWire account changes: the number, the trunk and the per-minute connectivity stay billed by SignalWire.

Prefer to write it yourself?

You do not have to use the bridge. The protocol reference is one REST call and one WebSocket, and Setu is MIT licensed — the twilio.ts adapter is about a hundred readable lines. Copy it, port it, or read it to find out what the vendor docs left out. There is also a complete Python and FastAPI implementation in the repository's examples folder, covering the whole protocol including barge-in.