Routing rules
A routing rule decides which agent answers an inbound call — or rejects it. Each number has an ordered list of rules. When a call comes in we check them top to bottom; the first match wins. If none match, the number's default agent answers.
Rules let one number serve many agents. Manage them per number in the dashboard, or over the API at /v1/numbers/{id}/rules.
Routing rules apply only to numbers on Platform routing. A number set to Webhook routing skips rules entirely — your server decides via the call answer webhook.
What a rule can match on
Every call gives a rule two things to look at:
forwarded_from— the number the call was forwarded from (empty for a direct call).from— the caller's own number.
Number matching is by digits, not exact text — carriers send the same number many ways (+919643120161, 919643120161, 09643120161). Equals matches compare the last 10 digits.
| Match type | Fires when | Needs a value? |
|---|---|---|
DIRECT |
forwarded_from is empty (dialed your number directly). |
No |
FORWARDED_FROM |
forwarded_from equals the value. |
Yes |
FORWARDED_FROM_PREFIX |
forwarded_from starts with the value. |
Yes |
ANY_FORWARDED |
the call was forwarded (any source). | No |
CALLER_FROM |
from equals the value. |
Yes |
CALLER_FROM_PREFIX |
from starts with the value. |
Yes |
ANY |
always — a catch-all. | No |
Caller ID can be faked.
CALLER_FROMis fine for routing, but never usefromalone to protect anything sensitive.
Each rule has an action:
| Action | Effect |
|---|---|
ROUTE |
Answer with the rule's agent. |
REJECT |
Refuse the call, with a reason you set. |
The big pattern: one number, many clients
You don't need a number per customer. Keep one number, have each customer forward their line to it, and route each forwarded call to that customer's agent.
Acme +91 80 1111 1111 ──forward──┐
├─▶ YOUR ONE NUMBER ─▶ rules ─▶ that client's agent
Globex +91 80 2222 2222 ──forward──┘Every forwarded call carries forwarded_from = the customer's own line. Match on it:
| Order | Match | Value | Action | Agent |
|---|---|---|---|---|
| 1 | FORWARDED_FROM |
+918011111111 |
ROUTE | Acme agent |
| 2 | FORWARDED_FROM |
+918022222222 |
ROUTE | Globex agent |
| 3 | DIRECT |
— | ROUTE | Reception agent |
| 4 | ANY |
— | REJECT | unknown_caller |
One number. Any number of clients. Each gets their own agent.
Need the config to change per call (a different prompt for each business, or accept/reject live)? That's the dynamic decision — the more powerful version of this pattern.
`forwarded_from` vs `from`
| Field | Is | Use it to |
|---|---|---|
forwarded_from |
the line that forwarded the call (your customer) | know which customer the call is for |
from |
the person who dialed | personalise for the individual caller |
For "one number, many clients," route on forwarded_from.
Order matters
First match wins, so put specific rules above general ones. An exact FORWARDED_FROM must sit above a broad FORWARDED_FROM_PREFIX or ANY_FORWARDED, or the broad rule swallows it. A final ANY → REJECT turns off the default-agent fallback and refuses anything unrecognised.
Tips
- No rules? Fine — the default agent answers everything. Rules are only for one-number-many-agents.
- Confirm it worked. The
call.endedwebhook shows thefrom,to, and theagent_idthat answered — the quickest way to check a rule fired. forwarded_fromempty on a forwarded call? The forwarding carrier didn't pass it. TryANY_FORWARDED, or a different forwarding method on the customer's side.
Next
- Decide per call — pick the agent live from your server
- Set the answering agent · Numbers
