Lync: Voice Route Diagram Creation Script

Lync voice routing boils down to three basic components working in concert to decide call flow. It seems quite simple on paper, you assign voice policies which determine call routes based on PSTN usages (often called the ‘glue’). After looking at Lync voice routing way too many times I finally caved into producing a script to create diagrams of the things over the Thanksgiving holiday weekend.

There are several reasons why it is inherently difficult to visualize call routing in Lync. Firstly, you can have multiple PSTN usages assigned to both voice policies and routes. You can also have multiple gateways on the routes (if you like unpredictable round robin call behavior). Finally, order of the PSTN usages is important. My first iteration of this script spat out individual PSTN usage nodes in the graphs. But I found that connectors between policies/routes and the usages were really hard to follow ordering based on link labels alone. Because of this I had to settle on a multiple table format where the PSTN usages are shown in order on both the policy and route tables then linked together.

The code isn’t really all that pretty but it gets the job done. I found that for some of the multiple site deployments that output became almost undecipherable. So to compensate I’ve included the ability to filter out your results based on voice policy. Of course you can still use * to get all the results included if you like.

Here is sample output for a centralized SIP trunk based greenfield deployment with a primary and a DR PSTN SIP gateway. I’m only showing the policy to route diagram portion as the trunks are included in order in the route table. There are parts which can probably be touched up a little but this is a rather clean implementation of Lync voice.

image

This output is actually quite elegant insomuch that almost every PSTN usage has an associated route. There is almost a one to one relationship between the PSTN Usage and the route. This is on purpose to better control call flow paths. I’d go as far as to say that most deployments of this kind should look similar if planned out and designed correctly.

Here is another example of a partial voice deployment with multiple PBX integrations and least cost routing.

image

The graphs start to look pretty wild when you start performing least cost routing and other fun stuff that are the trademark of decentralized voice routing. I highly recommend filtering by voice policy in these cases to better see specific call flows. I’ve also used a third party function I found to split the route regex pattern down to 20 character lines in the table. This can be modified to suit your needs of course.

This script only creates a base text file for you to feed into graphviz for diagram generation. The default dot generation format should be sufficient to produce fairly decent looking results. You can either install graphviz and run the included graphviz GUI to generate the graphs from this script output or use this portable version of graphviz to do the same. If you save the script to one of your Lync servers and run it without any parameters the default output will be for all voice policies and should spit out a file ‘Lync-Diagrams.txt’ in the directory which it is run.

Side Note: I opted to use a graphviz definition file yet again purely from lack of other good options for the automatic generation of diagrams. I’m open to alternative formats if anyone can provide one that is easy to script out.

The script can be downloaded at the Microsoft Technet Gallery and at my Github repository. As always, I welcome feedback.

Comments (6)

  1. 6:39 AM, 12/15/2014shawn harry  / Reply

    I seemed to have downloaded the incorrect package which was the route of the problem. Not sure how as i downloaded it from Graphviz’s website. Oh well sorted now. Here’s the link i used which may be of use to others:- http://www.graphviz.org/Download_windows.php

  2. 6:05 AM, 12/15/2014ariprotheroe  / Reply

    Also on the trunks you show the TCP and TLS port but not the RepresentativeMediaIP

  3. 5:23 AM, 12/15/2014ariprotheroe  / Reply

    This is awesome, just need to find a plotter now so I can see and read it. Could you add an option to not show the actual trunks (so just to the voice routes with the PSTN gateway name/s)

    • 11:27 AM, 12/15/2014Zachary Loeber  / Reply

      Sure thing, that and your prior requests will be added shortly.

  4. 5:12 AM, 12/13/2014shawn harry  / Reply

    Any idea how to run graphviz? Iv installed the .msi but there doesn’t seem to be a UI or any switches to run the application so i can import the text file? Likewise the Graph Viz portable which is presumably an online version that can generate the diagram doesn’t seem to have any input parameters on the website?

    • 9:20 AM, 12/14/2014Zachary Loeber  / Reply

      Hello,

      Look for an executable called gvedit.exe in the install directory for graphviz. For a default install on my 64 bit Windows 8.1 laptop the path is C:\Program Files (x86)\Graphviz2.34\bin\gvedit.exe. That should allow you to open up and create your diagrams in an intuitive manner. Otherwise you could use the dot.exe command line I suppose..

Leave a Reply

Follow

Get every new post delivered to your Inbox

Join other followers