Microsoft Teams - Enable Direct Routing for Voice
Before executing the commands further down in this guide (described under (Setup Direct routing and configure Domains and User(s)), you will need to have the following requirements fulfilled moving forward.
Requirements:
- Two accounts that is a Teams admin or Global admin in the Microsoft 365 Admin Center.
- These accounts also needs Microsoft licenses that supports voice.
- Example on licenses that support voice e.g - E5 or E1/E3 + Phonesystem.
- The two admin accounts need to have the domain as an email for both sbc1 and sbc2.
- Full description on how this is done can be found in the steps below
Note
Accounts can be set up as temporary accounts or use of existing accounts. This is needed for the configuration for the domains for the domain urlmap (describe under Step 3) Make sure the Domains are populated in domain urlmap). Existing accounts can be restored to its original username/license and domain. If you decide to use the temporary accounts, they can be removed and their corresponding licenses canceled after completing this guide.
Connect the admin accounts to the new domains
- Log in to Microsoft 365 Admin Center with the Admin Account (admin.microsoft.com)
- Go to Active users and find one of the two accounts mentioned in requirements
Let’s name these users sbc1@yourdomain.com and sbc2@yourdomain.com in this example - Click on one the users (e.g sbc1@yourdomain.com)
- Click Manage username and email > Click on the pen to edit > Choose sbc1 from the domain dropdown > Save settings (see below picture)*
- Make sure the username is saved correctly. You should now have a username like sbc1@tvxteamsxxxxx-sbc1.sfbcust.telavox.se (see below picture)*
- Repeat the process for the second user - meant for user sbc2.
i.e adding a username like sbc2@tvxteamsxxxxx-sbc2.sfbcust.telavox.se
See example pictures on the next page marked with an asterisk from above steps.
Connect the admin accounts to the new domains - Step 4
Connect the admin accounts to the new domains - Step 5
When this is done we can start executing the Powershell commands in this guide.
Setup Direct routing and configure Domains and User(s)
Step 1 - Adding a Teams module to Powershell
Install the Teams module with the below guide:
Guide to download and install the Teams-Module
Step 2 - Create session towards Teams-Environment and Telavox systems
This step will create the session needed to update the settings in Microsoft-Teams.
Run the following command from Powershell (as administrator):
Connect-MicrosoftTeams
Step 3 - Make sure the Domains are populated in domain urlmap
Run the following command:
Get-CsTenant | fl Tenantid,*Domain*
Your result should contain sbc1 and sbc2 in the DomainUrlMap or as VerifiedDomains (The naming convention is dependent on what powershell version is being used)
PowerShell Version 5.1.X
PowerShell Version 7.X
If you don’t see your domains listed, it might be because PowerShell will only list the first four domains. To make sure all domains are listed you can run the following command:
PS cmd $FormatEnumerationLimit =-1
After you have run this command you can run the Get-CsTenant command above once again to list all domains.
When this is confirmed - move on to next page with Step 4.
Step 4 - Create direct routing rules for Teams
The original guide from Microsoft can be found here.
When running the below commands - remember to change to the FQDN:s (Domains)
provided by Telavox. These FQDN:s (Domains) must be changed on both sbc1 and sbc2.
4.1 - Create the PSTN Gateways
Make sure this is two complete rows in Powershell (without quotation marks):
1) “New-CsOnlinePSTNGateway -Fqdn tvxteamsxxxxx-sbc1.sfbcust.telavox.se -Enabled $true -SipSignalingPort 5061”
2) “New-CsOnlinePSTNGateway -Fqdn tvxteamsxxxxx-sbc2.sfbcust.telavox.se -Enabled $true -SipSignalingPort 5061”
4.2 - Create PSTN Usage
Set-CsOnlinePstnUsage -Identity Global -Usage @{Add="Telavox"}
4.3 - Create Voice Route
Make sure this is two complete rows in Powershell (without quotation marks).
1) “New-CsOnlineVoiceRoute -id "Telavox" -NumberPattern ".*" -OnlinePstnGatewayList @{add="tvxteamsxxxxx-sbc1.sfbcust.telavox.se"} -OnlinePstnUsages Telavox”
2) “Set-CsOnlineVoiceRoute -id "Telavox" -OnlinePstnGatewayList @{add="tvxteamsxxxxx-sbc2.sfbcust.telavox.se"}”
4.4 - Create a Voice Routing Policy
New-CsOnlineVoiceRoutingPolicy "Telavox" -OnlinePstnUsages “Telavox”
After this you will need to create the direct routing rules for Teams (to place and receive calls to and from Telavox servers) this is done in the following steps.
Step 5 - Check if a user is present in Microsoft Teams
To check if a user that is created is present in Teams - Run the following command and adjust (username@yourdomain.com):
Get-CsOnlineUser -Identity "username@yourdomain.com" | fl RegistrarPool
The response to that command should contain and look something like below:
*.infra.lync.com
Or if you are running a Teams only solution it could just say “Teams:".
If that's the case we proceed to Step 6.
Step 6 - Associate a number to a Teams-user
- First check in Admin portal what landline number is set to the user.
You cannot assign a mobile number to the user. - Next steps is to associate a landline number to a Teams user.
This is done differently dependent on version of PowerShell you are using.
Run the following command for PowerShell 5.X:
Set-CsPhoneNumberAssignment -Identity "username@yourdomain.com" -PhoneNumber "+4610234567" -PhoneNumberType DirectRouting
Run the following command for PowerShell 7.X:
Set-CsPhoneNumberAssignment -Identity "username@yourdomain.com" -PhoneNumber "+4610234567" -PhoneNumberType DirectRouting
Remember
Use the E.164 number format i.e +46 (without the first zero) this example is
for a number with the Swedish country code prefix.
Step 7 - Grant Online Voice Routing Policy to a User
To grant usage of the online voice routing policy to a user - Run the following command:
Grant-CsOnlineVoiceRoutingPolicy -Identity "username@yourdomain.com" -PolicyName “Telavox”
To verify that the user have been updated correctly go to Step 8.
Step 8 - Verify user creation
To verify that the user is created correctly - Run the following command:
Get-CsOnlineUser "username@yourdomain.com" | select OnlineVoiceRoutingPolicy
Here you should see Telavox as an output then proceed to Step 9.
Step 9 - Activate “Forward call history” in Teams Admin portal
- Log in to your Teams Admin portal. Go to “Voice” > “Direct Routing” and click on the first of your two configured SBCs. Choose “Settings” and, in the top right corner, click “Edit SBC”.
- Find the setting “Forward call history” and turn it on.
- Repeat the action for your second SBC.
Step 10 - Configure the Teams user(s) in Telavox Admin to use teams for incoming/outgoing calls
- Login to the Admin portal with a administrator account here. The add-on “MS-Teams” needs to be added on the user(s) in the Admin portal.
- Under “Additional services” add the MS-Teams feature for the user(s) that will be using Microsoft Teams with Telavox. This needs to be done separately for each individual user.
- Then navigate to Users.
- In the left bottom pane click on Microsoft Teams under Integrations.
- Select all users you have configured to use Teams.
- Fill in to use both incoming & outgoing calls.
- Click Save.