What is a Dialing Rule
Dialing rules are created to modify a phone number before sending it to the PBX for outbound calls. Dialing rules serve two purposes:
1. Specify the numbers that can be dialed as outbound calls internal or external. Administrators specify the number format that can be dialed and any number that do not fall into any specified dialing rule are rejected. Dialing rules act a "white-list" for outbound calls.
2. Modify the number before sending it out to the PBX. Dialing rules will strip numbers from, or add numbers to telephone numbers. Often times this is done to add the 'Trunk Access Code' to external numbers. This is also done to add or remove 'in country' code for long distance or local numbers.
A caller can make outbound calls from the UM server in the following manner:
? Play on phone feature
? Call someone from directory search (accessed from Pilot Number or 'Contact Someone' menu option)
? Call someone from auto attendant directory search
? Call someone from personal contact
The number format for the phone number will not be the same for all of these scenarios. Dialing rules can be used to modify the user's input to a format that meets telephone system requirement.
Dial group is a collection of one or more dialing rules. Dial groups allow administrators to organize similar rules into one group. The 'name field for each dialing rule actually specifies the name of the 'dialing group' that the rule belongs to. Multiple rules can have same name, which makes them part of the same dialing group. For example, lets say we created one dialing rule named 'local' for area code '704', and another one, also named 'local' for area code '980'. Both these dialing rules will belong to the same dialing group called 'local'.
Unified Messaging server has 2 kinds of dialing groups – 'In country or region' for calls within the country or region and 'International' for international calls.
Syntax for creating Dialing Rule
Dialing rule consists of 4 fields – name, number mask, dialed number, and comment. The 'comment' field is optional. The 'name' is the name of the dialing group. The 'number mask' is the number that the user dials and the 'dialed number' is the number that is sent by the UM server to the VOIP Gateway or IP-PBX. Following are the syntax to create dialing rules:
1. For each rule, specify a name, 'number mask', and 'dialed number'. Wild cards can be used for 'number mask' and 'dialed number'.
2. Wild card 'x' can be used to designate any number between 0-9. The number of 'x' should match the number of digits of the phone number. For example, when creating a rule for all the numbers in the 425 area code you can write 425xxxxxxx to indicate that it is a 10 digit number.
3. Wild card '*' can be used to designate any number or numbers. When this wild card is used it does not have to be matched with the number of digits. For example, to include all the numbers within area code 425, the format 425* can be used.
4. When two rules have same specification but one uses "x" as a wild card and the other one uses "*" as a wild card, the one with "x" will take precedence. For example, the rule with '425xxxxxxx' will take precedence over the rule with '425*'.
Dial Group and Dialing Rules in Unified Messaging
For Exchange 2007 unified messaging, dialing rules are configured within the dial plan scope. Each dial plan has 2 parameters called 'ConfiguredInCountryorRegionGroups' and 'ConfiguredInternationalGroups'. These parameters act as a repository for dialing rules for 'in country' and 'international' calls respectively. After configuring the dialing rules in these parameters, they can be applied within the scope of UM Mailbox Policy object, or UM Auto Attendant object or the Dial Plan object.
In the following example, we are typing in management shell command to query all the configured rules within the dial plan 'CorpDialPlan'.
PS] C :\> (get-umdialplan corpdialplan).configuredInCountryorRegionGroups
Low rate calls
Low rate calls
Low rate calls
Long distance calls
Long distance calls
In this example, there are three dial groups – 'local' and 'low-rate' and 'long-distance'. The fields 'NumberMask' and 'DialedNumber' comprise the actual dialing rule. The dial group 'local' has two rules, the first rule, removes the 'in-country' prefix '1' from all numbers that start with area code '704'. The purpose of this dialing rule is to make sure all numbers with area code '704' are treated as local calls. The other rule works the same way for area code 980.
Creating Dialing Rules
Prior to setting the rules on outbound calls, you have to create the rules and load them in the dial plan. Within the dial plan there are 2 parameters called 'ConfiguredInCountryorRegionGroups' and 'ConfiguredInternationalGroups'. These parameters act as a repository for all the dialing rules. After storing the dialing rules in these parameters, you can apply them on a UM object such as Dial Plan, UM Mailbox Policy or Auto Attendant through the 'AllowedInCountryorRegionGroups' and 'AllowedInternationGroups' parameter. When setting values for these two parameters only refer the dialing groups by name.
Set-UMDialPlan CorpDialPlan –AllowedInCountryorRegionGroups low-rate
Lets take a look at the rules in table 1, there are 3 rules or entries, for dialing groups 'low-rate'. When you apply the 'low-rate' dial group, all three rules within this group will be used for outbound dialing when 'low-rate' is applied.
Steps to set Outbound Dialing Rules
There are two steps involved in setting the dialing rules:
1. First step is to load dialing rules in the dial plan. You can use the Exchange Management Console to create and store the rules. You can also create a CSV file with all the rules and then load them to the dial plan object using Exchange Management Shell Command.
2. Second step, is to apply one or more rules to a UM object. Rules can be applied to dial plan, or UM Mailbox Policy, or Auto Attendant object. UM Mailbox Policy and Auto Attendant have to be linked to the dial plan where you stored the rules. The rules are referred by the 'dialing group' name as the values for the 'AllowedInCountryorRegionGroups', or 'AllowedInternationalGroups' parameter.
Step 1: Storing the rules in Dial Plan Object
In this step you will store all the dialing rules in the dial plan. They will be stored in the 'ConfiguredInCountryorRegionGroups' parameter for the 'in country' dialing rules and 'ConfiguredInternationalGroups' parameter for international dialing rules.
Using Exchange Management Console
Following are the steps to load dialing rules using Exchange Management Console:
1. Open the properties of the 'Dial Plan' object and go to the 'Dialing Rule Groups' tab (figure 2).
2. Click on the 'Add' button and a new window 'Dialing Rule Entry' will pop-up (Figure 3).
3. Add the name of the 'dialing group', 'number mask' and 'dialed number' for a dialing rule. The 'comments' field is optional.
4. If you are adding a rule to an existing dialing group then first select the dialing group from the 'name' drop down list and then add rest of the fields.
Dialing Rule Groups tab in Dial Plan properties
Dialing Rule Entry Page
Using Exchange Management Shell
You can use the 'set' command to load the rules in the 'ConfiguredInCountryorRegionGroups' parameter. If you have a large number of rules you may want to import the rules from a CSV file.
Loading Rules using 'set' command
You can load each rule individually using the 'set' command –
Set-UMDialPlan "DialPlanID" –ConfiguredInCountryorRegionGroups "Local,91704*,9704*,local calls"
After running this command the 'ConfiguredInCountryorRegionsGroups' attribute will have one entry.
Following set of commands can be used for adding a new rule to these parameters -
$DialGroup= (get-UMDialPlan "DialPlanID").ConfiguredInCountryorRegionGroups
Set-UMDialPlan "DialPlanID" –ConfiguredInCountryorRegionGroups $DialGroup
After running this command the 'ConfiguredInCountryorRegionGroups' attribute for dial plan 'DialPlanID' will have following two entries:
Importing rules from CSV file
You will create the rules in a CSV file based on the instruction in the following section and then import the CSV file within the dial plan. Following is the command:
Set-UMDialPlan "DialPlanID" –ConfiguredInCountryorRegionGroups $(IMPORT-CSV c:\dialrules\incountry.csv)
In this example the data in the incountry.csv file will populate the 'ConfiguredInCountryorRegionGroup' parameter of Dial Plan in the AD.
In order to retrieve all the data from the 'ConfiguredInCountryorRegionGroup' attribute, use the get command and export the data in csv file:
(Get-UMDialPlan –id "DialPlanID").ConfiguredInCountryorRegionGroups | EXPORT-CSV C:\incountry.csv
Create CSV File
You need to create a file with all the dialing rules in correct format before loading it on dial plan. Following are the guidelines in creating the CSV file –
- First line of the csv file must include the names of the field – name, numberMask, DialedNumber, comment. The field names are separated by comma and there should not be any space between them.
- Each line in the CSV file represents one entry. Each entry will have four fields which are separated by 'comma', these fields are - Name, Number Mask, dialed number and comment. The comment field is optional.
- There should not be any space between the text entry and the comma for next field.
- Do not put any blank lines in between the fields or the rows.
- Do not have any blank lines at the beginning or end of the CSV file.
Following is an example of 'in country' dialing rules CSV file:
Any,91*,91*,Open access to in-country numbers
Following is an example of 'international' dialing rules CSV file:
International, 901144*, 901144*, international call
International, 901133*, 901133*, international call
After loading the rules in the dial plan repository object you need to apply the rules to make them effective. You can apply the rule in the following UM objects:
In the previous step you have uploaded the rules to the dial plan. The rules have populated 'ConfiguredInCountryorRegionGroups' and/or 'ConfiguredInternationalGroups' attributes of the dial plan. Each rule belongs to a dial group and when you apply the settings, you can specify the rule only by the name of the dial group.
You can apply the dialing rule at 'Dial Plan' level by using Exchange Management shell commands, this feature is not available EMC. After you have loaded the rules in the dial plan you can run the following command to apply the rules at dial plan level:
Set-UMDialPlan "MyDialPlan" –AllowedInCountryorRegionGroups "low-rate","local"
After running this command, all the rules within these two dialing groups will be set as the "allowed groups" within the dial plan.
UM Mailbox Policy
When you configure restriction on UM Mailbox Policy, the rule applies to all the users within the policy.
You can use the following command to set the rule for a policy:
Set-UMMailboxPolicy MyUMPolicy –AllowedInCountryorRegionGroups "Low-Rate"
If you want to allow multiple groups then you have to include them all in the command, the 'set' command does not append entries, it only replaces it.
Set-UMMailboxPolicy MyUMPolicy –AllowedInCountryorRegionGroups "low-Rate","long-distance"
You can also use the Exchange Management shell to set the restrictions.
Follow these steps:
1. Open the properties page of the UM Mailbox Policy
2. Go to the tab 'Dialing Restrictions'
3. Click the 'Add' Button to add the allowed groups
You can set restrictions on "in country" or 'International" dialing groups for any auto Attendant. These rules will take into affect when an anonymous caller calls the Auto Attendant pilot number. You have to specify the name of the 'dial group' that is configured on the dial plan. For Example, if you created an Auto Attendant called 'CorpAA' which is linked to 'CorpDialPlan' then you can specify the groups that are already configured on the dial plan 'CorpDialPlan'. In the following example there is a 'dialing group' called "low-rate" configured in the dial plan that 'CorpAA' is linked to. You have to apply the rule using the following Exchange Management shell command:
Set-UMAutoAttendant CorpAA –AllowedInCountryorRegionGroups "low-rate"
Similarly, for international groups you can run the following command:
Set-UMAutoAttendant CorpAA –allowedInternationalGroups "call-Japan"
When the command executes it will set the values for AllowedInCountryorRegionGroups for the Auto Attendant to all the entries for "low-rate" dialing group.
Order or priority of the rules will determine how they are going to be applied. All the dialing rules are stored as dialing groups in the 'AllowedInCountryorRegionGroups' parameter and they are referred by the dialing groups. The order is determined in 2 cycles. The rules are sorted out first from most specific to least specific and then they are applied from top to bottom. Following is the detailed information:
1. The rules sorted out from 'ConfiguredInCoutryGroups' repository field of Dial Plan, based on the ones that are mentioned in the 'AllowedInCountryorRegionGroups' field. For example,
PS] C:\> (get-umdialplan corpdialplan).ConfiguredInCountryorRegionGroups
low rate call
low rate call
low rate call
low rate call
PS] C:\> (get-umdialplan corpdialplan).AllowedInCountryorRegionGroups
In this example, for the 'ConfiguredInCountryorRegionGroups' we have three dialing groups – 'local', 'low-rate', 'long-distance' and in the 'AllowedInCountryorRegionGroups' you have one entry – 'low-rate'. First, all the rules for dialing group 'low-rate' are sorted out.
2. After gathering the rules in step 1, the rules are sorted so that the number mask is from most specific to the least specific. For example if you have following 3 rules:
After sorting it will look like:
3. After sorting in step 2, the rules are applied from top to the bottom of the list to the number that is entered by the user and apply the one that is the first match. So for the example, in step 2, if a user enters '94253334444' as a 'Play on Phone' number, the second rule from the list will be applied and the number that will be sent out by UM server to the PBX is '93334444'.
Context of Rule Application
From the above discussion, dialing rules can be set at dial plan level, or Auto Attendant level or UM Mailbox Policy level. Following table illustrates how they are applied –
Caller logged on to mailbox
UM Mailbox Policy
Called the main pilot number
UM Dial Plan
Called the Auto Attendant pilot number
Play on Phone
UM Mailbox Policy (prior to build 8.0.650 it is Dial Plan)