Configuration Guide

This page contains all the information needed to configure Teams Direct Routing with the Hosted Network SIP Trunks.

This guide will walk you through the configuration of Teams Direct Routing within your Microsoft Office 365 Tenant. You can follow this guide for both new and existing Office 365 Tenants. This guide does assume you have some experience with the Microsoft Teams infrastructure and general experience with Windows Powershell.


As mentioned the guide assumes you have a basic knowledge of Microsoft Teams and Windows Powershell. You will need Admin access to the Microsoft Tenant in order to complete the Domain Setup and configuration of Teams Direct Routing.

In summary, to complete this guide you will need the below:

Microsoft have discontinued the use of the Skype for Business Powershell plugin, you will need to install the new Teams module following the steps in Phase 2


In order for you to activate the backend requirements of Microsoft Teams and allow subsequent users to utilize the public calling functions of Teams direct routing you will need to ensure the licenses you're assigning contain the below features:

  • Microsoft Teams

  • Microsoft Teams Phone System

Any of the E5 licensing includes the above two options, however anything below E5 does not and requires the "Microsoft Phone System" add-on to be assigned to the user as well.

You can use Microsoft Business Apps, Basic, Standard and Premium licenses for this as well but you will need the "Microsoft Phone System" add-on in addition to the Microsoft Business License.

Users who won't be making or receiving calls via the Teams Direct Routing product aren't required to have the Phone System license.

Configuration Steps

Follow the steps below to configure Teams Direct routing within your Office 365 Tenant.

You will need to have submitted an order with our service delivery team prior to following these steps as they will provision you a unique domain for your Microsoft Tenant.

If you encounter any issues please contact us at or call us on 1300-781-148

Phase 1 - Domain Configuration

As part of how the Teams Direct Routing works within the Microsoft infrastructure you will need a unique domain which will act as a unique identifier within the Hosted Network and Microsoft Teams networks, and allow all the traffic to route to where it needs to. This should be provided to you as part of your order submitted with our service delivery team.

Step 1. Adding the unique domain

