# Handle Incoming Calls Based on Caller ID

Call handling rules let you decide in advance what happens to an incoming call based on the number it comes from (the Caller ID). You can match a single number or a whole range, then send matching calls wherever you want, or block them outright. Rules apply to calls from both coworkers and outside contacts, so you can use them to filter spam, forward VIP callers, or send certain numbers straight to voicemail.

## Create a rule

1. Sign in to the Cloud Voice App and open **Preferences > Features > Call Handling Based on Caller ID**.
2. Click **Add** to start a new rule.
3. In the **Caller ID** field, define which calls the rule matches:
   - **A single number**: Type the exact Caller ID. For example, `10086` matches only calls from 10086.
   - **A range of numbers**: Type a wildcard pattern. For example, `9011.` matches any Caller ID that begins with 9011.

   :::note
   A trailing dot (`.`) is a wildcard that stands for any digits after the fixed part. So `9011.` covers 90110, 901145, 9011999, and so on. Use a specific number when you want an exact match, and a pattern when you want to cover a group of numbers with one rule.
   :::

4. From the **Action** drop-down, choose what to do with a matching call:

   | Action | What happens |
   | --- | --- |
   | Hang Up | The call is dropped immediately. |
   | Extension | The call is sent to an extension you select. |
   | Voicemail | The call goes to a voicemail box. |
   | IVR | The call is passed to an IVR (Interactive Voice Response) menu, the automated "press 1 for sales" phone menu. |
   | Play Greeting then Hang up | A greeting plays for the caller, then the call ends. |
   | Accept Call | The call is allowed through to your extension. |

   :::caution
   A wildcard pattern with the **Hang Up** action can block more callers than you intend, and blocked callers get no warning. Before you rely on a broad pattern, double-check that no number you actually want to reach falls inside it, or add a narrower **Accept Call** rule above it (see [Order your rules](#order-your-rules)).
   :::

5. Click **Save** to store the rule.
6. Repeat steps 2 through 5 for each additional rule you need.
7. **Optional:** In the **Move** column, drag the rules into the priority order you want (see [Order your rules](#order-your-rules)).
8. Click **Save** to apply all your rules.

:::note
Every incoming call reaches your extension by default. **Accept Call** is useful when a broader rule blocks a range but you still want one number in that range to get through: for example, when a rule rejects spam calls from `728373XX`, add a separate rule that accepts calls from `72837300`.
:::

## Order your rules

Rules are evaluated from the top of the list down, and the first match wins. A call is handled by the first rule whose Caller ID it matches, and later rules are ignored. Use the **Move** column to drag rules into the priority order you want.

For instance, place "Accept calls from 72837300" above "Reject calls from numbers starting with 728373". A call from 72837300 then matches the accept rule first and rings your extension, while every other number beginning with 728373 falls through to the reject rule and is hung up.

:::tip
Order matters as much as the rules themselves. Put your specific "let this one through" rules above your broad "block this range" rules. If a blocking rule sits higher, it will catch the call before the accept rule ever gets a chance to run.
:::

## Result

From now on, whenever a call comes in, the system checks it against your rules in order and handles it according to the first one that matches its Caller ID.
