# Route Inbound Calls by Matched Phonebook Contacts

Once your company contacts are organized into phonebooks, you can build inbound routes that steer each incoming call to the right team based on the phonebook a caller's number is saved in. An inbound route is the rule your phone system (PBX, short for Private Branch Exchange) uses to decide where a call coming in from outside should go. Routing by phonebook lets you split incoming traffic by customer group without asking callers to press a menu option.

## Before you start

Make sure both of the following are in place:

- Your contacts are grouped into phonebooks. See [Add and Manage Company Phonebooks](/pbx/administrator-guide/manage-company-phonebooks/).
- The **Caller ID Match** feature is turned on. See [Identify Callers from Contacts](/pbx/administrator-guide/identify-callers-from-contacts/).

:::note[What Caller ID Match does]
Caller ID is the phone number shown for an incoming call. The Caller ID Match feature compares that number against the contacts saved in your phonebooks so the system can recognize who is calling. Routing by phonebook only works once this feature is on.
:::

## Example scenario

Suppose Company ABC runs two teams, each with its own set of customers. An administrator has already sorted those customers into two separate phonebooks:

| Team | Phonebook |
|------|-----------|
| Sales Team (Queue 6401) | Customers_Abroad |
| Support Team (Queue 6402) | Customers_China |

A Queue is a holding line that rings a group of agents, and the number in brackets is the extension callers reach it at. The goal is for every call from a Sales customer to land on the Sales queue, and every call from a Support customer to land on the Support queue. You achieve this with two inbound routes, each keyed to a different phonebook.

## Create the inbound route for the Sales Team

Add an inbound route with these settings:

1. **Name**: Enter a label that makes the route easy to recognize later.
2. **DID Pattern**: Leave this empty so the route is not restricted to specific numbers.

   :::note[What DID Pattern controls]
   DID (Direct Inward Dialing) is the specific number the caller dialed to reach you. Leaving this field blank tells the route to accept calls to any of your numbers, so the match depends only on who is calling, not on the number they dialed.
   :::

3. **Caller ID Pattern**: Choose **Match Contacts' Caller ID in Specific Phonebooks**, then select the **Customers_Abroad** phonebook.

   ![Caller ID pattern set to match contacts in the Customers_Abroad phonebook](/images/pbx/inbound-calls-based-on-cid-phonebook-1.png)

   :::caution[Only saved contacts match this route]
   This route only catches calls whose Caller ID is saved in the Customers_Abroad phonebook. A call from a number that is not in that phonebook skips this route. Make sure another inbound route is in place to handle callers who are not in any phonebook, otherwise those calls have nowhere to land.
   :::

4. **Trunk**: Select the trunk these customers call in on.

   :::note[What a trunk is]
   A trunk is the connection from your phone service provider that carries outside calls into the system. Pick the trunk your customers dial in on so the route watches the right line.
   :::

5. **Default Destination**: Decide whether calls should follow different destinations by time of day. In this example, every matching call goes to the same place regardless of when it arrives:
   - **Default Destination**: Set to **Queue** and choose the Sales Team.
   - **Time Condition**: Leave unselected.

   ![Default destination pointing matched calls to the Sales queue](/images/pbx/inbound-route-dst-leo-ball.png)

   :::tip[Route calls differently after hours]
   Because the Default Destination can be tied to a Time Condition, you could send matched calls to the team during business hours and to voicemail or an after-hours greeting the rest of the time. This example leaves Time Condition unselected, so matched calls always go to the queue.
   :::

6. **Fax Detection**: Keep the default settings.

## Create the inbound route for the Support Team

Add a second inbound route the same way, pointing it at the other phonebook. The settings below mirror the Sales route, so the notes above apply here too.

1. **Name**: Enter a label that makes the route easy to recognize later.
2. **DID Pattern**: Leave this empty so the route is not restricted to specific numbers.
3. **Caller ID Pattern**: Choose **Match Contacts' Caller ID in Specific Phonebooks**, then select the **Customers_China** phonebook.

   ![Caller ID pattern set to match contacts in the Customers_China phonebook](/images/pbx/inbound-calls-based-on-cid-phonebook-2.png)

4. **Trunk**: Select the trunk these customers call in on.
5. **Default Destination**: As with the first route, send every matching call to the same destination:
   - **Default Destination**: Set to **Queue** and choose the Support Team.
   - **Time Condition**: Leave unselected.

   ![Default destination pointing matched calls to the Support queue](/images/pbx/inbound-route-dst-nicholas.png)

6. **Fax Detection**: Keep the default settings.

## Result

With both routes in place, the system sorts incoming calls by phonebook:

- Calls from contacts in **Customers_Abroad** reach the Sales Team.
- Calls from contacts in **Customers_China** reach the Support Team.
