Tuesday, May 31, 2011

Major Upgrade to Dialing Rule Optimizer

If you've used the Dialing Rule Optimizer, you probably know how easy it makes it to create your North America least-cost routing rules for Lync.  After much work, I'm proud to unveil new functionality that will automate the process even more.

Originally, the Optimizer created a simple text file that you would copy and paste into Lync Powershell.  It would create the phone usage, route and trunk translation rules necessary for least cost routing for a given site.  If you input the name or IP address of your PSTN gateway, it would set it in the route, but if not, then the route would not be associated with a gateway.  The process was not very tolerant of errors either.  If you mistyped the name of the PSTN gateway, much of the script would fail.  The original output got you started, but you were still left to your own devices for pretty much everything else.

With this latest release, the Optimizer will provide you with a ready-made Powershell .PS1 script that will do the following:
  1. Prompts you for a site to apply the script to
  2. Checks for a PSTN gateway assigned to the site.  If one isn't found, the program will quit.
  3. Creates a site-level Voice Policy (unless one already exists).
  4. Creates standardized site-level normalization rules for local/long distance/international as per my Normalization Best Practices post.  If your site is in Canada, creates normalization rule for 310 toll free calls.
  5. Creates separate PSTN Usages for Local, National and International and adds them to the Voice Policy as per my Usages and Routes Best Practices post.
  6. Determines the PSTN gateway associated with the site. If no PSTN gateway is defined in the topology, you'll have to assign the routes and trunk translation rules manually after you set one up.
  7. Creates routes for local, national, international, toll-free, and service numbers (411, 911 etc).  If your site is in Canada, creates an additional route for 310 calls.
  8. Assigns those routes to the default PSTN gateway in the site.
  9. Creates trunk translation rules for local calls, national and international calls.  If you entered an external dialing prefix on the web page, it will take this into account as well.  If you select the SIP Trunking option, then the trunk translation rules are not applied.
Preparation for the script is also much simpler.  All you need to do beforehand to get the most out of the script is to ensure that your sites all have a PSTN gateway assigned.  The script looks at the site and will try to apply the routes and translation rules to the default PSTN gateway assigned to that site.  If one isn't available, the script will still work, but you will have some manual labour to do afterwards.

Detailed Instructions
  1. Ensure all your Lync sites have a default PSTN gateway assigned to it
  2. Go to http://www.LyncOptimizer.com
  3. Pick your country from the drop-down list.  Only a few are available now, but more will be added over time.
  4. Enter the area code information for the site you want to apply the script to
  5. If you have to enter 9 (or some other digit) to get an outside line, enter it in the appropriate box.
  6. If you are using a SIP trunk that accepts E.164 phone numbers, select the Using SIP Trunk option.  If selected, the program will not create trunk translation rules.  All numbers will be sent to the next hop formated as E.164. Note: Don't select both an external access number AND SIP trunk options.  The two options are mutually exclusive. 
  7. If you want Lync to block premium rate phone numbers (like 900 in North America) for all users, select the Block Premium Numbers checkbox.
  8. 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. Doesn't apply to other countries.
  9. To receive updates should the ruleset change, enter your email address.  Only applies to North American users.
  10. After pressing Generate Rules, wait a minute for the rules to be generated.
  11. The program will provide 2 files.  The .PS1 file will do almost everything to get you up and running.  The .TXT file provides only the least-cost routing rules for North American users, and assumes you will be doing most of the other work.
  12. Save the .PS1 file to your Lync server, start up the Lync Management Shell and run the script.
  13. You will be prompted for the site to apply the rules to (as below).  Select the appropriate site and in a few seconds you'll have all you need to get started.
Here's what the Optimizer looks like for North American users:

Here's what it looks like for international users:
The International Optmizer doesn't have to do the same level of processing that it needs to do for North American numbers.  There is a clear deliniation between local and long distance calls, which makes creating rulesets much simpler.  Since the dialing rules aren't expected to change over time, you can't enter an email address for non-North American rule updates. Also, since this is designed as a Lync-only feature, you cannot (nor should you need to) create rulesets for the Dialogic or Audiocodes gateways.

Run the Optimizer once for each site, and apply the resulting .PS1 file.  The finished output should take care of all your basic external dialing scenarios using my best practices as laid out in my Enterprise Voice Best Practices posts.  You will just have to add normalization/routing rules for internal use as you see fit.

