Skip to content

Inbound routing: decide who answers each call

Once your numbers reach MoreVoice over a SIP line (see phone numbers and SIP), inbound routes decide who answers each call: an AI assistant, an IVR or AI flow, a queue of people, one person or a conference room. A route matches calls by the number that was dialled and the number that is calling, so one line can serve sales, support and an after-hours assistant at once.

A route (a “rule” in the app) has:

Field What it does
target Who answers: { "type": "assistant", "assistant_id": … }, or flow, queue, user or conference_room with its <type>_id.
fallback_assistant_id The assistant that answers when the target can’t take the call (a queue that is switched off, a person who was deactivated). Not with an assistant target.
match_did The dialled number: an exact number, a prefix ending in *, or empty for any number.
match_caller The caller’s number, with the same three forms.
connection_id Only calls on this connection; null for any connection.
priority The order routes are checked in: lower first. 100 by default.
enabled false keeps the route but skips it.
name Your name for it.

match_did and match_caller take the same three forms. Spaces, dashes and brackets are ignored, so 03-555 0100 and 035550100 are the same number.

Pattern Matches Example
Exact number Only that number +97235550100
Prefix ending in * Every number that starts with it +9723* matches every Tel Aviv number
Empty Any number

The number is compared as the carrier sends it. If your carrier sends international format, write the patterns that way too (+9723*); if it sends local format, write 03*.

target.type What happens
assistant An AI assistant answers.
flow A published flow runs: an IVR menu, or an AI conversation step by step.
queue The call waits in a queue for a person, and can overflow to an AI assistant.
user One person’s direct line: their own forwarding rules apply.
conference_room The caller is asked for the room’s PIN, then joins the room.

The first route sends the sales line to a queue of people, with an assistant behind it; the second one answers every other Tel Aviv number with the assistant:

Terminal window
# Calls to the sales line wait for a person in the sales queue; when the queue can't take them, an assistant answers.
curl https://api.morevoice.ai/v1/inbound_routes \
-H "Authorization: Bearer $MOREVOICE_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"name": "Sales line",
"match_did": "+97231234567",
"priority": 10,
"target": { "type": "queue", "queue_id": "'"$SALES_QUEUE_ID"'" },
"fallback_assistant_id": "'"$ASSISTANT_ID"'"
}'
# Every other number that starts with +9723 goes straight to the assistant.
curl https://api.morevoice.ai/v1/inbound_routes \
-H "Authorization: Bearer $MOREVOICE_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"name": "Tel Aviv numbers",
"match_did": "+9723*",
"priority": 100,
"target": { "type": "assistant", "assistant_id": "'"$ASSISTANT_ID"'" }
}'

A route takes effect with the next call: calls in progress are not affected, and the SIP connections are not restarted. An exact number that another organisation already routes on the same SIP provider is refused with 409 resource_conflict, with param set to match_did and details.reason set to did_taken.

  1. The routes are checked in order: by priority, lowest first, and by age when two have the same priority. The first enabled route whose connection, match_did and match_caller all match the call is used.

  2. The route’s target answers. When it can’t take the call (the flow has no published version, the queue is switched off, the person was deactivated), its fallback_assistant_id answers. When the route has neither, MoreVoice moves on to the next matching route.

  3. If no route matches, the connection’s inbound_assistant_id answers (Default assistant for inbound calls in the app). If the connection has none, the most recently edited assistant answers.

  4. If there is still no one to answer, the call is refused with 480.

GET /v1/inbound_routes lists your routes in the order they are checked:

Terminal window
# Your routes in the order they are checked: priority, then age. The first enabled route that matches a call wins.
curl "https://api.morevoice.ai/v1/inbound_routes?limit=100" \
-H "Authorization: Bearer $MOREVOICE_API_KEY"

PATCH /v1/inbound_routes/{id} changes the fields you send. A new target replaces the old one, and an assistant target drops fallback_assistant_id. To stop a route for a while, set enabled: false; DELETE /v1/inbound_routes/{id} removes it for good.

Terminal window
# Point the sales line at a published IVR flow instead of the queue. The next call uses it.
curl -X PATCH https://api.morevoice.ai/v1/inbound_routes/$ROUTE_ID \
-H "Authorization: Bearer $MOREVOICE_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "target": { "type": "flow", "flow_id": "'"$FLOW_ID"'" } }'
# Or switch the route off without deleting it: calls fall through to the next matching route.
curl -X PATCH https://api.morevoice.ai/v1/inbound_routes/$ROUTE_ID \
-H "Authorization: Bearer $MOREVOICE_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "enabled": false }'

