Create the PSTN Gateway
# Check PSTN Gateway available
Get-Command *onlinePSTNGateway
# Confirm domains are avaialble
Get-CsOnlineSipDomain
# Check and set SBC gateway. If this doesn't work, see Appendix 1 below;
Get-CsOnlinePSTNGateway -identity "sbc1.customer.yourcarrier.com"
New-CsOnlinePSTNGateway
# Port 5067
# Identity sbc1.customer.yourcarrier.com
# Modify inside tenancy inside 365 for the:
- Enabled: true
- Forward Call History: true
- Concurrent Call Capcity: 60
# Update the PSTN Gateway if required, we enabled ForwardPai
Set-CsOnlinePSTNGateway -identity "sbc1.customer.yourcarrier.com" -ForwardPai $true

Set a default user
# Set Default User
Set-CsUser -Identity "[email protected] " -EnterpriseVoiceEnabled $true -HostedVoiceMail $true
# Set PSTN Usage
Set-CsOnlinePstnUsage -Identity "Global" -Usage "YourVOIP"
Get-CsOnlinePstnUsage
# Set voice route
New-CsOnlineVoiceRoute -Identity "YourVOIP" -NumberPattern ".*" -OnlinePstnUsages "YourVOIP" -OnlinePstnGatewayList "sbc1.customer.yourcarrier.com"
# Set voice routing policy
New-CsOnlineVoiceRoutingPolicy -Identity "YourVOIP" -OnlinePstnUsages "YourVOIP"
# Grant Policy
Grant-CsOnlineVoiceRoutingPolicy -PolicyName "YourVOIP"
Now you need to add a client which will use the carrier trunk
Config process
- Users must be assigned an E1, E3 or E5 license and a phone system license if E1 or E3
- Create xxx.sbc1.customer.yourcarrier.com domain in client microsoft tenancy
- Activate domain by creating/assigning user to this domain xxxx.sbc1.customer.yourcarrier.com (required see Appendix 1)
- Add txt record to confirm
# Add voice route inside powershell, so connect
$teamssession = New-CsOnlineSession -UserName [email protected]
Import-PSSession $teamssession -AllowClobber
#Create Policy
New-CsOnlineVoiceRoutingPolicy -Identity "YourVOIP"
# Enable users for direct routing
Set-CsUser -Identity "[email protected]" -OnPremLineURI tel:+123456789 -EnterpriseVoiceEnabled $true -HostedVoiceMail $true
# Confirm user is enabled
Get-CsOnlineUser -Identity "[email protected]" | fl RegistrarPool
# Grant the voice routing policy
Grant-CsOnlineVoiceRoutingPolicy -Identity "[email protected]" -PolicyName "YourVOIP"
# Confirm policy has been granted
Get-CsOnlineUser -Identity "[email protected]" | fl OnlineVoiceRoutingPolicy
OnlineVoiceRoutingPolicy : YourVOIP
# Confirm User has a hosting provider and is homed in Skype
Get-CsOnlineUser -Identity "[email protected]" | fl HostingProvider, RegistrarPool
HostingProvider : sipfed.online.lync.com
RegistrarPool : sippoolsy3au103.infra.lync.com
#Set the Online PSTN Carier
Set-CsOnlinePstnUsage -Identity Global -Usage @{Add="YourVOIP"}
# Set the online route (note took time when user for tenant.sbc1.c... was added)
New-CsOnlineVoiceRoute -Identity "YourVOIP" -NumberPattern ".*" -OnlinePstnGatewayList "tenant.sbc1.customer.yourcarrier.com" -OnlinePstnUsages "YourVOIP"
#Set the policy
New-CsOnlineVoiceRoutingPolicy "YourVOIP" -OnlinePstnUsages "YourVOIP"
Add another user
### New User (Example - user2)
Set-CsUser -Identity "[email protected]" -OnPremLineURI tel:223456789-EnterpriseVoiceEnabled $true -HostedVoiceMail $true
# Confirm added
Get-CsOnlineUser -Identity "[email protected]" | fl RegistrarPool
# Grant permissions
Grant-CsOnlineVoiceRoutingPolicy -Identity "[email protected]" -PolicyName "YourVOIP"
# Confirm Users are inside register pool and active
Get-CsOnlineUser -Identity "[email protected]" | fl OnlineVoiceRoutingPolicy
Get-CsOnlineUser -Identity "[email protected]" | fl HostingProvider, RegistrarPool
If When trying to add PSTN Gateway I get the following. "Can not use the "sbc1.customer.yourdomain.com" domain as it was not configured for this tenant"
$FormatEnumerationLimit =-1
Get-CsTenant | fl Tenantid,Domain*
TenantId : 6d35e876-3a61-4a45-a97f-e0af00eba4db
Domains : {tenant.sbc1.customer.yourdomain.com, sbc1.customer.yourdomain.com, customer.yourdomain.com,
yourdomain.onmicrosoft.com}
DomainUrlMap : {yourdomain.onmicrosoft.com}
You are missing Missing the SBC in the DomainUrlMap
Fix
Create a Global Admin with the domain suffix
Create a Global Admin account in Cloud (not synced with AADC) with a UPN @yourdomaindomain.com and not @yourdomain.onmicrosoft.com, assign a E1, E3 or E5 Licence, wait 24 hours, when you run the Get-CsTenant command again you should see the domain inside the list. You can then remove the newly created and the license
Result after 24 hours (was 30 mins in my case)
$FormatEnumerationLimit =-1
Get-CsTenant | fl Tenantid,Domain*
TenantId : 6d35e876-3a61-4a45-a97f-e0af00eba4db
Domains : {tenant.sbc1.customer.yourdomain.com, sbc1.customer.yourdomain.com, customer.yourdomain.com,
yourdomain.onmicrosoft.com}
DomainUrlMap : {yourdomain.onmicrosoft.com, sbc1.customer.yourdomain.com}