Route Inbound Calls to a Browser Client
Ring one agent on an inbound call: dial a SIP credential as client:<username>, an app device by its bare identity. A token clientName is not dialable.
Ring one agent on an inbound call: dial a SIP credential as client:<username>, an app device by its bare identity. A token clientName is not dialable.
Outbound calling from the browser is the common first step: your server mints a
token, the browser SDK registers, and the agent dials
out. Routing an inbound call back to a specific agent is the other half, and
it has one rule that trips up almost everyone: the clientName you set when
you mint a token is a label for that socket, not an address you can dial.
A call only rings an endpoint that is provisioned on the platform: a SIP
credential, or a device enrolled for an agent. Dialling a name that is not one
of those does not ring at all. The leg fails in about a second and is recorded
as a missed call, with Dialing and Missed in the same second and no ring
time.
The two kinds of endpoint take different forms in the same dial
attribute:
| Endpoint | Dial it as | Example |
|---|---|---|
| SIP credential (a registered softphone or desk phone) | client:<username> | client:agent-1001 |
| Enrolled app device | the device's bare identity, with no client: prefix | dev-… |
| Internal extension | the four-digit extension | 1001 |
Do not build a SIP URI for any of these (sip:… or user/..@realm will be
rejected), and do not add client: to a device identity. Prefixing an app
device is the mistake that produces a call that fails inside the PBX with
nothing to show for it.
The simplest route is the extension. Every registered device gets a four-digit internal extension, and the platform rings every device on it for you, waking app devices that are asleep. Set the number's forward target to the agent's extension and you do not have to build any dial string yourself.
List the SIP credentials on your workspace. Each one returns its username
and, once a device has registered, its extension.
On an inbound call, return a dial to the agent. You can greet the caller
first and record the connected leg as usual. This example rings a SIP
credential.
import { sauti } from "@sautikit/node";
res.json({
actions: [
sauti.say({ text: "Thank you for calling Hostnali..." }),
sauti.dial({
number: "client:agent-1001",
callerId: "+254709221592",
record: "record-from-answer",
}),
],
});{
"actions": [
{ "say": { "text": "Thank you for calling Hostnali..." } },
{
"dial": {
"number": "client:agent-1001",
"callerId": "+254709221592",
"record": "record-from-answer"
}
}
]
}<Dial callerId="+254709221592" timeout="30" record="record-from-answer"><Number>client:agent-1001</Number></Dial>The caller hears the greeting, then the agent's phone rings. On answer the two legs are bridged and recording starts.
To ring several agents at once and connect the first to answer, fan out with
numbers and first_answer_wins:
{
"actions": [
{
"dial": {
"numbers": ["client:agent-101", "client:agent-102"],
"callerId": "+254709221592",
"first_answer_wins": true,
"record": "record-from-answer"
}
}
]
}A SIP credential that is not currently registered fails immediately, so the call is only as good as your list of who is online. To ring everyone behind an agent without checking, dial the extension instead.
Dialing and the answer, not Dialing and Missed in the same
second. An instant miss means the dialled name is not a provisioned endpoint,
or its SIP registration is not live.username (or
the device identity) the API returned, and that the client: prefix is on SIP
credentials only.dial parameters