Hosted Direct Routing for Microsoft Teams


Pritom Roy


With Direct Routing for Microsoft Teams, you can seamlessly Bring Your Own Carrier (BYOC) for PSTN connectivity to power your on-prem, hybrid, or pure-cloud UCaaS environment. The following guide shows you how to bring your Bandwidth phone numbers to Microsoft Teams using Hosted Direct Routing, where Bandwidth hosts the SBC for you.

Bringing Bandwidth as your carrier of choice to Microsoft Teams allows you to seamlessly migrate your employee communications to the cloud while maintaining greater flexibility over call routing and advanced integrations. Your unified communications platform can easily plug in Bandwidth’s owner-operated network with global reach, giving you direct-to-carrier quality and economics. Learn more about our UCaaS integration for Microsoft Teams, including the option to use Operator Connect for a pure-cloud alternative.

What do I need to get started?

  • A registered Bandwidth account with assigned numbers
  • A running Microsoft Teams Operator Connect Tenant

We also recommend reviewing the Plan Direct Routing guide before getting started.

How does it work?

To connect numbers from your Bandwidth account to Microsoft Teams and enjoy both inbound and outbound calling services with this simple configuration, complete the following steps:

  1. Prepare your Bandwidth account
  2. Prepare your tenant for Hosted Direct Routing
  3. Configure Dynamic E911

Prepare your Bandwidth account

Set up Sub-accounts

Sub-accounts help organize your phone number inventory and make grouping services a little easier.

Set up Locations

Locations help you organize your phone number inventory and configure your integrations for Voice. When a number is added to a Location, it inherits the settings and properties of that Location.

When using Hosted Direct Routing, Bandwidth will set up your Location with all the relevant settings. Once the setup is complete, the Voice settings in your Location will look like this:

Add numbers to the Location

You can add numbers to the Location by ordering them or by moving them from another Location.

Prepare your tenant for Hosted Direct Routing

Set up the domain

The voice routes must be correctly validated before Microsoft Teams can use them. For more information on adding domains to Microsoft 365, see Add a domain to Microsoft 365.

  1. Log into the Microsoft 365 admin center.
  2. In the left-hand panel, go to Settings > Domains and click Add Domain.

  1. Enter the FQDNs provided by Bandwidth.
  2. Select “Add a TXT record to the domain’s DNS” record to verify ownership of the domain. Provide the “txt” record to Bandwidth and we'll confirm when you can validate the domain.
  3. Once completed, the FQDN's status should be “Healthy”.

Add a user to the domain

In order for Microsoft Teams to use the new FQDNs, you must assign a temporary user to each of them. This is required for the SBCs or the voice routes to be successfully added in Teams.

  1. In the left-hand panel, select Users > Active Users
  2. Add a new temporary user.
  3. In the Domains drop-down menu, select the newly created FQDNs.
  4. Make sure a temporary user has been assigned to each of the FQDNs.

Set up Direct Routing

Once the correct FQDNs have been set up, you can proceed with setting up Direct Routing. If you're unfamiliar with Microsoft Teams Direct Routing and the steps required, please review Migrate to Direct Routing before proceeding. For more information, see Configuring Direct Routing.

Although you can do the configuration via the Microsoft Teams admin center, Microsoft recommends using PowerShell when building out Direct Routing and scaling to support a large number of users. To download and install PowerShell visit this page. The instructions for both methods are included below.

Create PSTN usage record

A PSTN Usage Record is a container for voice routes and PSTN usages, which can be shared in different voice routing policies. This is used as a reference in Teams so calls can be associated with Bandwidth. The Identity refers to the default Voice routing policy in Teams called “Global”. For more information, see Call Routing overview.

Via Microsoft Teams admin center

  1. In the left navigation, go to Voice > Direct Routing.
  2. In the upper-right corner, select Manage PSTN usage records.
  3. Click Add.
  4. Enter “Bandwidth US Hosted” and click Apply.

Via Powershell

In a PowerShell session, use the following:

