Source record · tier 2 current vendor documentation
Configure Local Media Optimization for Direct Routing
- Publisher
- Microsoft
- URL
- https://learn.microsoft.com/en-us/microsoftteams/direct-routing-media-optimization-configure
- Published
- 2026-09-10
- Updated
- unknown
- Accessed
- 2026-09-16
- HTTP status
- 200
- License
- not stated on page; Microsoft Learn Terms of Use apply; no-redistribution; short excerpts and locators only
Source notes citing this source
- Because a user can have multiple endpoints, support of SIP 183 is not possible on inbound bypassed calls and Direct Routing always uses 180 Ringing in that case. in context
- Local Media Optimization is configured from the same network settings used by Location-Based Routing and dynamic emergency calling: trusted IP addresses, network regions, network sites and network subnets, plus a virtual topology that assigns SBCs to sites with a mode and a proxy SBC. in context
- For Local Media Optimization the -MediaBypass parameter must be set to $true, and if the SBC does not have the -BypassMode parameter set then X-MS headers will not be sent. in context
- In split-tunnel VPN scenarios where the Teams client is detected as external but can still reach the internal interface of the Direct Routing SBC, Microsoft signals the external location to the SBC, which can cause prolonged call setup and in some cases no audio on inbound PSTN calls; the page says VPN administrators must block access between remote VPN users and the SBC internal interface. in context
- When BypassMode is defined, Direct Routing adds X-MS-UserLocation (internal or external), X-MS-MediaPath (the ordered SBC list for the media path, with the final SBC always last) and X-MS-UserSite (the tenant administrator's site string) to SIP INVITEs and re-INVITEs, and the Request-URI targets the SBC FQDN. in context
- Always Bypass is the simplest LMO mode to configure, and the tenant administrator can configure a single site for all users and SBCs if all SBCs are reachable from any site. in context
- If an SBC does not have -BypassMode set, Direct Routing does not send the X-MS headers that Local Media Optimization relies on. in context
- LMO configuration parameters are case sensitive, so GatewaySiteID values such as "Vietnam" and "vietnam" are treated as different sites. in context
- Configuring Local Media Optimization requires configuring the user and SBC sites (external trusted IPs, network regions, sites and subnets, then assigning SBCs to sites with modes and proxy values) and configuring the SBCs per the SBC vendor's specification; the network part can be done in the Teams admin center or PowerShell. in context
- The LMO virtual network topology is defined by creating each SBC with New-CsOnlinePSTNGateway and then setting -GatewaySiteID, -MediaBypass, -BypassMode (Always or OnlyForLocalUsers) and -ProxySBC with Set-CsOnlinePSTNGateway. in context
- On an inbound LMO call the user's location is unknown to the SBC, which offers local media candidates by default and must send a re-INVITE if the user turns out to be external; Direct Routing calculates the media path from the Record-Route and Contact fields the SBC supplies. in context
- When Local Media Optimization and Location-Based Routing are configured together, each downstream SBC must have GatewaySiteLbrEnabled set to $true; this is not mandatory for the proxy SBC. in context
- The -MediaBypass parameter must be set to $true for an SBC to support Local Media Optimization. in context
- In Microsoft's Always-bypass examples, an outbound call from an internal user at the downstream site carries X-MS-UserLocation: internal and X-MS-MediaPath naming only the downstream SBC, while an external user's call carries X-MS-UserLocation: external and X-MS-MediaPath listing the proxy SBC then the downstream SBC. in context
- For a single SBC (the central SBC with centralized trunks scenario), -ProxySBC must be set either to $null or to that SBC's own FQDN; Microsoft's example sets the proxy SBC itself with -ProxySBC $null and each downstream SBC with -ProxySBC set to the proxy's FQDN. in context
- The LMO network topology is defined with New-CsTenantNetworkRegion, New-CsTenantNetworkSite (each site tied to a region) and New-CsTenantNetworkSubnet (each subnet tied to exactly one site). in context
- For Local Media Optimization, the external internet IPs that Teams clients use to reach Microsoft 365 must be added for every site with LMO users using New-CsTenantTrustedIPAddress, with mask 32 for single IPv4 addresses, 128 for IPv6, and both families added if Microsoft 365 sees both. in context
- With split-tunnel VPN, a client detected as external is signalled to the SBC as external even if it can reach the SBC's internal interface, which can cause prolonged call setup or no audio on PSTN calls; Microsoft says VPN administrators must block access between remote VPN users and the SBC internal interface. in context
- When BypassMode is defined, Direct Routing adds X-MS-UserLocation (internal or external), X-MS-MediaPath (the ordered SBCs for the media path, target SBC last) and X-MS-UserSite (the administrator-defined site) to INVITEs and re-INVITEs, and puts the target SBC FQDN in the Request-URI even when that SBC is not directly connected. in context
Cite this source record
APA
WarmTransfer. (2026, September 10). Configure Local Media Optimization for Direct Routing. WarmTransfer. https://warmtransfer.net/knowledge/sources/ms-learn-dr-media-opt-configure
BibTeX
@misc{warmtransfer-ms-learn-dr-media-opt-configure,
title = {Configure Local Media Optimization for Direct Routing},
author = {{WarmTransfer}},
year = {2026},
url = {https://warmtransfer.net/knowledge/sources/ms-learn-dr-media-opt-configure},
note = {Microsoft, accessed 2026-09-16}
}