Teams - Direct Routing Set up

5 min. readlast update: 05.17.2024

We can have teams work with our Hosted Platform. You'll need to ensure you have the following licenses.

If Key2 IT handles your Office 365 Account, they will automatically apply this license. If you're using another company to control/manage your Office 365 Account, you'll need to reach out to them to ensure the license is applied before we can enable Teams Calling.

  • Valid Office 365 Account
  • Microsoft Teams Phone Standard
  • Create a subdomain A record that points to our SBC. Key2 will provide you with the IP address to point the record to. Example of subdomain pbx.yourcompany.com

If Key2 IT handles your account, we will work with them to complete everything on your behalf. If your IT team or company manages your Office 365 account, they will need to follow the steps below to enable Teams Calling.

Your MSP will need to follow the steps below on how to set up Microsoft Direct Routing.

First, you will need to add the subdomain to your Microsoft Admin portal.  This will be under Settings > Domains.

You'll need to add the subdomain that was created by your team. ie pbx.yourcompany.com

Next, you will need to open up a Powershell to do the following steps. You can do this in the Teams Admin Center, but we recommend doing this through Powershell.  **If you get any privileges errors, please open Powershell with Admin privileges. Right-click and run as administrator.

----Install Teams Module via PowerShell. Only needs to be ran once from your computer ----

Install-Module -Name PowerShellGet -Force -AllowClobber
Install-Module -Name MicrosoftTeams -Force -AllowClobber
Set-ExecutionPolicy -ExecutionPolicy Unrestricted <-- without this the next command won't work
Import-Module MicrosoftTeams

----End of Install Teams Module ----

If you need to reconnect to the PowerShell, you do not need to run the command above again; you will need to open PowerShell and run the following command.

Connect-MicrosoftTeams

Next, we will need to create the SBC connection. Where it says pbx.yourcompany.com, you'll need to update this to reflect your company.

New-CsOnlinePSTNGateway -Identity pbx.yourcompany.com -Enabled $true -SipSignalingPort 5061 -MaxConcurrentSessions 100

Depending on how many user's you have, you'll need to adjust the -MaxConfurrentSessions. If you have under 100 users, you can keep it at 100; however, if you have more than 100, please change this to match your amount of users. This can be updated later if needed.

In the following command, we will verify.

Get-CsOnlinePSTNGateway -Identity pbx.yourcompany.com

Create a usage plan and create a Policy

Set-CsOnlinePstnUsage -Identity Global -Usage @{Add="Usage1"}

New-CsOnlineVoiceRoutingPolicy "Policy1" -OnlinePstnUsages "Usage1"

The following commands will need to be run for each user that is using Teams.

Get-CsOnlineUser -Identity "user@yourcompany.com" | fl RegistrarPool
Set-CsPhoneNumberAssignment -Identity user@yourcompany.com -PhoneNumber "100" -PhoneNumberType DirectRouting
Grant-CsOnlineVoiceRoutingPolicy -Identity "user@yourcompany.com" -PolicyName "Policy1"

Where it says -PhoneNumber, you will need to enter the user's extension number.

This will verify the policy for the user.
Get-CsOnlineUser "user@yourcompany.com" | select OnlineVoiceRoutingPolicy

The following command only needs to be completed once.

Set-CsOnlinePstnUsage -Identity Global -Usage @{Add="Usage1"}
New-CsOnlineVoiceRoute -Identity "10-digit" -NumberPattern "^\1(\d{10})$" -OnlinePstnGatewayList pbx.yourcompany.com -OnlinePstnUsages "Usage1"
New-CsOnlineVoiceRoute -Identity "11-digit" -NumberPattern "^\1(\d{11})$" -OnlinePstnGatewayList pbx.yourcompany.com -OnlinePstnUsages "Usage1"

The following command will determine your extension length—i.e. 3-digit, 4-digit or 5-digit extension numbers. Please adjust to your environment.
New-CsOnlineVoiceRoute -Identity "Route1" -NumberPattern "^\+(\d{3})|^(\d{3})" -OnlinePstnGatewayList pbx.yourcompany.com -Priority 1 -OnlinePstnUsages "Usage1"

Next, you'll need to log in to the Teams Admin Center

Go under Voice > Dial Plans, then click on Global (Org-Wide default)

 

You will need to add the following to the Normalization rules. Click on Add

 

When you click on Add, a sidebar will show on the right. You'll need to create two new rules.

The first one we will do is a 10-digit number

Name: 10digit
Rule creation mode: Advanced
If Condition: ^(\d{10})$
Then do this: 1$1

Please enter a 10-digit phone number to verify the test (it will not dial out. It will confirm the number you input is valid E.164 Number)

Next, we will do the 11-digit

Name: 11digit
Rule creation mode: Advanced
If Condition: ^(\d{10})$
Then do this: 1$

Name: International
Rule creation mode: Advanced
If Condition: ^(\d{15})$
Then do this: 1$

 

These make it easier for the user to input a number. If they do a number with a 1 in front of the number and it's not needed, it will remove the 1 automatically. Then if the 1 is required, it will add it at the front for the user.

**If you want to dial international numbers, you'll need to add the following

Next, you're going to want to add an option for dialing extensions if you have VoIP Phones. If you have some staff that will have physical phones or if you're installing any VoIP devices, you'll need this option.

This option will be for your extension dialing, ie 3-digit dialing.

If your company is using 4-digit extensions, please copy this info and change the 3 to a 4.

**Note 3-digit extensions/dialing should always be added as it's needed for calling 911 or other 3-digit service numbers.

 

Once this is completed, you should be able to make and receive calls.

To test making calls, please look at this link | Teams - Making a Call

We should have supplied a temp DID for testing; please call that number and dial your extension to verify incoming calls.

If you need further assistance, please reach out to our team at support@key2.ca

 

Was this article helpful?