# Incoming Call Router (/docs/plugins/call-router)



The **Incoming Call Router** decides what happens when someone calls your connected [Twilio](https://www.twilio.com) number.

Version one routes on a single, powerful rule:

1. If the caller's number matches an **upcoming or in-progress booking**, the call is handed to your **Retell AI voice agent**.
2. Otherwise, the call **rings a number where a person can answer** (your fallback number).

More routing rules — business hours, caller lists, menus — are on the way; the router is built to grow.

This is a **connector** plugin: it reuses the Twilio connection you've already set up, but needs a few details of its own (your Retell voice agent and a fallback number), so it stays disabled until you've configured it.

Before you start [#before-you-start]

* **Connect your Twilio account** in **Company settings** (account SID, auth token, and your number). The call router uses that same connection.
* **Create a Retell voice agent.** In your [Retell](https://www.retellai.com) dashboard, set up a **voice** agent for inbound calls and note its **agent ID** and your **API key**. A *chat* agent will not work for phone calls.

Setup [#setup]

1. Open **Plugins → Browse Plugins** and click **Install** on **Incoming Call Router**.
2. In the **Configuration** section on the setup page, enter:
   * your **Retell API key** (stored encrypted, never shown again),
   * your **Retell voice agent ID**, and
   * a **fallback number** — the number rung when the caller has no booking (for example, your front desk or a staff mobile). This can be any phone number; it does not have to be a Twilio number.
     Then click **Save call routing**.
3. *(Optional)* Under **Numbers to route**, add any number — besides your company's default Twilio number — that should route through the call router. The picker lists the numbers on your connected Twilio account; if it can't load, you can type one instead. See [Routing a separate number](#routing-a-separate-number).
4. In your **Twilio** account, set the &#x2A;*Voice "A call comes in"** webhook (HTTP **POST**) for **each** number you route to the URL shown in **Configuration**:

   ```
   https://api.resytech.com/v1/plugins/call-router/voice/<your-token>
   ```

   The setup page shows the full URL — including a token unique to your account — with a copy button.
5. Click **Enable** on the setup page.

<Callout type="info">
  The token in the webhook URL is an extra check unique to your account that makes the URL harder to guess. It's belt-and-braces on top of Twilio's request signature, which is the real security. A token-less URL still works, so existing setups keep running.
</Callout>

Routing a separate number [#routing-a-separate-number]

By default the router handles calls to your **company's connected Twilio number** — the same one your workflows and texts use.

If you'd rather route a **separate line** — for example, a dedicated bookings number kept apart from your main number — add it under **Numbers to route** on the setup page. The picker lists the numbers already on your connected Twilio account, so you just choose one (if the list can't be loaded, you can type a number instead). You can add **more than one**; each must be a number on the **same** Twilio account.

Remember to point the **Voice webhook** of each number you add at the URL on the setup page — otherwise Twilio won't hand its calls to the router.

How routing works [#how-routing-works]

When a call comes in, the router looks up the caller's number among your customers and their bookings:

* **Caller has a booking** (upcoming or happening right now, not canceled) → the call is connected to your Retell AI voice agent.
* **No matching booking** → the call rings your fallback number.

<Callout type="info">
  Calls are never dropped. If the AI agent can't be reached for any reason, the router automatically falls back to ringing your fallback number, and only ends the call politely if no option is available.
</Callout>

The caller's number is matched to a customer regardless of how the phone number was formatted when it was saved, so `(555) 123-4567` and `+15551234567` are treated as the same number.

Permissions [#permissions]

* **Setting up** the call router (configuring, enabling) requires the **Plugins** permission. Administrators always have it.
* There's no per-user permission for handling calls — routing is automatic once the plugin is enabled.

Good to know [#good-to-know]

* The router uses your **company's connected Twilio number**, so it's a company-level capability like the SMS Inbox.
* Calls handled through Twilio and your Retell agent count toward your Twilio and Retell usage and billing.

Troubleshooting [#troubleshooting]

<Callout type="warn">
  If calls aren't being routed, check that your number's **Voice** webhook in Twilio points at the exact URL on the setup page (it's the **Voice** "A call comes in" setting — not the messaging webhook), and that the plugin is **enabled**.
</Callout>

<Callout type="warn">
  If booking callers reach your fallback number instead of the AI agent, confirm your **Retell voice agent ID** and **API key** are correct and saved, and that the caller actually has an active (not canceled) booking on file under that phone number.
</Callout>
