Voice routing for Teams Direct Routing explained

Direct Routing for Microsoft Teams is great. The voice routing configuration for Direct Routing, however, isn’t the easiest concept in the world to understand. I’d like to help people understand it to get the most out of Microsoft Teams voice. So here is my attempt on explaining the topic.

Before we begin, I’m more of a PowerShell guy than GUI when it comes to Team config. So this article will be based on configuring voice routing with PowerShell.

Key concepts

Online Voice Routing Policy – This is what we aim to create. This is the policy, or policies, to be assigned to user accounts to tell them where/how to route their calls. We’ll use the next 3 elements to contruct Online Voice Routing Policies.

Online PSTN Gateway – This is the reference, or pointer, to your Session Boarder Controller (SBC).

Online Voice Routes – Define the number pattern to match for routing purpose, using the good old RegEx, and associate it with the destination SBC.

Online PSTN Usage – A container, for Online Voice Routes, that can be referenced by different Online Voice Routing Policies.


Single route – This is the simplest form. All calls are sent to one SBC.

Load Balance – Same type of calls are sent to multiple SBCs for resiliency or load sharing.

Failover – Same type of calls are sent to a preferred SBC, and get rerouted to a backup SBC(s) when the preferred SBC is unavailable.

Least Cost Routing – When multiple SBCs in different countries and regions are available, calls can be routed based on the destination country to the in-country SBC. (Please be mindful of local legislation in this area.)


Single Route

This is the simplest form of call routing. Only 1 SBC in the topology and all calls are routed to that 1 SBC.

First of all, we need to create the Online PSTN Gateway and an Online PSTN Usage. You’ll see that the Online PSTN Usage record is placed in a “Global” container. This container is literally here to hold these PSTN Usage records. You can’t change the name or create a new one with a custom name.

Next, we create an Online Voice Route. The RegEx number pattern here is saying “anything start with a + sign, followed by minimum 3 digits”. This is pretty much all phone numbers in E.164 format. Then associate it with our one and only SBC, and assicate the Online Voice Route with our Online PSTN Usage that we created in the previous step.

Next, we can contruct the Online Voice Routing Policy by creating a new one and add our Online PSTN Usage to it.

The last thing to do is assign our new Online Voice Routing Policy to the users.

Load Balance

When you have multiple SBCs at hand, you can create the voice routing config to route the same type of calls to multiple SBCs for resiliency or load sharing. Well, technically, this is probably more “resiliency” than “load sharing” because Microsoft’s official wording is “the SBCs in the routes are tried in random order”.

First, we need to create multiple Online PSTN Gateways and our Online PSTN Usage. In our example, we have an SBC in the UK and one in the US.

Next, we create our Online PSTN Route with the same catch-all RegEx pattern, but this time with 2 SBCs associated instead of 1. And then associate the Online Voice Route with the Online PSTN Usage that we created in the previous step.

To construct the Online Voice Routing Policy, we can simply pick up the Online PSTN Usage that we have just created and drop it in to a new Online Voice Routing Policy.

Finally, assign the policy to all users who need to be using Direct Routing.


What if you don’t want “the SBCs in the routes are tried in random order”? What if you want to set a preference in the routes? Like in our example, we have an SBC in the UK and one in the US. If the majority of our user base is in the UK and Europe, we’d want to use the UK SBC as the primary route and the US node as a failover route.

There are a few things that we need to do differently to achieve this.

Instead of creating 1 Online Voice Route with the catch-all RegEx pattern and associate it with 2 SBCs, we need to create 2 Online Voice Routes and each has 1 SBC associated.

The voice routes are weighed. By default, the ones get created ealier has a higher priority but you can change this later by using the “-priority” switch in the “Set-CsOnlineVoiceRoute” cmdlet.

Next, same as before, drop the Online PSTN Usage into a new Online Voice Routing Policy.

Now the policy is ready to be assiged to the users.

Least Cost Routing (LRC)

When you have mulitple regional SBCs available, you have the option to take advanage of Least Cost Routing. For example, if we have 3 SBCs in 3 different locations: US, UK and China. We could configure voice routing in such way that when our users call one of those countries the calls are routed via the SBC in the corresponding country, and therefore charged at national instead of international rate. Please be mindful, though, that not all countries in the world allow such configuration to bypass local telco. Please check local legislation before implementing such configuration.

Firstly, let’s create our 3 SBCs and our Online PSTN Usages. As shown in the diagram below that this time we are creating a lot more Online PSTN Usages than the scenarios above. This is because that for each country we want to specify the per country LCR routes at the top and everything else get routed via the “local” SBC.

Next, we need to create some Online Voice Routes, 6 in fact. 3 regional routes, each with spcified country codes (+1 for US, +44 for UK and +86 for China) and associated with the corresponding in-country SBC; and 3 catch-all routes for each country. We zoomed in on one of the Online Voice Routes.

We now need to construct 3 Online Voice Routing Policies, one for each country. The zoomed-in example below is the UK policy where calls to the US (+1) are routed to the US SBC, calls to China (+86) are routed to the China SBC and everything else are routed “locally” to the UK SBC.

Now we assign the Voice Routing Policies to the users in the corresponding countries.

Of course, you can mix n’ match with these configurations – e.g. LCR + Load Sharing, or LCR + Failover, etc.

I hope I have made it a bit easier to understand with the examples and diagrams. Have fun with Teams voice!

Reference: https://docs.microsoft.com/en-us/microsoftteams/direct-routing-voice-routing

Join the Conversation

1 Comment

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create your website with WordPress.com
Get started
%d bloggers like this: