Setup Direct Routing with Microsoft teams

Posted by     "Erwin Bierens" on Monday, December 9, 2019

TOC

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.

Domain

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

For example: sbc.contoso.com

You cannot use the contoso.onmicrosoft.com 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 https://docs.microsoft.com/en-us/microsoftteams/direct-routing-border-controllers

Licenses

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 sbc.contoso.com -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 sbc.contoso.com -Priority 1 -OnlinePstnUsages "PU-NATIONAL"
New-CSOnlineVoiceRoute -Identity "VR-INTERNATIONAL" -NumberPattern "^\+(\d{12,13})$" -OnlinePstnGatewayList sbc.contoso.com -Priority 2 -OnlinePstnUsages "PU-INTERNATIONAL"
New-CSOnlineVoiceRoute -Identity "VR-UNRESTRICTED" -NumberPattern ".*" -OnlinePstnGatewayList sbc.contoso.com -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 user@contoso.com -EnterpriseVoiceEnabled $true -HostedVoiceMail $true -OnPremLineURI tel:+31884460000

Grant-CsOnlineVoiceRoutingPolicy -Identity user@contoso.com -PolicyName Tag:UNRESTRICTED

comments powered by Disqus