# Route Inbound Calls based on Caller ID

A [caller-ID-based inbound route](/pbx/administrator-guide/inbound-route-overview/#topic_tqk_hcd_bmb__caller-id-based-inbound-route) tells Cloud Voice to look at the caller ID (the phone number a call is coming from) and send that call to a destination you pick for the matching number pattern. It gets callers to the right party without making them work through a phone menu first. The example below sets up a single published phone number that fans out to different teams based on where each caller is calling from.

:::note
Every inbound call involves two numbers, and it helps to keep them straight:

- **Caller ID**: the number the call is coming *from*. This route matches on the caller ID.
- **DID** (Direct Inward Dialing): the number the caller dialed *to reach you*, that is, one of your own published numbers.
:::

## Example scenario

Company ABC is a consulting firm that serves customers in several cities. It advertises a single countrywide toll-free number, 400-661-8815, and staffs separate teams to cover different regions. When a customer calls the toll-free number, the call should reach the team that owns their region.

The two teams and the caller area codes they cover are:

| Team | Region | Area codes |
|------|--------|------------|
| Team-A | Fujian | 0591, 0592, 0593, 0594, 0595, 0596, 0597, 0598, 0599 |
| Team-B | Guangdong | 0660, 0662, 0663, 0668 |

Because every Fujian area code begins with `059` and every listed Guangdong area code begins with `066`, you can match each region with a single caller ID pattern.

## Build the inbound routes

Create two inbound routes that share the same trunk but match different caller ID patterns and point to different destinations.

:::caution
Routing here depends entirely on the caller ID that the carrier delivers. A call whose caller ID is blocked, withheld, or does not match either pattern will not reach Team-A or Team-B. To avoid losing those calls, add a fallback inbound route with the caller ID pattern left blank (so it matches anything) and send it to a default answering point such as a reception queue or an auto attendant. Keep the two team patterns from overlapping so each call is claimed by exactly one route.
:::

### Inbound route for Team-A

1. Under **Name**, type something that identifies the route to you later.

   :::tip
   Put the team or region in the name (for example `Inbound - Fujian (Team-A)`). Clear names save time when you have many routes to scan later.
   :::
2. Leave **DID Pattern** empty so the route places no restriction on which of your numbers the caller dialed. With this blank, the route decides purely on caller ID.
3. For **Caller ID Pattern**, choose **Caller ID Matching Settings**, click **Add**, and enter a pattern or a complete caller ID.

   For this scenario, enter `059.` to match every incoming caller ID that begins with 059. See [DID Pattern and Caller ID Pattern](/pbx/administrator-guide/did-pattern-and-caller-id-pattern/) for how the special characters work.

   :::note
   The trailing dot is a wildcard. `059.` matches any caller ID that starts with 059 and is followed by more digits, which covers every Fujian area code in the table (0591 through 0599) with one pattern.
   :::

   ![Caller ID pattern 059. entered in the matching settings for the Team-A route](/images/pbx/inbound-calls-based-on-cid-1.png)
4. Set **Trunk** to the trunk that carries the incoming calls.
5. Configure the **Default Destination**. Here the call should always go to the same place, so route it to the Team-A queue and skip time-based routing:
   - **Default Destination**: the queue for Team-A.
   - **Time Condition**: leave it unselected.

   :::note
   The Default Destination is where every matching call is sent. If you turn on **Time Condition**, you can split matching calls by time of day (for example business hours versus after hours) and give each period its own destination. This example does not need that.
   :::

   ![Default destination set to the Team-A queue with no time condition](/images/pbx/inbound-route-dst-teama.png)
6. Leave **Fax Detection** at its default settings.

   :::note
   Fax Detection listens for the incoming fax tone and can reroute a fax to a separate fax destination. Leave it at default unless this number also receives faxes.
   :::

### Inbound route for Team-B

1. Under **Name**, type an identifying name for the route.
2. Leave **DID Pattern** empty.
3. For **Caller ID Pattern**, choose **Caller ID Matching Settings**, click **Add**, and enter the pattern.

   For this scenario, enter `066.` to match every incoming caller ID that begins with 066. See [DID Pattern and Caller ID Pattern](/pbx/administrator-guide/did-pattern-and-caller-id-pattern/) for details.

   ![Caller ID pattern 066. entered in the matching settings for the Team-B route](/images/pbx/inbound-calls-based-on-cid-2.png)
4. Set **Trunk** to the trunk that carries the incoming calls. In this example, select the **siptrunk** trunk, which serves the number 400-661-8815.
5. Configure the **Default Destination** so calls always reach Team-B:
   - **Default Destination**: the queue for Team-B.
   - **Time Condition**: leave it unselected.

   ![Default destination set to the Team-B queue with no time condition](/images/pbx/inbound-route-dst-teamb.png)
6. Leave **Fax Detection** at its default settings.

## Result

Both teams share the toll-free number, but callers land with the right team based on their area code:

- A caller from Fujian who dials 400-661-8815 is answered by Team-A.
- A caller from Guangdong who dials 400-661-8815 is answered by Team-B.
