Skip to main content

Microsoft Teams Direct Route - Knowledgebase / Microsoft Teams x SipCity - SIPcity Help Centre

Microsoft Teams Direct Route

Authors list

Microsoft Teams Direct Route

Onboarding MS Teams phone calling using our Direct Route configuration couldn't be easier. Our PowerShell wizard integrates directly into your Teams account to automate and simplify what is otherwise a complicated setup. Our only prerequisite's are your Teams Domain and Teams Phone licensing and we handle the rest; DNS, users / phone numbers and finally all PSTN and routing information.

Useful guides on getting Microsoft Teams


Admin and PowerShell


1. Licensing Summary

To enable Phone services for Microsoft Teams requires a 'phone system license' for each users:

  1. Sign into Microsoft 365 admin center (as Admin)

  2. Select Billing > Licenses

This step by step guide illustrates a 'vanilla' customer new to Teams and looking to signup to Teams with a single mapping 1 phone line.)

2.1 Add MS Teams Numbers

  1. Log into your account.

  2. Go to Switchboard Select > Add Number.

  3. Select Area Code  >  Number Type > MS Teams.

  4. Click on Add to save settings and add the chosen number to your account.

3.0 PowerShell wizard

Use our PowerShell wizard to generate the necessary pwsh scripts to complete your Microsoft Teams Direct Route setup.

  1. Go to Tools Select > Teams.

  2. Select PowerShell


3.3 Get TXT Record

#:$MgVerificationCode = (Get-MgDomainVerificationDnsRecord -DomainId "" | Where-Object {$_.RecordType -eq "Txt"}).AdditionalProperties.text

#: echo $MgVerificationCode

Domain validation TXT record: This record is generated by Microsoft to validate your customers unique address against our DNS. Copy the record into the ADD TXT dialog to insert the record.

3.4 Domain confirmation

#:Confirm-MgDomain -DomainId ""

Time to complete: 04:59

Following confirmation we will remove the confirmation TXT record from our CloudFlare DNS.

NB -- We have provided a 5 minute window to complete this step. If, you are unable to confirm the domain in the allocated time, you can repeat this 'Confirmation' step at a later date.


4. Create Users

  • Microsoft Admin Center:  | Users  |  'Add a user'

  • Temp User: Microsoft require a 'temporary user' to associate with the trunk domain. This temporary user requires one Office 365 Business license.

  • Trunk domain: Select from the drop down menu (e.g.

  • Click Next.

MS Teams - Add New user

5. Create PSTN

  • Go to Tools Select > Teams.

  • Select PowerShell  >  4. Create PSTN PowerShell


5.1 Connect to MS Admin

#: Install-Module Microsoft.Graph

#: Connect-MgGraph -Scopes "User.ReadWrite.All","Domain.ReadWrite.All"

Open a PowerShell window and connect to your Microsoft 365 tenant using the Microsoft Graph API.


5.2 Create PSTN Gateway

#: New-CsOnlinePSTNGateway -FQDN -SIPSignalingPort 5061 -MaxConcurrentSessions 100 -Enabled $true

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.


5.3 Verify the PSTN Gateway

#: Get-CsOnlinePSTNGateway

Use the New-CsOnlinePSTNGateway to verify that the PSTN gateway has been created.


6.0 Associate Users


6.1 Connect to MS Admin

#: Install-Module Microsoft.Graph

#: Connect-MgGraph -Scopes "User.ReadWrite.All","Domain.ReadWrite.All"

Open a PowerShell window and connect to your Microsoft 365 tenant using the Microsoft Graph API.


6.2 Routing configuration

#: Set-CsOnlinePstnUsage -Identity Global -Usage @{Add="VOIP"}

#: New-CsOnlineVoiceRoute -Identity "VOIP" -NumberPattern ".*" -OnlinePstnGatewayList "" -Priority 1 -OnlinePstnUsages "VOIP"

#: New-CsOnlineVoiceRoutingPolicy -Identity "VOIP" -OnlinePstnUsages "VOIP"

Paste the commands to set up the PSTN identity and Voice route details.


6.3 Associate users

#: Set-CsPhoneNumberAssignment -Identity "userEmail" -PhoneNumber +phoneNumber -PhoneNumberType DirectRouting

#: Grant-CsTeamsCallingPolicy -PolicyName AllowCalling -Identity "userEmail"

#: Grant-CsOnlineVoiceRoutingPolicy -Identity "userEmail" -PolicyName "VOIP"

#: Set-CsOnlineVoicemailUserSettings -Identity "userEmail" -VoicemailEnabled $false

If you have more than a single user then you will need to now map a phone number to each of your Teams users using the following commands. The example below assumes that our example user is going to be assigned the phone number 13106351799, using the Identity of "VOIP".

Replace these as required for your own circumstances.


6.4 Disconnect from MS Teams (Optional)

#: Disconnect-MicrosoftTeams

BYE - Good luck


Helpful Unhelpful