Routes are configuration: the same routes serve live and test mode.

A route can ask your server who answers each call, and with which variables, before MoreVoice picks up: your CRM looks up the caller, sends a VIP straight to a queue, or picks the assistant and personalises its greeting. Set assistant_request_url on the route (an https URL) and, if you need more or less than 1.5 seconds, assistant_request_timeout_ms (200 to 5,000).

For each call the route matches, MoreVoice sends your URL a signed POST:

POST https://crm.example.com/morevoice/assistant-request
{
"type": "assistant.request",
"id": "ar_7Rk2Xq9mL4pN8sT1vW3yZa",
"created": "2026-11-03T09:14:22Z",
"livemode": true,
"route_id": "rte_5Hn8Kq2LmP9rS4tV7wX1yA",
"call": {
"id": "call_8tRPaZp5hLMbrGqdJ9AmNa",
"direction": "inbound",
"from": "+972501234567",
"to": "+97237654321",
"connection_id": "conn_3Lm9Qp2Rk7sT4vW8xY1zAb"
}
}

Answer 200 with JSON. All the fields are optional:

Field What it does
assistant_id, flow_id or queue_id Who answers: at most one. None: the route’s own target answers, with the fields below.
variables Up to 50 values for the conversation’s {{variables}}.
metadata Up to 50 key–value strings stored on the call, as with POST /v1/calls.
first_message The assistant’s opening line for this call (up to 2,000 characters).
assistant-request.ts
// Choose who answers each call, from your server: MoreVoice asks before it picks up, and waits at most the route's
// assistant_request_timeout_ms (1.5 s by default). Answer fast; anything else falls back to the route's own target.
import { createServer } from "node:http";
import { webhooks, WebhookVerificationError } from "@morevoice/sdk";
const secret = process.env.MOREVOICE_ASSISTANT_REQUEST_SECRET!; // whsec_…: the assistant-request signing secret
interface AssistantRequest {
type: "assistant.request";
id: string;
livemode: boolean;
route_id: string;
call: { id: string; direction: "inbound"; from: string | null; to: string | null; connection_id: string | null };
}
createServer(async (req, res) => {
const chunks: Buffer[] = [];
for await (const chunk of req) chunks.push(chunk as Buffer);
let request: AssistantRequest;
try {
request = JSON.parse(webhooks.verifySignature(Buffer.concat(chunks), req.headers, secret).payload) as AssistantRequest;
} catch (err) {
if (err instanceof WebhookVerificationError) return void res.writeHead(400).end();
throw err;
}
const customer = request.call.from ? await findCustomer(request.call.from) : null;
const answer = customer?.vip
? { queue_id: "q_vip", metadata: { customer_id: customer.id } } // straight to people
: { assistant_id: "asst_reception", variables: { first_name: customer?.firstName ?? "" } }; // {{first_name}} in the greeting
res.writeHead(200, { "content-type": "application/json" }).end(JSON.stringify(answer));
}).listen(3000);
// Your CRM lookup goes here: keep it well under the timeout.
async function findCustomer(phone: string): Promise<{ id: string; firstName: string; vip: boolean } | null> {
return phone.endsWith("4567") ? { id: "cus_42", firstName: "Dana", vip: false } : null;
}

The request is signed like a webhook, with webhook-id set to its id: check it with webhooks.verifySignature() or the steps for any language, using your organisation’s assistant-request signing secret. It is on the live path of a ringing call, so it can only improve the call, never drop it: a timeout, an error status, a body MoreVoice can’t read or an ID your organisation doesn’t have all fall back to the route’s own target. Each decision is sent as a call.routing_decided event, with source: assistant_request, or source: route and the reason.

  1. Open SettingsSIP / Phone. Under Inbound routing, add a Rule.

  2. Pick the connection (or Any connection), enter the Dialled number (DID) and Caller number patterns, choose who answers in Answer with, and click Save rule.

  3. Change the order with Move up and Move down: the order in the app is the API’s priority.

  4. Call the number. The call appears under Live calls while it runs, and in the call log afterwards, with the route that answered it.