The Dialing Rule Optimizer for Communications Server 2007 R2 and Lync Server 2010
Published May 20 2019 02:41 PM 1,138 Views
Occasional Visitor
First published on TECHNET on Nov 15, 2010

Abstract: The Dialing Rule Optimizer enables administrators to easily configure North American local dialing numbers for a given area code and exchange , and then format them for use as IP telephony gateways with Microsoft Office Communications Server 2007 R2 and Microsoft Lync Server 2010 communications software.

Author: Chris Norman

Publication date: November 2010

Product version: Microsoft Office Communications Server 2007 R2 and Microsoft Lync Server 2010

Keywords: Dialing Rule Optimizer, Lync Server 2010, OCS 2007 R2, Translation Patterns

Because legacy PBX and some service providers do not support RFC3966 (E.164), moving to E.164 in Microsoft Communications Server 2007 R2 can sometimes be a tricky situation. Communications Server 2007 R2 Mediation Server can identify and remove the + from outbound PSTN or PBX calls by using data found in the SIP invite. But sometimes this is not enough.  . Additional digit manipulation may be necessary when:

  • Steering digits are required by a legacy PBX to route calls to long distance trunks.

  • Steering digits are required by a legacy PBX to remove the country code for local calls.

  • Removal of leading country codes digits for local calls is required by a Service provider.

In Communications Server 2007 R2 the most common way to overcome these issues is to use a gateway to apply translation rules to outbound calls or to make significant changes in routing of legacy PBXs. Both of these options require decentralizing the Communications Server dial plan and can require significant configuration of gateways.

Microsoft Lync Server 2010 communications software addresses this issue by replacing the need to configure translation patterns in gateways or PBXs with the new trunk translation feature. The requirement to configure translation patterns from E.164 compliant to non-compliant remains unchanged.

The Dialing Rule Optimizer web tool, developed by Ken Lasko (Buchanan Technologies) and Clive Graven (Microsoft), significantly reduces configuration time by taking advantage of a freely available internet service called Local Calling Guide . The Local Calling Guide uses an XML interface. This interface allows applications to query a database of North American local calling area codes. This query generates a list of free calling areas for any given area code. When a user enters an area code, the Dialing Rule Optimizer sends an XML query, to the Local Calling Guide. The Local Calling Guide returns the free calling areas minus the North American country code. The current version supports generating rules for Lync Server 2010, Dialogic, and AudioCodes gateways.

The rules generated for Lync Server 2010 also include the required PowerShell commands for a new voice route and required translation rules. The translation rules generated for AudioCodes and Dialogic gateways are design for either Communications Server 2007 R2 or Lync Server 2010. The rules are formatted to meet the text input requirements of the gateways. Another great feature of this online tool is its ability to notify you when changes are made to area codes for which you have generated rules.

The generated rules are compressed to be as efficient as possible. Look at the example in the following section. The Dialing Rule Optimizer used regular expressions to reduce the required number of translation rules to a minimum.

Lync Server 2010 Example

Figure 1 represents the web interface used to generate the required translation rules. The example used was a Seattle area code 206-766 for Lync Server 2010.

Figure 1. Dialing Rule Optimizer Web interface

The output shown below illustrates a usage record, voice route, and translation rule generated for Lync Server 2010.

Set-CsPSTNUsage -Identity global -Usage @{Add='NA-WA-Seattle-Local'}

New-CSVoiceRoute -Name 'NA-WA-Seattle-1' -Description 'Least cost routing for Seattle, WA' -PSTNUsages 'NA-WA-Seattle-Local' -NumberPattern '(\+1425(?!([01]|(22[0245])|(23[1289])|(25[2789])|(26[1235678])|(29[023479])|(2(10|12|44|49))|(31[245679])|(32[01278])|(33[02345789])|(35[035679])|(3(03|04|08|74|77|79|85|87|88|96|97|99))|(4(05|07|22|23|34|38|41|46))|(5(01|08|12|13|14|83|85))|(7(10|17|50|54|83|89))|(8(70|76|79|86|88))|(90[35])|((280|367|418|493|530|551|609|610|622|631|645|669|737|740|760|791|831|923|931|948|953|971))|((34|54)))))|(\+1253((21[4678])|(23[4679])|(24[3569])|(2(61|66|69|70|75|77))|(33[23456])|(39[4578])|(3(50|51|72|73))|(4(78|79|80|86|87))|(56[139])|(65[2367])|(73[3567])|(7[04])|(7(65|66|93|96|97))|(83[3589])|(85[02469])|(8[01])|(8(72|74|76|80|86|87))|(9(31|39|41|45|46))|((205|220|288|293|315|326|347|437|449|458|499|508|518|642|661|670|681|773|785|867|893|929|951|981))|((52|63))))|(\+1206(([23456789])))'

# By default, the following command will create the translation rule in the Global container.  Please make sure

# this will not affect existing translation rules before continuing.  Ideally, create a new container and change the

# -Parent to match before running this command.

New-CSOutboundTranslationRule -Parent Global -Name 'NA-WA-Seattle-1-Local' -Description 'Removes +1 for local calls to Seattle, WA' -Pattern '\+1((425(?!([01]|(22[0245])|(23[1289])|(25[2789])|(26[1235678])|(29[023479])|(2(10|12|44|49))|(31[245679])|(32[01278])|(33[02345789])|(35[035679])|(3(03|04|08|74|77|79|85|87|88|96|97|99))|(4(05|07|22|23|34|38|41|46))|(5(01|08|12|13|14|83|85))|(7(10|17|50|54|83|89))|(8(70|76|79|86|88))|(90[35])|((280|367|418|493|530|551|609|610|622|631|645|669|737|740|760|791|831|923|931|948|953|971))|((34|54)))))|(253((21[4678])|(23[4679])|(24[3569])|(2(61|66|69|70|75|77))|(33[23456])|(39[4578])|(3(50|51|72|73))|(4(78|79|80|86|87))|(56[139])|(65[2367])|(73[3567])|(7[04])|(7(65|66|93|96|97))|(83[3589])|(85[02469])|(8[01])|(8(72|74|76|80|86|87))|(9(31|39|41|45|46))|((205|220|288|293|315|326|347|437|449|458|499|508|518|642|661|670|681|773|785|867|893|929|951|981))|((52|63))))|(206(([23456789]))))' -Translation '$1'


Lync Server 2010 and Communication Server 2007 R2 effectively leverage online tools, like the Dialing Rule Optimizer, to reduce first-time setup complexity. This focus on interoperability enables Lync Server to seamlessly integrate with legacy systems that are not E.164 compliant.

You can connect to the tool at .

Lync Server 2010 Resources

We Want to Hear from You

Version history
Last update:
‎May 20 2019 02:41 PM
Updated by: