Microsoft Teams leverage Media Bypass benefit with Direct Routing configuration. This is basically to shorten the path between Teams client and SBC/PSTN gateway. Normally, voice traffic or media traffic will travel from the Teams client to Media Relay servers in Microsoft Azure and from there routed over the Microsoft Teams backbone out to PSTNHUB (Microsoft Teams Direct Routing Head-Ends) and back down to the SBC.
When SBC/PSTN gateway & client making the call are in same local office. Media traffic can remain local but it will take complex path from local LAN to the cloud and back on-prem. Media Bypass solves this route problem & Media traffic goes straight from the Teams client to the SBC for media traffic. But signaling still remain via M365 Cloud.