Docs / API reference

WebRTC 3 endpoints

Live voice calls API

Check live browser-call availability, negotiate WebRTC audio sessions and receive real-time speech events.

GET /api/live/status Session required · 200 OK

Returns live voice readiness, supported languages and the current per-minute rate in paise.

curl -s -b cookies.txt https://dhvani.aware.co.in/api/live/status
{
  "ready": true,
  "reason": "",
  "languages": ["Hindi", "Hinglish", "English"],
  "price_per_minute_paise": 700
}
POST /api/live/offer Session required · 200 OK

Exchanges a WebRTC SDP offer for an answer and starts the real-time voice session. Returns 402 if a business workspace has less than 1 minute of wallet balance, or 503 if the language or voice service is unavailable.

FieldTypeNotes
sdpstringRequired, 10 to 20,000 chars.
typestringUsually "offer".
agent_idstringTarget agent ID (`404` if missing).
languagestringOne of Hindi, Hinglish, or English.
pc_id, restart_pcstring?, bool?Optional WebRTC peer connection ID and restart flag.
{
  "sdp": "v=0\r\n...",
  "type": "answer",
  "pc_id": "conn-...",
  "max_seconds": 180,
  "demo": true
}
PATCH /api/live/offer Session required · 200 OK

Delivers trickle ICE candidates to an active WebRTC peer connection.

{
  "pc_id": "conn-...",
  "candidates": [
    {"candidate": "candidate:...", "sdp_mid": "0", "sdp_mline_index": 0}
  ]
}
{"ok": true}

Data channel events

Clients open a WebRTC data channel named chat (ordered: true), send an initial rtvi-ai client-ready message, and receive server JSON events with label: "rtvi-ai":

Event typeMeaning
user-started-speakingCaller audio activity detected.
bot-started-speakingAgent started speaking (barge-in supported).
bot-stopped-speakingAgent finished speaking; caller's turn.
user-transcriptionFinal recognized caller transcript when data.final is true.
bot-outputStreamed spoken agent text when data.spoken is true.

Call recording and billing

Completed calls are logged automatically to the workspace call history. Demo calls are free and capped at 180 seconds; business workspace calls are capped up to 900 seconds (or available wallet balance) and billed per started minute.