Channels and voice
Voice calls and realtime voice sessions in camelRun v2
Run realtime OpenAI and ElevenLabs voice calls (/v2/voice/calls) and agent voice sessions (/v2/voice/sessions) bridged to camelRun v2 agents.
camelRun v2 provides two realtime voice interfaces backed by OpenAI Realtime and ElevenLabs:
- Managed voice calls (
/v2/voice/calls): Durable call lifecycle (VoiceCallDO) with WebRTC SDP negotiation (OpenAI) or signed conversation URLs (ElevenLabs), speaker mapping, transcript ingestion, automatic metering, and voice webhooks. - Agent voice sessions (
/v2/voice/sessions): Lightweight realtime session broker hosted directly onAgentDOwith an HTTP and WebSocket tool bridge back to the agent's tools.
Managed voice calls (/v2/voice/calls)
Start a voice call (POST /v2/voice/calls)
Create a call linked to an existing agent (agt_...):
curl -s -X POST "https://run.camelai.com/v2/voice/calls" \
-H "Authorization: Bearer $CAMELRUN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"agent": "agt_0123456789abcdef",
"provider": "openai",
"voice": "alloy",
"subject": "user-42",
"instructions": "Answer concisely and use tools for account actions.",
"maxMinutes": 60,
"speakers": { "user-42": "Alice" },
"sdp": "v=0\r\n..."
}'Request fields:
| Field | Type | Required | Description |
|---|---|---|---|
agent | string | Yes | Agent ID (agt_...) |
provider | "openai" | "elevenlabs" | Yes | Realtime voice provider |
subject | string | Yes | Caller or end-user identifier (1 to 200 chars) |
sdp | string | OpenAI only | WebRTC SDP offer (up to 64 KiB) |
model | string | No | Provider realtime model override |
voice | string | No | Voice ID or name (defaults to alloy for OpenAI) |
instructions | string | No | Voice prompt override (up to 8,000 chars) |
language | string | No | BCP-47 language code (for example en, en-US) |
bucket | string | No | Optional billing/context bucket tag |
context | object | No | Optional context object attached to call events |
keyScope | string | No | Optional provider key scope (1 to 100 chars) |
maxMinutes | number | No | Call duration limit (1..720, default 240) |
metadata | object | No | Custom JSON metadata (up to 4 KiB serialized) |
speakers | Record<string, string> | No | Map of up to 50 speaker IDs to display names (max 40 chars each) |
interruptResponse | boolean | No | Whether caller speech interrupts an active reply |
Returns 201 with the VoiceCall object plus connect:
- For OpenAI:
connect: { sdpAnswer: "..." } - For ElevenLabs:
connect: { signedUrl: "...", conversationId: "..." }
Manage active calls
| Endpoint | Purpose |
|---|---|
GET /v2/voice/calls?state=live|ended&limit=50 | List calls for your tenant (limit 1 to 100, requires tenant key) |
GET /v2/voice/calls/:id | Fetch call status, turns, asks, audioSeconds, costUsd, metadata, speakers |
PATCH /v2/voice/calls/:id | Update speakers and/or metadata on a call |
POST /v2/voice/calls/:id/transcript | Append a transcript utterance ({ speaker, text, seconds?, startedAt?, endedAt? }), returns 202 |
POST /v2/voice/calls/:id/end | End a call with optional { reason } |
DELETE /v2/voice/calls/:id | End a call (with reason "requested") |
Voice calls emit signed webhooks (voice.session.started, voice.utterance, voice.agent.replied, voice.session.ended, and usage.recorded). See Webhooks.
ElevenLabs provider callbacks
camelRun exposes signed callback routes used by ElevenLabs agents:
POST /v2/voice/providers/elevenlabs/post-call(verifiesElevenLabs-Signature)POST /v2/voice/providers/elevenlabs/tools/:tool(ask_agentorstay_silent, authenticated withX-Voice-Tool-Secret)
Agent voice sessions (/v2/voice/sessions)
For direct browser or app clients that want an ephemeral provider credential and a tool bridge into an agent's configured tools, use /v2/voice/sessions:
const session = await client.voice.createSession({
agentIdOrKey: "support-agent",
provider: "openai", // or "elevenlabs"
voice: "alloy",
});
// { sessionId: "vs_...", provider, voice, agentId, clientSecret, wsUrl, expiresAt }
// Execute an agent tool from the voice session
const toolOut = await client.voice.invokeTool(session.sessionId, {
name: "lookupOrder",
args: { orderId: "ORD-42" },
});Voice session routes:
| Endpoint | Purpose |
|---|---|
POST /v2/voice/sessions | Create a 15-minute realtime session for { agentIdOrKey, provider?, voice?, instructions? } |
GET /v2/voice/sessions/:id | Inspect an active voice session |
POST /v2/voice/sessions/:id/tool | Invoke one of the agent's tools ({ name, args?, callId? }) |
GET /v2/voice/sessions/:id/ws | WebSocket tool bridge (accepts Authorization: Bearer ... or ?token=...; send { type: "tool_call", callId, name, args }, receive { type: "tool_result", ... }) |
Limits
- Up to 50 concurrent active voice calls per tenant (configurable via
AGENT_VOICE_SESSIONS_PER_TENANT). - Maximum call duration: 720 minutes (default 240 minutes).
- Metadata: up to 4 KiB JSON; speakers: up to 50 entries (40 chars max per display name); SDP: up to 64 KiB.