Set-CsOnlinePstnUsage -Identity Global -Usage @{Add="Bandwidth US Hosted"}

Creating voice routes

A voice route is a number pattern and set of online PSTN gateways to use for calls where the calling number matches the pattern. As Bandwidth is hosting the SBC, this configuration can only be done via Powershell and not the Teams admin center.

Via Powershell

In a PowerShell session, use the following:

New-CsOnlineVoiceRoute -Identity "Bandwidth US Hosted" -NumberPattern <Your Pattern> -Priority 1 -OnlinePstnUsages "Bandwidth US Hosted"-OnlinePstnGatewayList <fqdn1>,<fqdn2>

Via Microsoft Teams admin center

You can view your voice route created via Powershell above.

  1. Go to Voice > Direct Routing and select the Voice routes tab.
  2. Click the Bandwidth US Hosted voice route.

Create a voice routing policy

A voice routing policy is a container for PSTN usages, which can be assigned to one or more users.

Via Microsoft Teams admin center

  1. Go to Voice > Voice routing policies and click Add.
  2. Enter “Bandwidth US Hosted” as the name and add a description.
  3. Under PSTN usage records, click Add PSTN usage
  4. Select the "Bandwidth US Hosted" PSTN usage record and click Apply.
  5. Click Save.

Via Powershell

In a PowerShell session, use the following:

New-CsOnlineVoiceRoutingPolicy "Bandwidth US Hosted" -OnlinePstnUsages "Bandwidth US Hosted"

Assigning Dialplan and voice routing policies to user

Assign users the voice policy that will allow them to make calls using the Hosted SBC and match your Enterprise calling requirements.

Via Microsoft Teams admin center

  1. Go to Users > Manage Users and click the user.
  2. Click Policies. Then, next to assigned policies, click Edit.
  3. Under Select Voice routing policy, select the "Bandwidth US Hosted" policy
  4. Click Save.

Via Powershell

In a PowerShell session, use the following:

Grant-CsOnlineVoiceRoutingPolicy -Identity "<User name>" -PolicyName "Bandwidth US Hosted"

The final step is to associate your Bandwidth phone numbers with your Microsoft Teams users. Please make sure that the number is in the E.164 format. For more information, see Enable users for Direct Routing.

Via Microsoft Teams admin

  1. Go to Users > Manage Users and select the user.
  2. Under Account > General information, select Edit.
  3. Under Assign phone number, from the Phone number type drop-down menu, select Direct Routing.
  4. Enter an assigned Bandwidth phone number.
  5. Click Apply.

Via PowerShell

In a PowerShell session, use the following:

Ps> Set-CsUser -Identity "<User name>" -OnPremLineURI tel:<+E164 phone number> -EnterpriseVoiceEnabled $true

There are other optional commands you may want to include in the Set-CsUser string, such as “-HostedVoiceMail $true”.

Configure Dynamic E911

Bandwidth’s Dynamic E911 for Microsoft Teams Direct Routing provides emergency call routing and location capabilities based on the location of the user at the time of the 911 call. For more information on setting this up, see this guide.

Testing calls

Once your setup is complete, we recommend testing both inbound and outbound calls from Microsoft Teams.

  1. Call a PSTN number from a user in Teams and confirm the call connects with two-way audio.
  2. Call the Bandwidth number assigned to a user in Teams and confirm the call is received in Teams with two-way audio.


If you’re still having trouble connecting Bandwidth to Microsoft Teams, here are a few tips:

  1. You can check whether your calls are reaching Bandwidth by looking at your Call History.
  2. If you see a call record on Bandwidth with an error message, open a ticket with your Bandwidth Support Team.
  3. To troubleshoot issues with Direct Routing, you can run a diagnostic tool in the Microsoft Teams admin center to validate that a user is correctly configured for Direct Routing in Microsoft Teams.
  4. You can monitor the availability of your SBC and check Call Quality Analytics within Microsoft Teams. For more information, see Monitor Direct Routing.

Article is closed for comments.