Microsoft Teams Direct Routing
Overview
Microsoft Teams Direct Routing lets you connect a certified Session Border Controller (SBC) to Teams Phone, routing calls over your own SIP trunk instead of buying Microsoft Calling Plans. DIDfarm provides the numbers, the SIP trunk, and the PSTN connectivity — you bring the SBC and the Teams tenant.
This approach gives you access to local numbers in 70+ countries at wholesale rates, the freedom to keep numbers when switching platforms, and full control over call routing and failover.
How Direct Routing Works
The call flow is straightforward. When someone dials one of your DIDfarm numbers, the call arrives at the DIDfarm SIP infrastructure, which forwards it to your SBC. The SBC translates the SIP session into a Teams-compatible media stream and delivers it to the assigned Teams user.
Outbound calls follow the reverse path: a Teams user dials a PSTN number, the SBC routes the call to DIDfarm over SIP, and DIDfarm connects it to the public telephone network.
Inbound: PSTN → DIDfarm SIP → Your SBC → Microsoft Teams Outbound: Microsoft Teams → Your SBC → DIDfarm SIP → PSTN
Prerequisites
Before you begin, make sure you have the following in place:
- DIDfarm account with at least one active SIP trunk and numbers assigned
- Microsoft 365 tenant with Teams Phone (Phone System) licenses for each voice user
- Certified SBC — hardware (AudioCodes, Ribbon) or virtual (Oracle, Anynode). See Microsoft's SBC list
- Public IP and TLS certificate for your SBC (Microsoft requires TLS 1.2 with a trusted CA certificate)
- DNS record pointing your SBC FQDN to its public IP
- Teams admin access (Global Admin or Teams Administrator role)
Step-by-step Setup
1 Create a SIP Trunk in DIDfarm
Log in to your DIDfarm portal and navigate to My Numbers → SIP Trunks. Create a new trunk with digest authentication. Note the SIP server address, username, and password — you will need these for your SBC configuration.
Assign the numbers you want to use in Teams to this trunk under DID Routing.
SIP Server: sip.didfarm.com Port: 5060 (UDP/TCP) or 5061 (TLS) Auth ID: your-trunk-username Password: (shown once at creation) Codec: G.711 (PCMU/PCMA), G.729
2 Configure Your SBC
On the SBC, create two SIP trunk connections:
- Teams-facing trunk — connects to Microsoft Teams SIP proxies (
sip.pstnhub.microsoft.comon port 5061 TLS). Configure TLS with your public certificate. - DIDfarm-facing trunk — connects to
sip.didfarm.comusing the credentials from step 1. Register if using digest auth.
Set up routing rules so inbound calls from DIDfarm are forwarded to Teams, and outbound calls from Teams are forwarded to DIDfarm.
3 Add the SBC in Teams Admin Center
In the Teams Admin Center, go to Voice → Direct Routing and add your SBC:
New-CsOnlinePSTNGateway -Fqdn sbc.yourcompany.com ` -SipSignalingPort 5061 ` -MaxConcurrentSessions 10 ` -Enabled $true # Create a voice routing policy New-CsOnlineVoiceRoutingPolicy -Identity "DIDfarm-Policy" ` -OnlinePstnUsages "DIDfarm-Usage" # Create a PSTN usage and route Set-CsOnlinePstnUsage -Usage "DIDfarm-Usage" New-CsOnlineVoiceRoute -Identity "DIDfarm-Route" ` -NumberPattern ".*" ` -OnlinePstnGatewayList sbc.yourcompany.com ` -OnlinePstnUsages "DIDfarm-Usage"
4 Assign Numbers to Teams Users
Assign phone numbers to individual Teams users using PowerShell. The number must be in E.164 format (e.g. +31201234567).
# Assign number and routing policy to a user Set-CsPhoneNumberAssignment -Identity user@yourcompany.com ` -PhoneNumber "+31201234567" ` -PhoneNumberType DirectRouting Grant-CsOnlineVoiceRoutingPolicy -Identity user@yourcompany.com ` -PolicyName "DIDfarm-Policy"
5 Test Calls
Once configuration is complete, test both directions:
- Inbound: Call your DIDfarm number from a mobile phone. The assigned Teams user should ring.
- Outbound: From the Teams client, dial an external number. Verify the caller ID shows your DIDfarm number.
Cost Comparison vs. Calling Plans
Microsoft Calling Plans bundle numbers and minutes into a per-user monthly fee. Direct Routing with DIDfarm separates the infrastructure cost from the calling cost, which is often significantly cheaper — especially for international or multi-country deployments.
| Feature | Microsoft Calling Plans | DIDfarm Direct Routing |
|---|---|---|
| Number availability | Limited countries | 70+ countries |
| Number porting | Locked to Microsoft | Keep your numbers anywhere |
| Per-user cost | From ~$8/user/month + minutes | From ~$1/number/month + usage |
| Multi-country | Separate plan per country | One account, all countries |
| SBC required | No | Yes (hardware or virtual) |
| Call routing control | Basic | Full (failover, LCR, time-based) |
Best Practices
- Use TLS on both sides — encrypt the Teams-facing trunk (required) and the DIDfarm-facing trunk (recommended) for end-to-end SIP security.
- Set concurrent call limits — match the
MaxConcurrentSessionson your SBC gateway to your DIDfarm trunk channel count to avoid oversubscription. - Monitor with CQD — the Teams Call Quality Dashboard shows MOS scores, jitter, and packet loss. Correlate with DIDfarm CDR data for full visibility.
- Use E.164 everywhere — normalize all numbers to E.164 format on the SBC to avoid routing mismatches between Teams and DIDfarm.
- Plan for failover — configure a secondary SBC or a fallback route in your voice routing policy so calls land even during maintenance.
- Keep firmware current — SBC vendors release patches for Teams interop issues regularly. Stay on a Microsoft-certified firmware version.
Frequently Asked Questions
Do I need a Microsoft Calling Plan if I use Direct Routing?
No. Direct Routing replaces the Calling Plan. You still need a Teams Phone (Phone System) license per voice-enabled user, but you do not need a Calling Plan when using your own SIP trunk.
Which SBCs work with DIDfarm?
Any SBC that is certified for Microsoft Teams Direct Routing will work. Popular choices include AudioCodes Mediant series, Ribbon SBC Edge/Core, Oracle Enterprise SBC, and Anynode (software SBC). Virtual SBCs running in Azure or AWS are also supported.
Can I use existing DIDfarm numbers with Teams?
Yes. Assign your existing DIDfarm numbers to a SIP trunk, configure the SBC, and assign the numbers to Teams users. No porting is required.
What codecs does DIDfarm support?
DIDfarm supports G.711 (PCMU and PCMA) and G.729. Teams typically uses SILK or G.722, so the SBC handles transcoding between the two endpoints.
Can I mix Direct Routing users and Calling Plan users?
Yes. Teams supports both in the same tenant. Assign a voice routing policy only to users who should use Direct Routing. Users without the policy will fall through to their Calling Plan if one is assigned.
Ready to connect Teams?
Create a SIP trunk and assign your numbers in minutes.