Introduction to MS Teams Direct Routing
Setting up phone calling for Microsoft Teams using our Direct Routing configuration couldn’t be simpler. Our PowerShell wizard integrates directly with your Teams account to automate and streamline what would otherwise be a complex setup. The only things you’ll need are your Teams Domain and Teams Phone licensing, and we take care of the rest: DNS, users, phone numbers, PSTN, and routing information.
Useful guides before you start
- Introduction to Microsoft Teams for admins
- Microsoft Teams Help & Learning
- Manage Teams with Microsoft Teams PowerShell
1. Set up licensing for users
Enabling phone services for Microsoft Teams requires specific licences for each user:
-
Enterprise licensing: add either an E1, E3, or E5 licence for a user, and this will provide the functionality you need to enable phone services for that user.
-
Teams Phone Standard: this add-on is required to enable phone services. Any licence that includes Microsoft Teams can purchase a Teams Phone Standard licence to activate phone services.
Here's where to set this up:
- Sign into Microsoft 365 admin center (as an admin).
-
Select Billing > Licences.
2. Adding Teams-enabled numbers
Back on SIPcity's portal, if you're adding new numbers to your account, head to Switchboard, select Add Number, and follow the prompts. Have a look at the Adding Numbers article for more details. Otherwise, or once the new numbers have been added, you can move on to the next steps.
-
Log into your account.
- Go to Switchboard and select the number you want to use MS Teams with.
-
Under the Number Details tab, select Teams in the Type dropdown.
-
Click on Save to apply the changes to the number.
3. Connect your SIPcity & Microsoft accounts
Use our PowerShell wizard to generate the necessary pwsh
scripts to finalise your Direct Routing setup.
-
Go to Tools > Teams.
-
Select PowerShell to open the step-by-step instructions. The first page will get you started on how to use PowerShell with Microsoft Windows and macOS operating systems.
3.1 Connect to MS Graph
Open a PowerShell window and connect to your Microsoft 365 tenant using the Microsoft Graph API.
#: Install-Module Microsoft.Graph #: Connect-MgGraph -Scopes "User.ReadWrite.All","Domain.ReadWrite.All"
3.2 Create Domain
Use the New-MgDomain
cmdlet
to add a domain.
#: New-MgDomain -BodyParameter @{Id="ms50000100.teams.yourcloudtelco.com.au";IsDefault="False"}
3.3 Get TXT Record
#:$MgVerificationCode = (Get-MgDomainVerificationDnsRecord -DomainId "ms50000100.teams.yourcloudtelco.com.au" | Where-Object {$_.RecordType -eq "Txt"}).AdditionalProperties.text #: echo $MgVerificationCode
Domain validation TXT record: this record is generated by Microsoft to validate your unique address against our DNS. Copy and paste the record into Add TXT dialog to insert the record.
3.4 Confirm the domain
You need to confirm the domain with Microsoft. Run this command:
#:Confirm-MgDomain -DomainId "ms50000100.teams.yourcloudtelco.com.au"
Following confirmation, we will remove the TXT
record from our Cloudflare DNS.
Important: we have provided a 5-minute window to complete this step. If you're unable to confirm the domain in the allocated time, you can repeat this confirmation step at a later date.
4. Create Users
-
Go to the Microsoft Admin Center, then Users and Add a user.
-
Temp User: Microsoft requires a “temporary user” to associate with the trunk domain. This temporary user requires a Office 365 Business license.
-
Trunk domain: Select from the dropdown menu (e.g.
sbc@ms50000100.teams.yourcloudtelco.com.au
). -
Click Next.
5. Create PSTN
-
Go to Tools > Teams.
-
Select PowerShell.
5.1 Connect to MS Admin
Open a PowerShell window and connect to your Microsoft 365 tenant using the Microsoft Graph API.
#: Install-Module Microsoft.Graph
#: Connect-MgGraph -Scopes "User.ReadWrite.All","Domain.ReadWrite.All"
5.2 Create PSTN Gateway
Use the New-CsOnlinePSTNGateway
cmdlet
to create a PSTN gateway. You'll need to specify the parameters required for the gateway, including the FQDN (Fully Qualified Domain Name) and other configuration details.
#: New-CsOnlinePSTNGateway -FQDN ms50000100.teams.yourcloudtelco.com.au -SIPSignalingPort 5061 -MaxConcurrentSessions 100 -Enabled $true
5.3 Verify the PSTN Gateway
Use New-CsOnlinePSTNGateway
to verify that the PSTN gateway has been created.
#: Get-CsOnlinePSTNGateway
6. Associate Users
6.1 Connect to MS Admin
Open a PowerShell window and connect to your Microsoft 365 tenant using the Microsoft Graph API.
#: Install-Module Microsoft.Graph #: Connect-MgGraph -Scopes "User.ReadWrite.All","Domain.ReadWrite.All"
6.2 Routing configuration
Paste the commands to set up the PSTN identity and Voice route details.
#: Set-CsOnlinePstnUsage -Identity Global -Usage @{Add="VOIP"}
#: New-CsOnlineVoiceRoute -Identity "VOIP" -NumberPattern ".*" -OnlinePstnGatewayList "ms50000400.teams.sipcity.com.au" -Priority 1 -OnlinePstnUsages "VOIP"
#: New-CsOnlineVoiceRoutingPolicy -Identity "VOIP" -OnlinePstnUsages "VOIP"
6.3 Associate users
If you have more than one user, you’ll need to assign a phone number to each of your Teams users using the following commands. The example below assumes that our example user, joe@sipcity.com.au, will be assigned the phone number +61 (2) 5550 0000, with the Identity set to “VOIP”.
Replace the following commands as required for your own circumstances.
#: Set-CsPhoneNumberAssignment -Identity joe@sipcity.com.au -PhoneNumber +61255500000 -PhoneNumberType DirectRouting #: Grant-CsTeamsCallingPolicy -PolicyName AllowCalling -Identity joe@sipcity.com.au #: Grant-CsOnlineVoiceRoutingPolicy -Identity joe@sipcity.com.au -PolicyName "VOIP" #: Set-CsOnlineVoicemailUserSettings -Identity joe@sipcity.com.au -VoicemailEnabled $false
6.4 Disconnect from MS Teams (optional)
Optionally, run the following command to disconnect your PowerShell instance.
#: Disconnect-MicrosoftTeams
All sorted! Your SIPcity account should now be fully set up and connected to your Microsoft 365 account.
Microsoft Teams, Microsoft Windows and PowerShell are trademarks or registered trademarks of Microsoft Corporation in the US and other countries. macOS is a registered trademark of Apple Inc.