Dial Plans

Dial plans are used to route (and optionally modify) specific dialed numbers to specific trunks.

Basically, it first compares a pattern with the dialed number according to matching rules. If it matches, it replaces the dialed number according to the replacement rules (if replacement field is not empty) and sends the call to the trunk set for that rule (pattern). If it doesn’t match, it moves on to the next rule, and so on.

The rules are defined in separate lines and each contains at least:

  • A trunk to which the call is sent if the pattern matches.
  • A pattern which the dialed number must match for the rule to trigger. For example a pattern 9* would mean any dialed number starting with 9 would be sent to the trunk set in this rule.
  • Optionally, a replacement field which replaces the dialed number (according to replacement rules) before sending it to the set trunk. So, for example, if the pattern is 9* and the replacement rule is 1*, then the number 92121234567 will be replaced with 12121234567. If the replacement field is empty, then the dialed number is not touched as it is sent to the set trunk.

The dial plan is sorted by the priorities before execution. Lower numbers will be matched first. If the numbers are the same and the dial plan entry is resumed later (e.g. because of a trunk failover), it will continue with the next higher number.

Creating a Dial Plan

  • Go to your selected domain in the Vodia PBX web interface.
  • Click on Dial Plans under Features as shown above.
  • Give a Name for the new dial plan you want to create.
  • PressCreate.
  • The new dial plan will appear in the list above. You can now click it in order to configure it. You can also enter any other dial plan in the list, for modification, by clicking it.

Configuring a Dial Plan

  • Go to your selected domain in the Vodia PBX web interface.
  • Click on Dial Plans under Features as shown above.
  • Click on the dial plan on the list that you want to configure.
  • Here you can modify the fields for the different rules of the dial plan.
  • Here you can also create new rules or remove rules or enable or disable them.
  • To create a new rule, simply enter all its fields, like the pref number, selecting the rule's trunk from the dropdown, the pattern to match, and the replacement (which should be left blank if you don't want to touch the dialed number before passing it to the trunk). You can also enter a service flag for the dial plan to be active or not, depending on the timings given in the service flag.
  • Press Save.
  • The new rule will appear on a separate line on the list of rules.

Dial Plan Entries

There are several fields in the dial plan:

  • Preference. The preference is used to tell the system how to sort the dial plan.
  • Trunk. The trunk drop down field contains the trunk that should be used. There are some special fields that are explained below.
  • C. This fields stands for CMC, or client matter code. When checked, the PBX will attempt to collect the client matter code from the user before placing an outbound call. This can be useful for accounting purposes.
  • P. When this field is turned on, the PBX will ask the user to enter the PIN code. The pin code can be set under each extension level > Account Profile > PIN setting. This can be useful to protect expensive dial plan entries from abuse, e.g. employees walking into office calling international destinations.
  • Pattern. The pattern field defines when the entry matches. This field is described below.
  • Replacement. When the pattern matches, the PBX may transform the user input, for example put numbers in front of the dialed number. This is also explained in more detail below.
  • Service Flag. Each dial plan entry may be enabled or disabled with a service flag. That makes it possible to enable certain entries based on time or based on manually set flags.
  • Status. In addition to the service flag, each entry may be manually enabled or disabled.

In the trunk drop down, there are additional options available:

  • Not Allowed. When this entry is selected, the PBX will stop processing the dial plan and reject the call.
  • Call Extension. This will send a call not to trunk, but to an extension. The extension must be in the replacement field. This option can be useful when using PSTN gateways behind NAT that must register with the PBX as an extension in order to be accessible through the firewall.
  • Try Loopback. When there are multiple domains, the PBX may try to send the call into another domain through a "loopback trunk". The replacement must contain a telephone number (starting with +) or a SIP URL with a username and a domain that exists on the system (since version 5.4). If that account can be located on the local system, the call will be sent there. This makes it easy to use multiple domains on the same system without an external SIP proxy.

Dial Plan Samples

Typical Dial Plan

A typical dial plan would include the string ([0-9]*)@.* as pattern and sip:\1@\r;user=phone as the replacement. The pattern string has one group [0-9]* (which is referred in the replacement string as \1). That means that if the pattern is matched against the value 2121234567@test.com, it will store 2121234567 in the first group and the result will be sip:2121234567@test.com;user=phone (the user=phone indicates to the recipient that the number is a telephone number).

A Simplified Dial Plan

In many cases, you may just want to route all numbers to an outside trunk. This can be done easily by using the pattern *. You don’t need to fill anything into the replacement field (the system will do this automatically).

Dial Plan with Prefix in Front of the Number

If you use a pattern like 1* in the replacement field, the system will automatically put a 1 in front of the match that it found in the pattern field. In the case when you use the pattern 9* and dial the number 92121234567, the system will automatically convert that into a 12121234567.

A North American Dial Plan

If you use the Vodia PBX telephone system in the fixed-length dial plan of North America, you may use a dial plan similar to the one that follows:

  • 9[911|411]—The first pattern matches the emergency number and the service number explicitly and sends it to the local gateway. It is a good idea to have an entry for these important numbers so that they don’t accidentally get routed to the wrong gateway.
  • 011*— The second pattern matches all international numbers and sends them to a special trunk, which is intended to save costs for international calls.
  • 1*— The third pattern deals with all domestic calls. The fixed-length pattern was used so that the system can actually tell when this number is complete. You could add another pattern like 91978xxxxxxx and send those calls to another trunk if you have negotiated a flat rate with your local PSTN service provider.

Sending Any 10 Digits or 11 Digits Out on the Trunk

Sending Star Codes on a Trunk

Extended regular expressions can also be used when sending star codes on a trunk.

When passing a star (*) to the carrier, a backslash is required before the star (e.g., \*67); otherwise, the system will treat the star and the numbers that follow as a star code. In the sample shown above, a backslash has been placed before the Block Caller-ID (*67) star code, so when the trunk is used, the system will replace the \*67 with a *67, causing the caller-ID to be blocked. (The d in the latter part of the string tells the system to replace it with the domain. If an r had been used, the system would replace it with the registrar.) Important: When using star code patterns in dial plans, you must remove the code from the standard star codes and/or any customized codes. If you’d rather not use star codes in the pattern field but still want to have the dial plan activate a star code, you can use a workaround. You can create a “stand-in” star code that will be used to correlate with the desired star code. In the example shown below, users will need to enter 99 before entering the actual phone number. The system will replace it with the *67 star code. This method allows you to retain the *67 star code as part of the default list of star codes; however, users will need to be informed ahead of time so they that will know to enter 99 before entering the phone number.

Forced Matching

The following dial plan illustrates the use of the caret. It’s being used to force the system to begin matching from the start of user input.

Using the Dial Plan

As you can see, you can create several dial plans and give them different names.

You can select any of these dial plans as a default dial plan for a domain. The setting is Default dial plan in the domain general settings.

When the dial plan for accounts, like extensions (see setting Dial plan), or auto attendants etc., is set as Domain Default, which is the default setting, then the above domain default dial plan will be used for that account.

However, any other dial plan (from the list you created) can be set for each account, like extensions, or auto attendants etc.