In this article


At the end of this article, you will be able to integrate your Microsoft Teams users from within your Microsoft 365 account, to your flexible call flow manager. Utilising Microsoft Teams as your main business communication tool, whilst adding the additional functionality of the unified communications of Microsoft Teams, video conferencing, video calling, collaboration and more. This guide will step you through the entire process. Should you need any assistance, feel free to contact our support department.


Microsoft 365 licensing requirements


The first step is to ensure all your Microsoft Teams users have the Enterprise licensing assigned and the 'Phone System' add-on associated. From your Microsoft 365 admin centre, select the active user option under users and click on each user you would like to enable the calling functionality for. Open the licenses and apps tab to verify the 'Phone System' license is assigned. If you do not see the license in the list continue to the next step.

Please note any users that have the Office 365 E5 or Enterprise E5 plan assigned will be required to uncheck the 'Calling Plan' app.




To order the Microsoft 365 Phone System license, click on the billing button from the toolbox menu on the left, select purchase services, then locate and order the required number of Microsoft 365 Phone System license. Repeat the previous step to add the freshly ordered Microsoft 365 Phone System license to your Microsoft 365 users. 

Please note the Microsoft 365 Phone System will appear under the add-ons section in purchases services only if you have an enterprise-grade license on your Office 365 tenancy.




Please also note the Microsoft 365 Phone System - Virtual User addon license is not compatible with Office 365 user accounts.


Custom domain setup


Now you have the correct licensing assigned to your Microsoft Teams users, we will start the process of configuring the PSTN gateway, known as direct routing, between your Microsoft 365 tenancy and your PBX. Login to your Microsoft 365 account as a global administrator, select Setup and then View under 'get your custom domain set up'. 




Click on the manage tab to add a new domain.




Click on the add domain button, this will produce a setup wizard which will allow you to enter the FQDN details from your customer portal. Now revert to your customer portal. 




Login to your customer portal, click on the order services tab and then the Microsoft Teams button on the left-hand side.




Copy the Microsoft 365 FQDN address which will be in the following format Please double-check the information is correct and then click on the "use this domain" button.




Next, you will be prompted to verify the domain that you have entered. Microsoft 365 will provide you with a value for a TXT record confirmation. Copy the full value of this record. Do not attempt to press the verify button until you have added the TXT record to your customer portal.




Enter the text record into the "Office 365 TXT record" field within your customer portal. Now, you will need to start adding your Microsoft Teams users and selecting a phone number to assign to each. The number assigned may contain no relevance as it will be utilised for communications between your PBX and Microsoft 365 tenancy only. Add at least one user and phone number, read and agree to the service terms and conditions, then submit the order. 

Please note, without a Microsoft Teams user and phone number, you will not be able to verify the domain inside your Microsoft 365 portal. Also, note the phone number assigned to your Microsoft Teams user cannot be configured in your inbound PBX call flow, calls to this number will automatically be sent to the associated Microsoft Teams user. Additionally, you cannot assign a number already configured in your call flow to any of your Microsoft Teams users.




Going back to your Microsoft 365 portal click the verify button.


Once the domain verifies, ensure you do not select any additional online services and click continue.




We must now activate the domain. This is an essential step to integrate both systems, make sure you do not skip it. On your Microsoft 365 admin centre, you should select users from the left-hand menu and click on active users. After that, you should add a user and enter the required details, making sure you select the correct domain from the drop-down window. This will be in the format

Please note, creating an alias for an existing user will not activate the domain. You must create a new user.




Lastly, you should ensure that a product license is assigned to this user. The license can be any license that contains Microsoft Teams, such as Enterprise E1 and Business Basic and does not need to include the Phone System add-on. The domain will not activate without a license assigned. This license can even be reassigned temporarily from another user if a spare license is not available. Finally, hit the next button and complete the activation.




Allocating a calling plan to your Microsoft Teams users


We will now add your Microsoft Teams accounts to a user object or SIP trunk inside your PBX. You will utilise a user object if you require the PBX functionality, and a SIP trunk if you would like Microsoft 365's phone system to handle your calls. This is an important requirement that must not be skipped, as all Microsoft Teams accounts will require a call plan for outbound calls to be placed. To start, click the settings icon on your user object. 




Click the add button then the option "Microsoft Teams Integration". 




Select the Microsoft Teams email address from the drop-down list that you would like to assign. Save the configuration and don't forget to apply the new configuration.




Alternatively, if you would like to use Microsoft 365's phone system we will add your Microsoft Teams accounts to your SIP trunking object, click the settings icon of your SIP trunk.




Opt for the 'Office 365 PSTN gateway' mode, and ensure you have a call plan assigned. Click on the add button and select your Microsoft Teams accounts, save the configuration and don't forget to apply the configuration.



Please, note that blind transfers to call parking slots will not work as expected by using Microsoft Teams. For further information or guidance on the PBX configuration please view our extensive knowledge base which has a range of articles to support your system requirements.  


Configuring Powershell


We will now connect your Microsoft 365 tenancy to your PBX using the direct routing functionality. To begin, click on the Windows key located in your bottom left of the toolbar, search for PowerShell, then right-click and select run as an administrator. When launching the application as an administrator, the system might request authorisation to run on your computer, click on yes and the PowerShell screen will appear.



You will now be presented with the PowerShell window to run the following configuration commands. 



Next, we will require the Microsoft Teams module. For this, run the following command in PowerShell, as shown in the image below.


Install-Module -Name MicrosoftTeams -RequiredVersion 2.0.0 



