Microsoft Teams Direct Routing
Guide with PowerShell Commands
V15
Please follow this guide to configure a Direct Routing for Microsoft Teams to connect to SIP Manager - https://docs.microsoft.com/en-us/microsoftteams/how-to-roll-out-teams
*** PLEASE NOTE*** There are several points in this process where
there will be delays (of up to 48 hours) before you are able to proceed to the
next stage. These are highlighted in a red font below.
This add-on license that is known as Microsoft Teams Phone Standard (approximately £6/user/month). This can be obtained from your reseller or Microsoft directly.
If at any point you are struggling to locate this license it can be found by following these steps
You will see various licenses, but these are the
two you will need.
Please note: You cannot setup Teams Phone System integration using trial accounts as these trial licenses include a Microsoft calling plan trial which can’t be removed.
Once all users have the correct licenses you can carry
on following this guide.
*** PLEASE NOTE*** Before
you click verify you need to send your service provider the TXT name & TXT value
so they can add the records to the system, once this is complete and the
service provider has confirmed records have been added you can go ahead and
click verify.
Once successfully verified you should see the screen below, untick Exchange and Exchange Online protection this is not needed and will cause issues it is ticked in default.
Now this is complete you should have successfully connected you domain.
Select an unused MS licence, once the user has been
added the domain is active this user can be deleted and the license can be recycled,
Click next once complete.
Optional setting – no entry is needed on this page so just click next.
Review and finish – Double check the info on the screen and click finish adding to complete the process.
***PLEASE NOTE*** It can take several hours for the activation of the subdomain to be processed by Office365. You will not be able to proceed with Stage 2 (below) until this has completed. For reference, see: https://docs.microsoft.com/en-us/microsoftteams/direct-routing-sbc-multiple-tenants
Before you can run PowerShell Commands you need to install the module to communicate with Teams
To find your PowerShell app use the search bar on your desktop once found always run as an administrator or you may run in to issues later.
Installing MicrosoftTeams module
Paste the below commands into PowerShell.
Install-Module -Name MicrosoftTeams
Once you have installed all the module you can run the below command to check to check that they are installed
Get-InstalledModule
Enable Phone Services For Users & Resources
Theses commands must be repeated for each user & resource.
Set-CsPhoneNumberAssignment -Identity "<User name>" -PhoneNumber "<E.164 Tel Number>" -PhoneNumberType DirectRouting
Set-CsPhoneNumberAssignment -Identity teamstest@87kfyq.onmicrosoft.com -PhoneNumber +441332315901 -PhoneNumberType DirectRouting
Grant-CsOnlineVoiceRoutingPolicy -Identity <User> -PolicyName “CallAnywhere”
Example:
Grant-CsOnlineVoiceRoutingPolicy -Identity teamstest@87kfyq.onmicrosoft.com -PolicyName “CallAnywhere”
To check for errors in the config (i.e., to check whether call issues in this 48-hour period are due to the propagation delay and not config errors) you are able to run the following PowerShell command:
Get-CsOnlineUser-Identity <Username>
Use the above command if inbound calls only are failing. The response will be as follows i.e., the correct number for the user in question in the e164 format.
Login to Microsoft teams admin centre and navigate to Voice > Resource accounts here you
can build auto attendants & call queues.
Add the Microsoft Teams Phone
Resource Account license to your user and save, do this for all resource
accounts that will need a telephone number assigning.
Configuring Auto attendants & Call Queues.
Navigate to Call Queues or
Auto attendants which is located under the voice section within the teams admin
centre, click add and fill in all the sections to your systems specifications
PowerShell Commands for Resource Accounts needing a CLI
This command is only needed if configuring Resource accounts and needs to be repeated for every resource (i.e., Auto Attendants / Call Queues).
Set-CsPhoneNumberAssignment –Identity "<User name>" -PhoneNumber "<E.164 Tel Number>" -PhoneNumberType DirectRouting
(Example)
Set-CsPhoneNumberAssignment -Identity AA@uc-support.co.uk
-PhoneNumber +441332315900 -PhoneNumberType
DirectRouting
Grant-CsOnlineVoiceRoutingPolicy -Identity <User> -PolicyName “CallAnywhere”
(Example)
Grant-CsOnlineVoiceRoutingPolicy -Identity AA@uc-support.co.uk -PolicyName “CallAnywhere”
***PLEASE
NOTE***
It can take up to an
hour before you are able to run the command after completing.
Once you have successfully run all the commands it
can take up to 48 hours for the user to be able to make and/or receive
calls. This is a known Microsoft issue that they are working to
improve.
During
this 48 hour period:
The
user may be able to make but not receive calls (or vice versa).
They
may temporarily be able to make or receive calls and then lose this facility.
To check for errors in the config (i.e., to check whether call issues in this 48-hour period are due to the propagation delay and not config errors) you are able to run the following PowerShell command:
Get-CsOnlineUser -Identity <Username>
Use the above command if inbound calls only are failing. The response will be as follows i.e., the correct number for the user in question in the e164 format.
LineURI
: tel:+44xxxxxxxxxx
When you have a live tenant you are able to make changes to the tenant in the ‘TEAMS’ section > ‘MANAGE TENANTS’ sub-section in SIP Manager. Please see separate guide in Knowledgebase for more information on the ‘MANAGE TENANTS’ section of SIP Manager for detailed information, available here: https://support.jola.co.uk/portal/en/kb/articles/sip-manager-guide-to-manage-tenants.
When the changes have been made in SIP Manager the tenant needs to be configured using PowerShell. The steps to follow are as below.
The ‘Stages’ and ‘Assumptions’ referred to below are those referred to in the
“Configuring the tenant and adding User and Resource Accounts” section at
the top of this guide.
There have been recent changes to the commands required for removing a user from a phone number. The below command now handles this:
Remove-CsPhoneNumberAssignment -Identity <User name> -RemoveAll
Unassigning the phone number from the User or Resource account will automatically set ‘EnterpriseVoiceEnabled’ to False. The phone number will continue to be available in the tenant.
Once the commands above have been run remove the
user within SIP Manager and click Manual Sync.
Voicemail is now applied to Teams Users by default. If you need to disable this, please run the below command.
Set-CsOnlineVoicemailUserSettings -VoicemailEnabled $false
If you wish to set up call recording on your Teams Tenant and find out how to view/download recorded calls please refer to ‘Guide to Jola Call Recording platform, available here: https://support.jola.co.uk/portal/en/kb/articles/guide-to-jola-call-recording-platform-v5