UPDATE (09-Jan-2013): Least-cost and failover call routing is now built into the Optimizer. See http://manmaza.blogspot.com /2013/01/least-cost-failover-routing-in-optimizer.html" target="_blank">this post for information.
UPDATE (05-Dec-2012): Added true customized local dialing rules for the UK. See this post for information.
UPDATE (31-May-2012): Significant optimizations to North American local rulesets, and fix of normalization rule bug affecting 7-digit dialing rules. See http://manmaza.blogspot.com /2012/05/lync-dialing-rule-optimizer-gets.html" target="_blank">this post for more information.
UPDATE (16-Mar-2012): Now creates separate dialing rules for toll-free and premium calls. Makes it easier to limit dialing to some groups while granting additional dialing rights to others.
UPDATE (29-Feb-2012): Will allow you to run multiple Optimizer output files against a site to provide localized dialing rules for international users. See http://manmaza.blogspot.com /2012/03/localized-dialing-rules-in-lync.html" target="_blank">this post for more information.
UPDATE (17-Feb-2012): Program will now create separate dialing rules/usages for mobile networks in non-North American dial plans. Allows for administrators to easily control who is able to dial mobile numbers, which usually cost more than land-lines.
Introduction
Whenever I've added new features to the Lync Dialing Rule Optimizer, I've created a post outlining the new functionality. This has led to information being scattered across several different posts and isn't readily available. I figured it would be best to create a single, all-encompassing post that outlines how to get the most out of the Lync Optimizer. It will be updated over time as new features are added.
The Lync Optimizer began its life in February 2009 as a locally run VBScript designed to create optimized dialing rules for Dialogic and Audiocodes gateways, as detailed in http://manmaza.blogspot.com /2010/08/dialing-rule-optimizer-for-e164-phone.html" target="_blank">this post dug up from ancient times (2010). Its primary purpose was to figure out what phone numbers were local and which were long distance for any given area. People who knew me would email me the phone number they would want optimized and I would run the program and email the results. The earliest known versions of this code are now archived in the Smithsonian for future historians. It has since grown and evolved into the well-oiled Lync-centric online machine it is today.
There are tons of documentation available on how to setup Enterprise Voice in Lync Server 2010/2013, but reading through them all can be daunting and there is not very much guidance on the WHYs as much there is on the HOWs. The Lync Dialing Rule Optimizer is designed to take care of 95% of the typical setup required to make Enterprise Voice work in Lync Server 2010/2013. It takes advantage of the knowledge gained from multiple deployments from several Lync professionals on the best way to do things in Lync. All this knowledge is funnelled down into a simple set of options that outputs a Powershell script that takes care of almost all the work for you.
For some more background on Lync Enterprise Voice Best Practices, I encourage you to read through some of my posts on the subject:
http://manmaza.blogspot.com /2010/12/enterprise-voice-best-practices-in-lync.html" target="_blank">E.164 Formatting
http://manmaza.blogspot.com /2011/01/enterprise-voice-best-practices-in-lync.html" target="_blank">Normalization
http://manmaza.blogspot.com /2011/01/enterprise-voice-best-practices-in-lync_21.html" target="_blank">Usages and Routes
http://manmaza.blogspot.com /2011/05/enterprise-voice-best-practices-in-lync.html" target="_blank">Extensions
http://manmaza.blogspot.com /2011/11/migrating-pbx-users-to-lync-enterprise.html" target="_blank">Migrating to Enterprise Voice
Tested Scenarios
The Optimizer has been tested to work with the following topology combinations:
- Single central site
- Multiple central sites
- Multiple central sites with multiple branch sites
- Single central site with multiple mediation pools
- Multiple central/branch sites with multiple mediation pools/PSTN gateways
Before you jump in and use the Optimizer, its best to make sure your Lync environment is up to speed.
- Make sure that all your user's phone numbers in Active Directory are in E.164 format, as described in my post on http://manmaza.blogspot.com /2010/12/enterprise-voice-best-practices-in-lync.html" target="_blank">E.164 formatting.
- Make sure you have a PSTN gateway defined in your Lync topology for each Lync site you wish to run the Optimizer.
- Don't mess around with any of the Enterprise Voice sections at this time. It will just complicate your life. If practical, delete any routes/usage/policies you've already defined.
- If you do have existing policies/routes etc. back them up by going to Action - Export Configuration under the Voice Routing section of the Lync Control Panel.
Using the Lync Optimizer
- Ensure the Lync site you wish to apply the rules have at least one PSTN gateway assigned to it. If you don't, the script will not run.
- Go to http://www.LyncOptimizer.com.
- Pick your country from the drop-down list.
- For North American (including Hawaii and Alaska) and Caribbean users, enter the area code and local exchange information for the Lync site you want to apply the script to. For other countries, pick the city or area where your Lync server resides from the list provided.
North American Area Code Selection |
International Area Code Selection (UK example) |
- To use simplified call routing which uses only a single all-encompassing route for all calls, instead of the default local, national, international etc routing, select the Simple Ruleset checkbox. You'll notice the Rule example will update to show the effect on the ruleset. Keep in mind that least-cost routing is not possible in this configuration.
- To force English language rulenames and descriptions for countries that would normally use the local language, select the Force English Rulenames checkbox. This option only appears on countries where the default language is other than English. Again, you'll see the effects on the Rule example line.
- The rule naming convention can be changed if desired. The country abbreviation prefix and rule type suffix can't be modified to ensure least-cost routing calculations can function normally. Select the Change Rulename Base checkbox and type the new rulename base to use for all rules.
- Some countries (Brazil for example) requires a carrier access code to be dialed when dialing long distance phone numbers. If your country requires a carrier access code (Brazil is the only one in the Optimizer so far), you can enter it here. The carrier access code will be added to the dialed number after the national/international access code and before the subscriber number. For example, if you select 19 as the carrier access code, then long-distance numbers will be sent to the PSTN as 019xxxxxxxxx, instead of just 0xxxxxxxxxx.
- If you have to enter 9 (or some other digit) to get an outside line, enter it in the External Access # box. This should only apply to connections to an existing PBX. Don't enter numbers you would normally have to use to make a call from outside the office (ie. 00).
- If you want your users to be able to enter an extension to reach someone, select the Use Extensions checkbox. When you select the checkbox, it will show an Edit Extensions button. Clicking it will bring up the Extension Entry screen.
If none of your users are directly dialable (ie. have to go through a receptionist), then enter the full main phone number and the corresponding extension range. In the above example, if a user dials 244, it will normalize to +14165551111;ext=244. This assumes that you've assigned the phone number to the user in the format tel:+14165551111;ext=244. If you entered it as just 244, this will not work. See my post on http://manmaza.blogspot.com /2011/05/enterprise-voice-best-practices-in-lync.html" style="text-align: center;" target="_blank">Extensions for more information.
If your extension range maps to an external DID, select the DID checkbox and enter the prefix and extension start/end range. This will create a normalization rule that will translate typed extensions to the full DID. As in the above example, if a user dials 3055, the number will be normalized to +14165553055. Again, this assumes you've assigned the phone number to the user in the format tel:+14165553055. If you've used the extension only, this will not work.
You can enter up to 10 extension ranges here. If you need more, please send me a note, and I will see about increasing the limit. Make sure you press Submit when done, or else it won't save your work.
- If you are using a SIP trunk that accepts E.164 phone numbers, select the SIP Trunk Connection option. If selected, the program will not create trunk translation rules. All numbers will be sent to the next hop formated as E.164. It will also set encryption on the trunk to Optional and will disable REFER support, as this is not supported by most SIP providers. Note: Don't select both an external access number AND SIP trunk options. The two options are mutually exclusive.
- If you want Lync to block premium rate phone numbers (like 900 in North America) for all users, select the Block Premium Numbers checkbox. The program will use the Announcement service to let the user know they can't dial those numbers. This will apply to ALL users in the company, so don't use this option if you want to be more selective. See the http://manmaza.blogspot.com /2011/09/block-premium-rate-numbers-with-dialing.html" target="_blank">original post for more information.
- If you want to use the Call Park feature, select the Enable Call Park option. When selected, you will be able to enter a range for the call park orbit. The range must be 2-digits or longer and can include * or # at the beginning. To ensure the call park orbit doesn't conflict with an existing normalization rule, the program will create a Call Park specific normalization rule to make sure those numbers are not normalized to something else. Check out the Call Park Deployment Guide for more information on Call Park.
- If your North American local dialing area supports 7-digit dialing, select the 7-Digit Normalization checkbox. If you're unsure if your local dialing area supports 7-digit dialing, leave this blank. Selecting this option when 7-digit dialing isn't available can lead to unpredictable results. Doesn't apply to other countries other than North America.
- To receive updates should the ruleset change, enter your email address. Only applies to North American users.
- After pressing Generate Rules, wait a minute for the rules to be generated.
- The program will generate a single .PS1 file. Save this file onto your desktop.
- Right-click the .PS1 file and click Properties. Click the Unblock button to allow the script to be run. Alternatively, run the Powershell command Set-ExecutionPolicy -ExecutionPolicy Unrestricted on your Lync server.
- Run the .PS1 file by typing .\Filename.ps1. For the above example, use .\Toronto-ON-416678-Lync.ps1. You will be prompted to select the site to apply the dialing rules.
- If there are multiple mediation pools or PSTN gateways in the specified site, the script will prompt you to select one.
- If the Optimizer detects multiple Lync sites, it will ask if you want to apply least-cost/failover routing to the new voice policies.
- If the Optimizer detects the presence of Lync network sites, it will ask if you want to enable location-based routing at a site (Lync 2013 only). See http://manmaza.blogspot.com /2013/04/location-based-routing-in-lync-optimizer.html" target="_blank">this post for more information. You will also be prompted to select the network site to apply location-based routing, as well as which class of calls to allow users at that site.
- The script will then create all the necessary dial plans, routes, usages etc. to get you going.
- If you have multiple mediation pools and/or PSTN gateways in the site, you can re-run the script and select the other gateway. The script will add the gateway to the existing routes. Calls using that route will round-robin between the gateways.
- If you want least-cost/failover routing applied to all the sites where you've applied Optimizer-generated scripts, run each of the scripts again, ensuring you select the option to configure least-cost/failover routing. It will update the voice policy to include the additional PSTN usages. See http://manmaza.blogspot.com /2013/01/least-cost-failover-routing-in-optimizer.html" target="_blank">this post for more information.
- If you have users from different countries using a single Enterprise Voice deployment, run the Optimizer for each country and run the resulting script. It will create user-level dial plans so those users can have localized dialing rules, as described in http://manmaza.blogspot.com /2012/03/localized-dialing-rules-in-lync.html" target="_blank">this post.
Verifying Settings
To verify the settings were applied properly, go to the Voice Routing section of the Lync Control Panel.
Dial Plan Settings
The script creates a site level dial plan for the site you selected in the script. All users assigned to the Lync servers in that site will have this dial plan automatically applied to them.
Drilling down into the details of the dial plan shows the normalization rules applied to the dial plan. You'll note the External access prefix has been set in this example. For more information on what this does, see my post on http://manmaza.blogspot.com /2011/03/internal-extension-dialing-in-lync.html" target="_blank">internal extension dialing.
The normalization rule for call park is highest in the list (if selected), followed by internal extensions (if selected), then national, international, service and in the specific case of Canada, 310 numbers.
Voice Policy Settings
The script then creates multiple voice policies. Voice policies are used to assign calling features to groups of users. A site-level policy is assigned to everyone by default and allows local, national and international calls. Three user-level policies allow varying degrees of calling rights. The Local policy allows only local calls (excluding mobile phones in non-NA countries), the National policy allows local, mobile and national calling, and the International policy allows all calls, including premium rate calls.
NOTE: If you selected the Simple Ruleset option, then none of this applies, because only a single voice policy that allows all calls is assigned.
The calling rights assigned to each policy is summarized in the table below:
Calling Rights | |||||||
Policy | Local | Service | National | Mobile | Toll-Free | Premium | International |
Site | X | X | X | X | X | X | |
User-Local | X | X | X | ||||
User-National | X | X | X | X | X | ||
User-International | X | X | X | X | X | X | X |
You can elect to change any policy to allow any combination of dialing abilities. You do this by editing the appropriate policy and adding or removing the appropriate PSTN usage records as shown below. You can also change the calling features available to users. You can always create new policies if the default ones don't match your needs.
Routes
Each route created are assigned to a PSTN gateway as selected at the beginning of script execution (if there are more than one choice). If you have multiple PSTN gateways assigned to a mediation pool, you can run the Optimizer script multiple times, selecting a different PSTN gateway each time. The script will add the gateway to each route. With multiple PSTN gateways in a route, calls will round-robin between the gateways.
PSTN Usages
Usages are the links between voice policies and routes. A usage can have multiple routes assigned to it, and can be assigned to multiple voice policies. This provides a very flexible and easily modified structure for voice rules. There are 5 usages for each site (6 for non-NA countries): Local (if local dialing available in selected country), National, International, Mobile (for non-NA countries), Premium and Service. Each usage has the appropriate routes assigned (ie. the Local usage has routes for local, internal and toll-free numbers).
Trunk Configuration
The trunk configuration does final outgoing phone number manipulation before sending the call to the PSTN gateway. Since all phone numbers are coming to the gateway in E.164 format, its simple to strip digits as required. For instance, local calls strip the national prefix, international calls add the international prefix for the selected location, and so on.
If the SIP Connection option was selected in the Optimizer, there will be no modification of outbound phone numbers. Everything will be sent to the SIP provider in E.164 format. Also, REFER support will be turned off, and encryption will be set to Optional.
Blocked Premium Numbers
If you selected the Block Premium Numbers option, the program will automatically setup the unassigned number range and relevant announcement for your country. For more details on this feature see my post on http://manmaza.blogspot.com /2011/09/block-premium-rate-numbers-with-dialing.html" target="_blank">blocking premium numbers in Lync.
Call Park
If you selected the Call Park option, the script will create the relevant call park orbit, and also a normalization rule to ensure the number range is never normalized to something else.
Next Steps
If you only have a single Lync site, then your work is pretty much done. You can enable users for Enterprise Voice and things should work just fine (assuming your PSTN gateway connection is setup properly).
If you have multiple sites, and selected the option to apply least-cost/failover routing, ensure the ordering of the usages meets your requirements. Change the order as required.
Conclusion
This should give you a good overview on what the Lync Dialing Rule Optimizer does. As mentioned earlier, this page will be updated as new features are added. If you have any questions, feel free to drop me a line.
Also, if you find the Lync Optimizer useful, please consider donating using the PayPal link on the bottom of the Optimizer page. I've invested a significant amount of my own time putting this tool together (and continue to do so), and I do have hosting costs to consider.
Also, if you find the Lync Optimizer useful, please consider donating using the PayPal link on the bottom of the Optimizer page. I've invested a significant amount of my own time putting this tool together (and continue to do so), and I do have hosting costs to consider.
Post a Comment