Below are some screenshots of what a virgin, never-touched Lync Enterprise Voice implementation will look like after applying the script (this example uses Toronto as the location).

Dial Plan

Voice Policy

Routes

Usages

Trunk Configuration (If SIP Trunk Option NOT Selected)

Blocked Premium Numbers (if selected)

The blocked premium number list is customized for each country.  The actual announcement can be customized either by using text-to-speech or audio files.  See this blog post for more information.
To provide failover and least cost routes for multiple sites, simply add the appropriate PSTN usages to your Voice Policies as desired.  Use this post as a guide for how to provide least-cost and failover routing between multiple sites.

If you still prefer to do things manually, or you already have a voice deployment you're happy with, the original script format is still included as a .txt file.  It will create the bare minimum PSTN usages and routes for least-cost routing.

I hope you find this useful.  Please let me know if you have any problems or questions.  If you find a bug in the script, PLEASE let me know so I can fix it.

9 comments:

  1. Ken - Thanks for this it is really useful. You may like to make an adjustment to the UK-National Normalization -Pattern '^0([12]\d{6,})$ to account for our 'interesting' phone system here to ^0([1235789]\d{6,}).
    1 - Geographic
    2 - Geographic
    3 - Non Geographic
    5 - Corporate Numbering & VoIP
    7 - Mobile (Cell) Phone & WiFi
    8 - Freephone and Local/National Rate
    9 - Premium Services

    Thanks for the great tool, especially it's extension into the UK.

    ReplyDelete
  2. Thanks for the update. I've updated the UK national normalization rule.

    ReplyDelete
  3. Hi Ken,

    Thanks for this great tool. I spotted the following in the help content: "If you select the SIP Trunk option and also try to enter an external access number, the program will produce an error. SIP trunks should never require any sort of external access number to access." I was hoping to configure Lync to *tolerate* users dialling a "9" prefix as it's a large environment and retraining everyone to drop "9" before they dial out will take time. Is it not valid to add an external prefix even though we will be using SIP trunks? My understanding is that Lync will allow the number with or without the prefix per your previous post:

    "If you enable [a prefix], then when a Lync deskphone user makes a call in off-hook mode (either by picking up the handset or pressing the speakerphone button before dialing), they should dial a 9 for external numbers. What really happens in the background is when 9 is pressed, Lync will ignore any normalization rule that is labeled as "Internal extension". The actual digit 9 is ignored and not used when applying your other normalization rules."

    Thanks,
    Garry

    ReplyDelete
  4. Hi Garry,
    If you select an external access number in the Lync Optimizer, it will do 2 things: it will assign that number in the dial plan (for the reasons stated in that post you're referencing) and it will also ensure that all outbound calls are pre-pended with that number before being sent to the next hop.

    If you want to still allow users to try to dial 9 first, but not have that number actually sent to the SIP provider, all you need to do is to set 9 in the External access prefix box in the Dial plan. This will achieve what you are describing.

    Ken

    ReplyDelete
  5. how do i apply the file ps1? in powershell

    thanks by the way

    ReplyDelete
  6. Copy and paste the contents of the .PS1 file into a new .PS1 file created with Notepad on your Lync front-end server. Save it and run it with the Lync Command shell.

    Ken

    ReplyDelete
  7. You sir, are awesome. It took me a little bit to figure out how to execute the script, because it said it was "unsigned". So I copied it to a new txt file and changed it to a powershell script, and then I opened up the Lync powershell, and activated the script by doing the following:

    cd C:\

    I then modified the script name so that there were no spaces and entered the whole path into the shell:

    C:\Awesome-Dial-Plan-Over9000.ps1

    Thought I'd share what I did to get it to execute since some of us are relatively new to powershell and Lync.

    ReplyDelete
  8. Thanks for the note Chris.

    I will include this information in an upcoming complete guide to the Lync Optimizer. Currently, things are scattered all over the place, so I will be consolidating into one complete post.

    Ken

    ReplyDelete
  9. Hi Ken, first I can't thank you enough, a very valuable tool, a massive time saver for newbies like me.

    I noticed one thing though, the UK-TollFree normalization rule does not seem to work (0500405060 for instance normalizes to +440500405060) but the call fails with an audio message saying the number is not in service. I've re-run the tool several times with same results. Could this be a problem with rule or could it be an issue with my SIP trunk provider?

    Many thanks in advance.

    Carl

    ReplyDelete