Design Direct Routing call flows
Direct Routing is a way to provide PSTN (Public Switched Telephone Network) connectivity to Microsoft Teams users so that they can make and receive external phone calls on Teams.
Traditionally, for an organization, internal and external telephone calls are delivered using a Private Branch Exchange (PBX) phone system, often located in the organization’s data center. Microsoft Teams can be used as a business telephony solution, replacing an existing PBX phone system and its associated equipment and costs with a cloud-based system, to provide full PBX voice calling capabilities inside and outside your organization.
To decide if Direct Routing is required answer the following questions, if any are yes, Direct Routing is the right solution for you:
You want to use Teams Phone.
You want to retain your current PSTN carrier and they don't offer Operator Connect
You need to interoperate with third-party PBXs and/or equipment such as overhead pagers, analog devices, and so on
With this Direct Routing:
You connect your own supported Session Border Controller (SBC) to Teams Phone
You can use virtually any telephony carrier with Teams Phone.
You can choose to configure and manage this option, or it can be configured and managed by your carrier or partner (ask if your carrier or partner provides this option).
You can configure interoperability between your telephony equipment—such as a third-party PBX and analog devices—and Teams Phone.
This option requires the following:
Uninterrupted connection to Microsoft 365
Deploying and maintaining a supported SBC
A contract with a third-party carrier for PSTN connectivity
Unless deployed to only provide connection to third-party PBX, analog devices, or other telephony equipment for users who are on Teams Phone with Calling Plan or Operator Connect
If you host your own SBC, you would configure that SBC for Direct Routing. This is different from an SBC hosted by a SIP Trunk provider in that you or a service provider will need to configure the SBC for you ahead of time.
There are multiple ways of associating an SBC; this can be completed through the Graphical User Interface (GUI) or PowerShell. It must be noted the only way to configure a Survivable Branch Appliance is through PowerShell.
There are four steps to configure direct routing. Follow these steps for your deployment:
Connect the SBC with Teams Phone and validate the connection
Enable users for Direct Routing
Configure voice routing
Number Translation
Connect the SBC with Teams Phone and validate the connection
To connect your SBC to Teams Phone, follow these steps:
Navigate to the Microsoft Teams admin center at https://admin.teams.microsoft.com
In the left navigation pane, select Voice and Direct Routing.
Select the SBCs tab and select Add to create a new entry.
Enter a valid FQDN for the SBC.
Note
Make sure the domain name portion of the FQDN matches a domain that's registered in your tenant and keep in mind that the “*.onmicrosoft.com” domain name isn't supported for the SBC FQDN domain name. For example, if you have two domain names, “contoso.com” and “contoso.onmicrosoft.com,” use “sbc.contoso.com” as the SBC name. If using a subdomain, make sure this subdomain is also registered in your tenant. For example, if you want to use “sbc.service.contoso.com,” then “service.contoso.com” needs to be registered.
Configure the following settings for the SBC, based on your organization's needs:
Setting Value Explanation Enabled Off Used to enable this SBC for outbound calls. You can temporarily remove the SBC from service while it's being updated or during maintenance. SIP signaling port 5067 (can be changed during setup) This is the listening port that's used to communicate with Direct Routing by using the Transport Layer (TLS) protocol. Send SIP options On This setting defines if an SBC will or won't send SIP Options messages. If this isn't turned on, the SBC will be excluded from the monitoring and alerting system. We recommend that you enable SIP Options. Forward call history Off Indicates whether call history information is forwarded through the trunk. When you turn this on, the Microsoft 365 or Office 365 proxy sends a history-info and Referred-by header. Forward P-Assisted-Identity (PIA) Header Off Indicates whether the P-Asserted-Identity (PAI) header will be forwarded along with the call. The PAI header provides a way to verify the identity of the caller. Concurrent call capacity 24 When you set a value, the alerting system notifies you when the number of concurrent sessions is 90 percent or higher than this value. If you don't set a value, alerts aren't generated. However, the monitoring system reports the number of concurrent sessions every 24 hours. Failover response Code 408, 503,504 If Direct Routing receives any 4xx or 6xx SIP error code in response to an outgoing Invite, the call is considered completed by default. Outgoing means a call from a Teams client to the PSTN with traffic flow: Team's client -> Direct Routing -> SBC -> telephony network). When you specify a failover response code, this forces Direct Routing to try another SBC (if another SBC exists in the voice routing policy of the user) when it receives the specified codes if the SBC can't make a call because of network or other issues. Failover time (seconds) 10 When set to 10 (default value), outbound calls that aren't answered by the gateway within 10 seconds are routed to the next available trunk. If there are no additional trunks, then the call is automatically dropped. In an organization with slow networks and slow gateway responses, calls might be unintentionally dropped. Preferred country/region for media traffic None Use to manually set your preferred country/region for media traffic. We recommend that you set this only if the call logs indicate that the default assignment of the datacenter for the media path doesn't use the path closest to the SBC datacenter. By default, Direct Routing assigns a datacenter based on the public IP address of the SBC, and always selects the path closest to the SBC datacenter. However, in some cases, the default path might not be the optimal path. This parameter allows you to manually set the preferred region for media traffic. SBC Supports PIDF/LO for emergency calls Off Specify whether the SBC supports Presence Information Data Format Location Object (PIDF/LO) for emergency calls. Ring phone while trying to find the user Off Historically Ring back Bot could be enabled to force a ring signal/audio to be heard by the caller while Teams routed the call to the correct end user. Location-based routing Off Allows for network-based routing to nearest SBC Bypass Mode None Media bypass enables you to shorten the path of media traffic and reduce the number of hops in transit for better performance When you're done, select Save.
You have successfully configured Direct Routing with a Session Border Controller.
The configuration of SBCs can be done through the graphical user interface (GUI) or with PowerShell. The resources section contains how you can configure Direct Routing through PowerShell if necessary.
Enable users for Direct Routing
When you're ready to enable users for Direct Routing, follow these steps:
Create a user in Microsoft 365 and assign Teams Phone license.
Ensure the user is in Teams Only mode
Assign the user Direct Routing Number
Create a user and assign the license
There are two options for creating a new user in Microsoft 365 or Office 365. However, Microsoft recommends that your organization choose one option to avoid routing issues:
Create the user in on-premises Active Directory and sync the user to the cloud. See Integrate your on-premises directories with Microsoft Entra ID.
Create the user directly in the Microsoft 365 admin center. See Add users individually or in bulk to Microsoft 365 or Office 365
If your Skype for Business Online deployment coexists with Skype for Business 2015 or Lync 2010 or 2013 on-premises, the only supported option is to create the user in the on-premises Active Directory and sync the user to the cloud.
Ensure that the user is homed online
This step only applies to Skype for Business Server Enterprise Voice enabled users being migrated to Teams Direct Routing.
Direct Routing requires the user to be homed online. You can check by looking at the RegistrarPool parameter, which needs to have a value in the infra.lync.com domain. It's also recommended, but not required, to change management of the LineURI from on-premises to online when migrating users to Teams Direct Routing.
The user you assigned the voice routing policy to also needs to have a phone number assigned. First, a custom voice routing policy must be assigned, to end users that are enabled for Microsoft Phone. Connect to a Microsoft Teams PowerShell session and run the following command:
Get-CsOnlineUser -Identity "<User name>" | fl RegistrarPool,OnPremLineUriManuallySet,OnPremLineUri,LineUri
Create a custom voice routing policy
Follow these steps to create a new custom voice routing policy:
Navigate to the Microsoft Teams admin center at https://admin.teams.microsoft.com
In the left navigation pane, select Voice and Voice routing policies.
Select Add to create a new entry.
Enter a meaningful name and description for the policy.
Under PSTN usage records, select Add PSTN usage…, and then select the records that you want to add. If you need to create a new PSTN usage record, select Add.
If you added multiple PSTN usage records, arrange them in the order that you want.
When you're done, select Apply.
select Save.
After creating a new custom voice routing policy, you can route calls to the correct session border controller by using the correct voice routing policy.
For examples for further consideration, refer to the reference section - Configure voice routing for Direct Routing.
Number Translation
Sometimes tenant administrators might want to change the phone number for outbound and/or inbound calls based on the patterns they created to ensure interoperability with Session Border Controllers (SBCs), PBXs or telephony providers. You can use the Number Translation Rules policy to translate numbers for the following:
Inbound calls: Calls from a PSTN endpoint (caller) to a Teams client (callee)
Outbound calls: Calls from a Teams client (caller) to a PSTN endpoint (callee)
The policy is applied at the SBC level. You can assign multiple translation rules to an SBC, which are applied in the order that they appear when you list them in PowerShell. You can also change the order of the rules in the policy. To create, modify, view, and delete number manipulation rules, use the New-CsTeamsTranslationRule
, Set-CsTeamsTranslationRule
, Get-CsTeamsTranslationRule
, and Remove-CsTeamsTranslationRule
cmdlets.
To assign, configure, and list number manipulation rules on SBCs, use the New-CSOnlinePSTNGateway
and Set-CSOnlinePSTNGateway
cmdlets together with the InboundTeamsNumberTranslationRules, InboundPSTNNumberTranslationRules, OutboundTeamsNumberTranslationRules, OutboundPSTNNumberTranslationRules, InboundTeamsNumberTranslationRules, InboundPSTNNumberTranslationRules, OutboundTeamsNumberTranslationRules,
and OutboundPSTNNumberTranslationRules
parameters.