Erwin Bierens

Knowledge is Power

Setup Direct Routing with Microsoft teams

2019-12-09 2 min read Microsoft Teams

Direct Routing lets you connect a supported, customer-provided Session Border Controller (SBC) to the Microsoft Phone System. With this capability you can configure on-premises PSTN (bring your own sip trunk, BYOT) connectivity with your Microsoft Teams client.

There are a couple of certified SBC vendors you can use to setup Direct Routing.

  • Audiocodes
  • Ribbon
  • AnyNode
  • Thinktel

What do you need?

In order to setup Direct routing you will need to have some prerequisites:

  • Public IP address
  • Domain
  • Public trusted certificate
  • Session Border Controller
  • Phone system licenses for users

Public IP address

A public IP address that can be used to connect to the SBC.

Most of the SBCs are able to support NAT.


A public DNS entry mapping the SBC FQDN to the public IP Address.

For example:

You cannot use the domain

Public Trusted Certificate

A certificate for the SBC, this will be used for encrypted communication with Direct Routing.

Session Border Controller

Make sure you will use a supported SBC, you can find supported SBCs over here


In order to use Direct Routing you will need to have a “Phone System” license on top of your Microsoft Teams + Skype for Business Plan 2

For example: if you have a E3 license you will need to add the Phone System license on top of it.

When using E5, the Phone System license is already included.

Configuring your Tenant

Setup a PowerShell connection to your tenant

$cred = Get-Credential
$TeamsSession = New-CsOnlineSession -Credential $cred
Import-PSSession $TeamsSession -AllowClobber

Import-Module SkypeOnlineConnector
Import-Module MicrosoftTeams

Create PSTN gateway

New-CsOnlinePSTNGateway -Fqdn -SipSignallingPort 5068 -MaxConcurrentSessions 30 -Enabled $true

Check if everything went well: Get-CSOnlinePSTNGateway

Create PSTN Usage

Set-CsOnlinePstnUsage -Identity Global -Usage @{Add = "PU-NATIONAL", "PU-INTERNATIONAL", "PU-UNRESTRICTED"}

Create Voice Routes

In belows example we’ve created three Voice Routes for Dutch numbers.

New-CSOnlineVoiceRoute -Identity "VR-NATIONAL" -NumberPattern "^\+31(\d{9,10})$" -OnlinePstnGatewayList -Priority 1 -OnlinePstnUsages "PU-NATIONAL"
New-CSOnlineVoiceRoute -Identity "VR-INTERNATIONAL" -NumberPattern "^\+(\d{12,13})$" -OnlinePstnGatewayList -Priority 2 -OnlinePstnUsages "PU-INTERNATIONAL"
New-CSOnlineVoiceRoute -Identity "VR-UNRESTRICTED" -NumberPattern ".*" -OnlinePstnGatewayList -Priority 3 -OnlinePstnUsages "PU-UNRESTRICTED"

Create Voice Routing Policies

New-CSOnlineVoiceRoutingPolicy "NATIONAL" -OnlinePstnUsages "PU-NATIONAL"
New-CSOnlineVoiceRoutingPolicy "INTERNATIONAL" -OnlinePstnUsages "PU-INTERNATIONAL"
New-CSOnlineVoiceRoutingPolicy "UNRESTRICTED" -OnlinePstnUsages "PU-UNRESTRICTED"

Enable users for Direct Routing

Set-CsUser -Identity -EnterpriseVoiceEnabled $true -HostedVoiceMail $true -OnPremLineURI tel:+31884460000

Grant-CsOnlineVoiceRoutingPolicy -Identity -PolicyName Tag:UNRESTRICTED


comments powered by Disqus