You’ll use one identifier throughout: the
sid (call_sid). It’s minted
once — at the inbound INVITE or when you call originate() — and it
addresses everything after: audio, transfer, hangup, recording, telemetry.
You never mint a second one.What you’ll assemble
A call
Originate outbound over a SIP trunk, or answer an inbound one routed by
your dialplan.
An agent
A server-side runtime that transcribes, reasons, speaks, and stops when
interrupted — attached to the call by id.
A safety net
Tools, a warm human handoff, and both-leg recording — the things a
production agent can’t ship without.
Before you start
Provision a workspace
Managed cloud or self-hosted — either gives you a tenant with an API key
and a per-tenant SIP subdomain. See
managed cloud or
on-prem.
Configure a SIP trunk
A trunk carries calls to and from a carrier. Note its
trunkId. See
SIP trunking.Define an agent
An agent is a runtime config — a pipeline plus turn detection and tools.
Author it in the agent console or by config;
note its
agent id. The shape is covered in
runtime overview.Step 1 — Get a call
You either start a call (outbound) or answer one that arrives (inbound). Both end with a livesid you can attach an agent to.
- Originate (outbound)
- Answer (inbound)
One control-plane call. Pass the agent id and the engine attaches the agent
automatically the moment the callee answers — you can skip Step 2 entirely.
Step 2 — Attach the agent
If you didn’t passagent to originate (or you’re answering inbound from
code and want to bind an agent yourself), attach one to the live sid. The
engine wires the audio bridge end to end — caller audio into the agent, agent
audio back to the caller — so you don’t open a bridge yourself.
Attaching binds a server-side agent that runs inside the voice gateway,
on the core that owns the call’s media — turn detection and barge-in are
wired straight into the media path. If instead you want to run your own
runtime and drive raw audio frames yourself, open an
AudioBridge and feed it, or bring an
external runtime via keep your existing
runtime.Step 3 — Configure turn detection
Turn detection is what makes the call feel human: the agent stops the instant the caller talks (barge-in) and replies the instant they finish. It lives in the agent config, not in your call code — set it once per agent. Pick a mode. Cascaded pipelines use on-device VAD; realtime models let the provider own turns.silero runs on-device VAD in the gateway — the default for cascaded
ASR → LLM → TTS. server_vad lets a realtime provider own turn signalling.
A REALTIME entry node auto-promotes to server_vad unless you set type
explicitly.Trailing silence before end-of-utterance fires. Lower (~300) for snappier
replies; raise (~800) for callers who pause to think.
Minimum speech duration to count as a real utterance. Raise if line noise
causes false triggers.
Step 4 — Add tools
A useful agent does things — looks up an order, books a slot, checks a balance. Declare tools in the agent config; the model calls them mid-conversation and the runtime feeds results back while keeping the caller engaged.http (call an endpoint you own),
mcp (a remote MCP server over
Streamable HTTP), and telephony tools like routing to a live human queue.
Full parameter reference, MCP setup, and per-node allow-lists are in
tool calling.
Step 5 — Hand off to a human
The agent thesis for regulated work: the model qualifies, authenticates, and captures compliance context, then escalates to a person — a warm handoff, not a cold transfer. The caller keeps theirsid and hears uninterrupted
audio; only the agent leg re-points.
There are two shapes, and you pick by target.
Re-attach to another agent
Swap the AI agent for a different one — same call, new brain.
Escalate to a human
Route to a live human queue (browser softphone or SIP deskphone). The
telephony tool
route_to_skill — or an operator transfer — rings the
next available agent and bridges them onto the caller leg.On the wire, escalation pauses the AI leg, mirrors the caller’s audio to the
human, and the human’s mic is injected back to the caller — the caller never
hears a gap. The queue routing and human-agent ring (browser or deskphone)
are ACD-driven. Mechanics live in
AI ↔ human handoff;
the product-level bot ⇄ human framing (and warm-handoff context) is in
handoffs.
Step 6 — Record and review
Recording captures both legs — caller on the left channel, agent on the right — and lands a stereo WAV in your recording store for playback and review. Media QoS (loss, jitter, MOS) is scored per call at the same time.Recording is a workspace/trunk-level capability, not a per-call SDK flag
in the current surface — you enable it on the trunk (or workspace) and every
call it carries is captured. There’s no
record: true argument on
originate() today. To analyze recordings programmatically, pull them and
the QoS metrics from the observability plane.Record & analyze
Pull both legs and run analysis over the stereo capture.
MOS, jitter & loss
The per-call media-quality score and what drives it.
Call traces
The event-level trace of a single call, keyed on its
sid.Dashboards
Fleet-wide call, quality, and agent reporting.
Step 7 — Tear down
End the call cleanly. Hangup releases the media legs, tears down the agent session, and emits the final lifecycle event and CDR.Put it together
The whole outbound-to-teardown flow, minus the config that lives in the agent definition:Next steps
Inbound call recipe
The answer-and-route path, end to end.
Outbound call recipe
Originate, poll, and read the outcome.
Transfer to a human
A runnable warm-handoff recipe.
Bring your own runtime
Use TeleQuick as pure transport with an external agent runtime.