AI Voice Agent
Never miss another call.
AI Voice Agent
Never miss another call.
Home » Help Centre » Apps & Integrations » Third-Party Apps » Microsoft Teams Direct Routing
Setting up phone calling for Microsoft Teams using Direct Routing is straightforward with our PowerShell wizard. It automates what would otherwise be a complex setup. You only need your Teams domain and Teams Phone licensing—we handle DNS, users, numbers, PSTN, and routing.
Review these useful guides:
Phone services for Teams require specific licensing for each user:
Enterprise licensing: Add an E1, E3, or E5 licence to enable phone services.
Teams Phone Standard: This add-on is required to enable phone services for any user with Microsoft Teams.
To set this up:
Sign into the Microsoft 365 admin centre as an administrator.
Select Billing > Licences.
In your SIPcity account, add any new numbers you need. Go to Switchboard, select Add Number, and follow the prompts. See the Adding Numbers article for details.
Log in to your SIPcity account.
Go to Switchboard and select the number you want to use with Teams.
Under Number Details, select Teams in the Type dropdown.
Click Save.
Use our PowerShell wizard to generate the scripts needed to finalise Direct Routing setup.
Go to Tools > Teams.
Select PowerShell for step-by-step instructions on how to use PowerShell with Windows and macOS.
Open PowerShell and connect to your Microsoft 365 tenant.
#: Install-Module Microsoft.Graph #: Connect-MgGraph -Scopes "User.ReadWrite.All","Domain.ReadWrite.All"
Add a domain using the New-MgDomain cmdlet.
#: New-MgDomain -BodyParameter @{Id="ms50000100.teams.sipcity.com.au";IsDefault="False"}
#: $MgVerificationCode = (Get-MgDomainVerificationDnsRecord -DomainId "ms50000100.teams.sipcity.com.au" | Where-Object {$_.RecordType -eq "Txt"}).AdditionalProperties.text
#: echo $MgVerificationCode
Domain validation TXT record: Microsoft generates this record to validate your domain. Copy and paste it into the Add TXT dialog in your DNS settings.
Confirm the domain with Microsoft:
#: Confirm-MgDomain -DomainId "ms50000100.teams.sipcity.com.au"
Once confirmed, we remove the TXT record from our Cloudflare DNS.
Note: You have a 5-minute window to complete this step. If you can’t finish in time, you can retry later.
Go to the Microsoft Admin Centre > Users > Add a user.
Temporary user: Microsoft requires a temporary user to associate with the trunk domain. Assign an Office 365 Business licence to this user.
Trunk domain: Select from the dropdown (e.g. [email protected]).
Click Next.
Go to Tools > Teams > PowerShell.
Open PowerShell and connect to your Microsoft 365 tenant.
#: Install-Module Microsoft.Graph #: Connect-MgGraph -Scopes "User.ReadWrite.All","Domain.ReadWrite.All"
Use the New-CsOnlinePSTNGateway cmdlet to create a PSTN gateway with the required settings.
#: New-CsOnlinePSTNGateway -FQDN ms50000100.teams.sipcity.com.au -SIPSignalingPort 5061 -MaxConcurrentSessions 100 -Enabled $true
Check that the gateway was created successfully.
#: Get-CsOnlinePSTNGateway
Open PowerShell and connect to your Microsoft 365 tenant.
#: Install-Module Microsoft.Graph #: Connect-MgGraph -Scopes "User.ReadWrite.All","Domain.ReadWrite.All"
Set up 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"
If you have multiple users, assign a phone number to each Teams user. The example below assigns +61 (2) 5550 0000 to [email protected] with the Identity set to “VOIP”. Replace as needed for your users.
#: Set-CsPhoneNumberAssignment -Identity [email protected] -PhoneNumber +61255500000 -PhoneNumberType DirectRouting #: Grant-CsTeamsCallingPolicy -PolicyName AllowCalling -Identity [email protected] #: Grant-CsOnlineVoiceRoutingPolicy -Identity [email protected] -PolicyName "VOIP" #: Set-CsOnlineVoicemailUserSettings -Identity [email protected] -VoicemailEnabled $false
Optionally, disconnect your PowerShell session.
#: Disconnect-MicrosoftTeams
Your SIPcity account is now 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.