As mentioned you will need to add the unique domain provided by our Service Delivery team to the end-customers Microsoft Tenant.

  1. Navigate to "Settings" and then "Domains" to bring up your list of domains

  2. Click "+ Add Domain" to add your unique domain

  3. Enter your domain in the "Domain Name" field, this will be the one provided in your order (e.g.

  4. On the next screen you will be given the DNS entries to verify your domain. Reply to your order with our Service Delivery team with the TXT DNS Entry it asks for and wait until they come back to you confirming it has been added.

  5. Once the TXT entry has been added click "Verify" to continue

  6. When prompted for what services to add, simply untick everything and then click "Continue" (You do not need to enter any services for the Direct Routing to work)

  7. You should now see a "Domain Setup is Complete" message

Step 2. Create a user

Once the domain is added you will need to create one user that has the new domain as the username, this is so that the domain activates in Microsoft's servers. (e.g. the domain we added was, so the users email/login will be

When you have added the user you will need to let things sync in the backend, this can take anywhere from 30 minutes up to 2-3 hours. If there is high load on Microsoft's servers you will see a warning in the Admin interface.

The user needs to have a E5 licence or a Phone System licence assigned, you can make use of the trial licences Microsoft provides if you don't have any spare. If the user isn't fully licenced the new domain will not be activated and you won't be able to configure the teams direct routing.

You will need to keep this user for at least 24 hours, or until you finish the deployment of Microsoft Teams. Deleting it before you're finished or before 24 hours has passed can result in difficulties with the configuration

Phase 2 - Enable Direct Trunking and User Access

Once you have your unique domain added to the Tenant and you've let things sync in the backend you can now continue onto configuring the Teams Direct Routing for your tenant.

As a pre-requisite you will need to install the Skype for Business Powershell module, without this you cannot run the commands needed to configure Teams Direct Routing:

Microsoft have discontinued the use of the Skype for Business Powershell Module, you can install the new module using the below command in an elevated Powershell window.

Install-Module MicrosoftTeams -AllowClobber

Step 1. Connecting to the Tenant

You will need to use an Admin account that is not using the new domain as part of their username, if you do you will encounter "Gateway not found" errors.

If you encounter the errors even with the normal Admin account please ensure they have the Skype For Business DNS Records added for their domain.

You will need to connect to the Microsoft Tenant using Powershell to configure the Teams Direct Routing, use the below command to connect. (You will need to use the credentials of a user that has Administrator access)

Import-Module MicrosoftTeams

To confirm you have connected run the below command, you should see all of your users appear if you have connected correctly:

Get-CsOnlineUser | select DisplayName,SipAddress,LineURI

Step 2. Enabling Teams Direct Routing

Once you have successfully connected, you will need to run some commands to create your PSTN Usage and some Voice routes for Standard, National, Emergency and International Calls.

You will need to adjust the below commands and replace <domain> with your unique domain that you added to the tenant in Phase 1. Once you adjust the commands run them in your Powershell Window.

Set-CsOnlinePstnUsage -Identity Global -Usage @{Add="Australia"}
New-CsOnlineVoiceRoute -Identity "AU-Emergency" -NumberPattern "^+000$" -OnlinePstnGatewayList <domain> -Priority 1 -OnlinePstnUsages "Australia"
New-CsOnlineVoiceRoute -Identity "AU-Service" -NumberPattern "^\+61(1\d{2,8})$" -OnlinePstnGatewayList <domain> -Priority 1 -OnlinePstnUsages "Australia"
New-CsOnlineVoiceRoute -Identity "AU-National" -NumberPattern "^\+61\d{9}$" -OnlinePstnGatewayList <domain> -Priority 1 -OnlinePstnUsages "Australia"
New-CsOnlineVoiceRoute -Identity "AU-International" -NumberPattern "^\+(?!(61190))([1-9]\d{9,})$" -OnlinePstnGatewayList <domain> -Priority 1 -OnlinePstnUsages “Australia”
Remove-CsOnlineVoiceRoute -identity LocalRoute
New-CsOnlineVoiceRoute -Identity "International-CatchAll" -NumberPattern "^(\+[0-9](.*))$" -OnlinePstnGatewayList <domain> -Priority 4 -OnlinePstnUsages “Australia”
New-CsOnlineVoiceRoutingPolicy "Australia" -OnlinePstnUsages “Australia”

Step 3. Enable User Access

Once you have added the Voice routing and configured the Policy you can now start giving users access to the direct routing, and allocating them Public DIDs. In some cases you will encounter errors at this step, you will need to be patient and let things sync as it can take some time for Microsoft's server to pickup the changes.

To give users access to the Teams Direct Routing you can run the below commands. You will need to adjust the commands with the correct information as per below.

  • Change the <pri_email> section to the primary email address of the user

  • Change the <fnn> section to the Direct In Dial for the user in the command. This needs to be in the +61 format, e.g. for 0289998000 the format would be +61289998000

Set-CsPhoneNumberAssignment -Identity <pri_email> -EnterpriseVoiceEnabled $true

Set-CsPhoneNumberAssignment -Identity <pri_email> -PhoneNumber +61<fnn> -Ph
oneNumberType DirectRouting

Grant-CsOnlineVoiceRoutingPolicy -Identity "<pri_email>" -PolicyName Australia

If the "Set-CsUser" command fails to run correctly check that the user you're connected as has the "Teams Administrator" role as you may not have the required permissions to run the command

Repeat the above command for each user you want to have access to the Teams Direct Routing. Once you've added them all you may need to allow 30 minutes to an hour for the Microsoft Teams app to pickup that they have been allowed to have access to the direct routing.

Step 4. Enable AutoAttendant Resource Accounts to Call Outbound (Optional)

This step is only needed if you intend to allow the IVR/AutoAttendant to dial outbound to an external number as it is not able to do so by default.

To enable the AutoAttendant to dial an external number you need to assign it to the PSTN usage within the Powershell connection to Teams. You can do this by running the below command, once run you will need to wait 15~30 minutes for the changes to take affect.

## Replace "<res_account_email>" with the primary email address of the resource
## account attached to the AutoAttendant

Grant-CsOnlineVoiceRoutingPolicy -Identity <res_account_email> -PolicyName Australia

If you encounter any issues with this article please log a ticket with Hosted Network support at prior to giving us a call on 1300-781-148 as we will require a ticket number in order to undertake any support.

NOTE: If you do not log a ticket prior to calling it can cause the issue to take longer in being resolved.

Last updated