sid unchanged: attach an agent, open an
AudioBridge, transfer, hangup. There is
no separate inbound media API. The only inbound-specific decision is what
happens at the moment the gateway answers the call.
How the gateway answers
You do not send provisional or final responses yourself. The gateway sends them, in the exact sequence that carriers expect:1
100 Trying
The gateway acknowledges the carrier’s
INVITE immediately, so the trunk
does not retransmit.2
183 Session Progress (with SDP)
This is an early-media answer that carries the negotiated SDP. It opens the
media path before the call is picked up. A ringback tone or an agent
greeting can play during ringing.
3
200 OK (same SDP)
This is the final answer. The gateway reuses the SDP that it already
offered at
183.voice/<sid>/uplink. The
audio that you publish on voice/<sid>/downlink is paced back to the caller.
The full state machine — ring, answer, hold, transfer, clear — is on
Call lifecycle.
Decide what happens on answer
Each trunk (or number) carries an inbound rule. The gateway reads the rule when a call arrives:
Most teams never set this rule directly. In the voice console at
agent.clutchcall.dev, you assign a number (or trunk) to an agent, a skill
queue, or an IVR program. The console sets the rule for you. The rest of this
page shows each path.
Route to an AI agent (the common case)
Point a number at an agent, and you are done. The gateway answers, attaches the runtime, and wires the audio bridge end to end. Your process never touches the media. This isHANDLE_AI.
- Console
- Python
- Go
In agent.clutchcall.dev, open the number under Numbers. Set On
inbound → AI agent. Pick the agent that you built (e.g.
support-frontline). Save. The next call to that number reaches the agent.
See Build a voice agent.Programmatic
set_inbound_routing lives in the native SDK cores (Python,
Go, Rust). The browser/TypeScript SDK does not carry this low-level RPC. For
TypeScript apps, configure inbound routing in the console (or in your
control-plane provisioning). Then handle the resulting call with the
high-level Voice client.Route to a human or a queue
To send inbound callers to people, point the number at a skill queue or an IVR program (VDN) instead of an agent. The gateway answers. The dialplan runs your IVR steps: announcements, digit collection,queue_to_skill. The ACD
picks the next eligible agent, on a browser softphone or a real SIP deskphone.
This is all configuration. You write no media code.
PBX / ACD
Skills, VDNs, IVR vectors, and the agent picker behind human routing.
AI → human handoff
Let an AI agent qualify the caller, then warm-transfer to a person.
Handle the call in your own process
UseNOTIFY_AND_HANGUP when your own service must answer and drive inbound
audio instead of a prebuilt agent. The gateway tells your app about each
incoming call. You answer the call. You then attach an
AudioBridge to the resulting sid, exactly
as you would for an outbound call. This is the “inbound == outbound” payoff.
1
Set the rule to notify
Configure the trunk with
NOTIFY_AND_HANGUP. Optionally, set a
webhook_url. The gateway POSTs incoming-call events to that URL.2
Receive the incoming call
Get the caller and the
sid from your webhook. Or pull queued calls on
the native core (get_incoming_calls). Those results arrive on your event
stream.3
Answer, then bridge
Accept the leg with
answer_incoming_call. Then subscribe uplink and
publish downlink through an AudioBridge on that sid.- Python (native core)
- TypeScript (bridge by sid)
The
attach half of the AudioBridge is written from the server’s point of
view. You subscribe uplink to hear the caller. You publish downlink
to talk to the caller. This is the same handle that an outbound call gives
you — see
Sessions, calls, tracks & streams.Where routing decisions live
The gateway does not hardcode any of this. On answer, the gateway asks the engine’s dialplan what to do with the call. The dialplan is a hot-reloaded rule engine, keyed by DID and then by source IP. The result can be: play a prompt, start an AI bidirectional stream, or enter an IVR vector. When you edit a number’s routing in the console, the rules update within seconds. In-flight calls keep the behavior that they started with. TrunkINVITEs bypass the
registrar’s access control. Everything else is gated by digest auth, source-IP
ACLs, and a spam filter (see
SIP trunking).
Related
Number provisioning
Buy, import, and assign the numbers that callers dial.
Outbound calls
The mirror of this page: originate calls and run the paced dialer.
Call lifecycle
Ring, answer, hold, transfer, and clear — the full state machine.
Audio bridge API
Subscribe uplink and publish downlink on any
sid.
