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 Direct Routing.

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?

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 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.

  1. Log into the Bandwidth Dashboard.
  2. In the top navigation bar, click Account and select Locations.
  3. Click Create Location.
  4. Under Settings, complete the following fields:
    • Name: Enter the name for this Location. This field is required but can contain anything that makes sense to the Location provisioning.
    • Description: Add an optional description for this Location.
    • Sub-Account: Select a Sub-account that you want to associate with this Location.
    • Default location: Turn this switch on if you'd like this to be the primary Location. This means that when you order or port a number, this Location will appear first after you select your Sub-account.


  1. Select the Voice tab and complete the following steps (for more information on managing voice settings, see this support article).
    • Under Routing, click Add Route. Then select Route to IP & Port, enter the IP addresses of your SBC, and click Save.
    • Under Termination hosts enter the IP addresses of your SBC for Termination hosts.
  2. Click Create Location.


Add numbers to the Location

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

Prepare your tenant for Direct Routing

Set up the domain

The FQDNs of your SBCs 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 Setting > Domains and click Add Domain.


  1. Enter the FQDNs of your SBCs.
  2. Select "Add a TXT record to the domain’s DNS" record to verify the ownership of 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 user to each of them. This is required for the SBCs or voice routes to be successfully added in Teams.

  1. In the left-hand panel, select Users > Active Users
  2. Add a new user or select an existing one.
  3. In the Domains drop-down menu, select the newly created FQDNs. Ensure the user has an E5 license assigned.


Set up Direct Routing

Once you've set up the correct FQDNs, you can proceed with setting up Direct Routing. If you're unfamiliar with Teams Direct Routing and the required steps, please review Migrate to Direct Routing before proceeding.

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.

Connect your SBC

The first step is to connect your certified SBC to Teams Direct Routing. For more detailed information, see Connect your Session Border Controller (SBC) to Direct Routing.

Note: If you plan on using TLS, please complete the required Bandwidth questionnaire.

Via Microsoft Teams admin center

  1. In the left navigation, go to Voice > Direct Routing, and then click the SBCs tab.
  2. Click Add.
  3. Enter the "FQDN" for your SBC.
  4. Configure the settings based on your SBC. Some settings are required by Bandwidth, including: 
    • "Send SIP Options" is "On". 
    • "SIP signaling port" is “5061”.
    • "Forward call history" is “On”.
    • "SBC supports PIDF/LO for emergency calls" is “On”.
  5. Click Save.


Via PowerShell

In a PowerShell session, use the following, replacing the settings based on your SBC:

New-CsOnlinePSTNGateway -Fqdn <SBC FQDN> -SipSignalingPort <SBC SIP Port> -MaxConcurrentSessions <Max Concurrent Sessions the SBC can handle> -Enabled $true -SendSIPOptions $true -ForwardCallHistory $true -PidfLoSupported $true

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 that calls can be associated with Bandwidth. The Identity refers to the default Voice routing policy in Teams called “Global”. For more detailed 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” and click Apply.


Via PowerShell

In a PowerShell session, use the following:

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

Create voice routes

A voice route is a number pattern and set of online PSTN gateways used for calls where the calling number matches the pattern.

Via Microsoft Teams admin center

  1. Go to Voice > Direct Routing and select the Voice routes tab.
  2. Click Add and then enter a name and description for the voice route.
  3. Set the priority and specify the dialed number pattern.
  4. To enroll an SBC with the voice route, under SBCs enrolled, click Add SBCs. Then select the SBC created earlier and click Apply.
  5. Optional: To add PSTN usage records, under PSTN usage records, click Add PSTN usage. Then select the PSTN records you want to add and click Apply.
  6. Click Save.


Via PowerShell

In a PowerShell session, use the following:

New-CsOnlineVoiceRoute -Identity "Bandwidth US" -NumberPattern <Your Pattern> -OnlinePstnGatewayList <SBC FQDN> -Priority 1 -OnlinePstnUsages "Bandwidth US"

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” as the name and add a description.
  3. Under PSTN usage records, click Add PSTN usage.
  4. Select the "Bandwidth US" PSTN usage record and click Apply.
  5. Click Save.


Via PowerShell

In a PowerShell session, use the following:

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

Assign Dialplan and Voice routing policies to the user

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

Via Microsoft Teams admin center

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


Via PowerShell

In a PowerShell session, use the following:

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

Associate Bandwidth DIDs to Microsoft Teams users

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 center

  1. Go to Users > Manage Users and select the user.
  2. Under Account > General information, click 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 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.