# Dial Pattern Examples

An outbound route decides which trunk (the connection between your phone system and your phone-service carrier) carries a call, based on the digits an extension dials. The **Pattern** field is what does the matching, and the **Strip** and **Prepend** fields let you reshape the number before it reaches the carrier. The examples below build a pattern for each common call type so you can see how the pieces fit together, then adapt them to your own numbering plan.

## How to read a pattern

A dial pattern is a template made of literal digits and wildcards. The three building blocks used in these examples are:

- `X`, any single digit, `0` through `9`.
- `Z`, any single digit, `1` through `9` (in other words, any digit except `0`).
- `.`, the remaining digits, matching one or more of whatever follows.

Count the characters in a pattern and you know how many digits a caller must dial for it to match. The examples that follow are based on the numbering plan for Xiamen, China; substitute the digit lengths and prefixes your region uses.

:::note
The rule about counting characters holds only for fixed-length patterns (those built from `X` and `Z`). The `.` wildcard has no fixed length: it matches one or more trailing digits, so a pattern that ends in `.` accepts numbers of many different lengths.
:::

## Local calls

In Xiamen, local numbers are seven digits long and never begin with `0` (for example, `5503305`). To match a seven-digit number whose first digit is `1` through `9`, use one `Z` for the leading digit followed by six `X` wildcards.

| Pattern | Strip | Prepend |
| --- | --- | --- |
| `ZXXXXXX` | Leave blank | Leave blank |

## Long-distance calls

A long-distance call in this plan is a four-digit area code plus a seven-digit local number, such as `0595-7588123`.

- The area code has the form `0ZXX`: it starts with `0`, and its second digit is never `0`.
- The local number is the same seven digits as before, and it does not start with `0`.

Chaining the two together gives an eleven-character pattern.

| Pattern | Strip | Prepend |
| --- | --- | --- |
| `0ZXXZXXXXXX` | Leave blank | Leave blank |

## Mobile calls

Every mobile number in China is eleven digits and begins with `1` (for example, `15880260666`). Match the leading `1` as a literal, then allow any digits for the remaining ten positions.

| Pattern | Strip | Prepend |
| --- | --- | --- |
| `1XXXXXXXXXX` | Leave blank | Leave blank |

## International calls

International numbers all start with `00`, and their total length varies by destination. Match the `00` prefix as literals, then use the `.` wildcard to accept whatever digits follow.

| Pattern | Strip | Prepend |
| --- | --- | --- |
| `00.` | Leave blank | Leave blank |

:::caution
A pattern like `00.` matches an international number of any length, which is exactly the traffic that toll fraud targets. Only allow it on outbound routes reachable by the extensions that genuinely need international dialing, and protect that route (for example, with a PIN or a restricted extension list) so a compromised phone cannot run up long-distance charges.
:::

:::tip
Use **Strip** when the carrier does not expect the access digits your users dial, and **Prepend** when the carrier requires a prefix your users don't dial. In these examples both fields stay empty because the digits dialed are exactly what the carrier expects.
:::
