DvaarikVoice API

Integrations / Vonage

Vonage to an AI voice agent

Bridge a Vonage Voice API call into an AI voice agent using raw binary WebSocket audio. Setu handles the Vonage dialect and hands the voice engine plain PCM16, including the flush that makes barge-in work.

path /vonage · 16 kHz by default · written from the vendor's published reference

What Vonage sends and expects

Wire format
Raw binary frames, linear PCM16 — no JSON envelope, no base64
Sample rate
16 kHz by default
Flush playback on interruption
{"action":"clear"}

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

The flush frame uses the key action, not event. Every other provider on this list uses event, so a shared handler written against Twilio silently never flushes on Vonage — the caller keeps hearing a sentence the agent abandoned two seconds earlier.

Wiring it up

Return an NCCO that connects the call to the bridge as a WebSocket endpoint.

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 Vonage at it

Vonage config
[{
  "action": "connect",
  "endpoint": [{
    "type": "websocket",
    "uri": "wss://your-host/vonage",
    "content-type": "audio/l16;rate=16000"
  }]
}]

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 Vonage account changes: the number, the trunk and the per-minute connectivity stay billed by Vonage.

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 vonage.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.