Please note there are known issues with PowerShell 7 and Teams PowerShell. For the best experience, we recommend that you use PowerShell 5.1. 


Once installed, you must start a session connecting to the account in which the domain has been configured by running the following command:







After that, a window will pop-up and you should enter your Microsoft Administrator credentials and proceed with the next commands.




Uninstalling the Skype For Business Module

If you previously had the Skype for Business Powershell module installed, you might need to uninstall it before installing the Microsoft Teams module. The easiest way to uninstall it is by locating the module in Programs and Features in the Windows Control Panel and selecting the option to uninstall. Once it has been removed, please refer to the section above to import and configure the Microsoft Teams module.




Configuring the direct routing gateway


From your customer portal locate and copy the FQDN used in the custom domain section of this guide.




Now, run the command below replacing with your custom FQDN from your customer portal. This will create the PSTN gateway. 


New-CsOnlinePSTNGateway -Fqdn "" -SipSignalingPort 5061 -SendSipOptions $false -Enabled $true -ForwardCallHistory $true -ForwardPai $true


Please note that If you receive a 'domain not configured for this tenant' error, check to see if you have activated the domain with a licensed user (see the custom domain section of this guide for further details). If you have activated the domain with a licensed user, please wait as Microsoft 365 domain activation can take some time.


Then, create an empty PSTN usage;


Set-CsOnlinePstnUsage -Identity Global -Usage @{Add="VC PSTNUsage"}


Next, create a voice routing policy;


New-CsOnlineVoiceRoutingPolicy -Identity "VC VoiceRoutingPolicy" -OnlinePstnUsages "VC PSTNUsage"


And the final command to create the voice route, and associate with the PSTN usage, with your custom FQDN from your customer portal;


New-CsOnlineVoiceRoute -Identity "VC VoiceRoute" -NumberPattern ".*" -OnlinePstnGatewayList -Priority 0 -OnlinePstnUsages "VC PSTNUsage"


The domain setup is now complete and we will continue to set up the Microsoft Teams users. 


Enable calling on your Microsoft Teams users


We now have the custom domain configured and the direct routing gateway connected to your Microsoft 365 gateway, next we must enable PSTN calling functionality for your Microsoft Teams users. Login to your customer portal, locate and copy each of the numbers you have assigned to each of your Microsoft Teams user accounts. 


Run the command below in PowerShell, where "Teams email address" is your Microsoft Teams email address and "tel:+PHONE NUMBER" is the phone number associated from your customer portal. Press enter once you have copied and adjusted the command. 


Set-CsUser -Identity "Teams email address" -EnterpriseVoiceEnabled $true -OnPremLineURI "tel:+PHONE NUMBER"

Please note that If you receive a 'Cannot modify the parameter: "EnterpriseVoiceEnabled" because it is restricted for the user service plan' error, check that the user has been assigned a phone system license. See the Microsoft 365 licensing requirements section of this guide for further details


Assign the default voice policy. Copy to PowerShell and return once the place holder has been updated with your Microsoft Teams email address.   

Grant-CsOnlineVoiceRoutingPolicy -Identity "Teams email address" -PolicyName "VC VoiceRoutingPolicy"


Please note in the above command the policy-name refers back to the policy created as part of creating the direct routing gateway. If you receive an error saying the policy 'is not a user policy', run the following command to determine what your voice routing policy has been called:


You have now successfully enabled calling functionality on your Microsoft Teams user. Repeat the process with all your additional Microsoft Teams users. Finally, restart your Microsoft Teams client and you will be presented with the dial-pad functionality under the calls tab. It is now highly recommended to adjust the dial plan and disable the standard voicemail, to improve the usability of Microsoft Teams.   

Please note, on rare occasions the Microsoft 365 platform can take up to 48 hours for the synchronisation to complete and the dial-pad to appear. 




Adjusting the dial plan


By default, Microsoft Teams will add the + symbol before any call made by the users. If the country code is not dialled after that, it might cause an error or you may be unable to make the call. Enter the command below to PowerShell. 


New-CsTenantDialPlan -Identity "Voip dial plan" -Description "Pass all numbers to PBX"

We now have a new dial plan. Next, we will add our normalisation rules, enter the following commands to PowerShell;


$rule1 = New-CsVoiceNormalizationRule -parent "Voip dial plan" -name "Match all digits without plus" -description "pass everything through" -pattern '^(\d+)$' -translation '$1' -inmemory


Set-CsTenantDialPlan -identity "Voip dial plan" -NormalizationRules @{add=$rule1}


$rule2 = New-CsVoiceNormalizationRule -parent "Voip dial plan" -name "Match all digits with plus" -description "pass everything through" -pattern '^(\+\d+)$' -translation '$1' -inmemory


Set-CsTenantDialPlan -identity "Voip dial plan" -NormalizationRules @{add=$rule2}

At this stage, you will have two normalisation rules which match with any number dialled. We now need to assign this dial plan to each of your Microsoft Teams users. Enter the command below, where "email address" is replaced with your Microsoft Teams email address.


Grant-CsTenantDialPlan -Identity "email address" -policyname "Voip dial plan"


Repeat the process with all your Microsoft Teams users


Disable the standard Microsoft 365 voicemail


By default, Microsoft 365 Teams voicemail is enabled, you will not require this functionality as this is handled by your voicemail feature inside your PBX of your customer portal. Login to your Microsoft 365 portal as a global administrator and select the all admin centres tab on the left toolbar, followed by the Teams icon.




Select the voice drop-down and then calling policies. Select the default policy which is Global.




Locate the setting 'Voicemail is available for routing inbound calls', update this value to disabled.




Watch this in action