Microsoft Teams
The following articles provide more information about configuring and using Phone System Direct Routing. You should read all of these articles to understand how to plan and configure Direct Routing. Microsoft Phone System Direct Routing lets you connect the SIP trunk to Microsoft Phone System.
Prerequisites
- Office 365 tenant: An Office 365 tenant that you use to home your Microsoft Teams users.
- Teams users of Direct Routing must have the following licenses assigned in Office 365: Office 365 E3 with Microsoft Phone System and Microsoft Audio Conferencing addons or Office 365 E5 (addons already included).
- sip365.cloud subdomain: provided by our company.
- SIP trunk: configured in our portal.
- Office 365 tenant coexistence mode should be configured to “TeamsOnly” (See https://docs.microsoft.com/en-us/microsoftteams/migration-interop-guidance-for-teams-with-skype)
In this example, we will use:
- Provider account: your accountid.myprovider.xyz
- sip365.cloud subdomain: youracccountid.sip365.cloud
- Customer’s main domain in Office 365: contoso.com
Configuration of the Office 365 Tenant
- Connect to the Office 365 admin portal and assign the users with Direct Routing with the appropriate licenses (see prerequisites).
- Configure the main domain “contoso.com” with the “Skype for Business” online services:
Sign in to Office 365 with your account.
Choose Setup > Domains.
On the Manage domains page, choose a domain in the list, and then choose Manage DNS.
You need to select Skype for Business. After that, you’ll see, in the domains setup wizard wizard and on the DNS management page, only the DNS records you have to update for “contoso.com”. Update/Create these DNS entries
- Add the domain:
Sign in to Office 365 with your work account.
Choose Setup > Domains.
On the Manage domains page, add the domain “youraccountid.sip365.cloud”. You will need to contact our support to validate domain ownership (TXT record to be added on our side). - When the domain “youraccountid.sip365.cloud” is correctly added, create a dummy user xxx@youraccountid.sip365.cloud with Office 365 E3 license (+ Microsoft Phone System and Microsoft Audio Conferencing addons) or Office 365 E5 (addons already included). This user is temporarily and only needed to create the Direct Routing trunk in the next steps. This user can be removed afterwards.
- In order to propagate and validate this domain correctly, please login on https://teams.microsoft.com with this dummy user.
Note: It can takes a couple of minutes, even hours for this configuration to be completely propagated on all Microsoft servers. If you encounter errors in the next steps, please try again later.
Pair the Direct Routing Service with our SIP trunk
You need to use a PowerShell session connected to the tenant to pair the SIP trunk to the Direct Routing interface. To open a PowerShell session, please follow the steps outlined in Set up your computer for Windows PowerShell
Teams PowerShell requires PowerShell 5.1 or higher on all platforms. Install the latest version of PowerShell available for your operating system.
- Install the Teams Powershell module.
- Open powershell and connect to the Tenant with an admin user (i.e.: john@contoso.com):
$credential = Get-Credential Connect-MicrosoftTeams -Credential $credential
- To pair our SIP trunk to the tenant, in the PowerShell session type the following and press Enter:
New-CsOnlinePSTNGateway -Fqdn <SBC FQDN> -SipSignalingPort <SBC SIP Port> -MaxConcurrentSessions <Max Concurrent Sessions the SBC can handle> -Enabled $true
in our case:
New-CsOnlinePSTNGateway -Fqdn youraccountid.sip365.cloud -SipSignalingPort 5061 -MaxConcurrentSessions 10 -Enabled $true
- Validate that the trunk is present in the list:
Get-CSOnlinePSTNGateway
Note: It can takes a couple of minutes, even hours for this configuration to be completely propagated on all Microsoft servers. If you encounter errors in the next steps, please try again later.
Configure Voice Routing
Microsoft Phone System has a routing mechanism that allows a call to be sent to a specific SIP Trunk.
- First, you need to create a PSTN usage:
Set-CsOnlinePstnUsage -Identity Global -Usage @{Add=”MYPROVIDER”}
- Validate that the usage was created by entering:
Get-CSOnlinePSTNUsage
- Create the route based on destination prefix. For example, to route everything through the SIP Trunk:
New-CsOnlineVoiceRoute -Identity “MYPROVIDER” -NumberPattern “.*” -OnlinePstnGatewayList youraccountid.sip365.cloud -OnlinePstnUsages “MYPROVIDER”
- Create the route policy:
New-CsOnlineVoiceRoutingPolicy “MYPROVIDER” -OnlinePstnUsages “MYPROVIDER”
Note: It can takes a couple of minutes, even hours for this configuration to be completely propagated on all Microsoft servers. If you encounter errors in the next steps, please try again later.
Enable users for Direct Routing Service
- For each Teams users, ensure that the user is Enterprise Voice enabled online:
Set-CsPhoneNumberAssignment -Identity user1@contoso.com -EnterpriseVoiceEnabled $true
Set-CsPhoneNumberAssignment -Identity user2@contoso.com -EnterpriseVoiceEnabled $true
- For each Teams users, configure the phone number:
Set-CsPhoneNumberAssignment -Identity user1@contoso.com -PhoneNumber “+3228801234” -PhoneNumberType DirectRouting
Set-CsPhoneNumberAssignment -Identity user2@contoso.com -PhoneNumber “+3228801235” -PhoneNumberType DirectRouting
- For each Teams users, grant a voice routing policy (created in “Configure Voice Routing”):
Grant-CsOnlineVoiceRoutingPolicy -Identity user1@contoso.com -PolicyName “MYPROVIDER”
Grant-CsOnlineVoiceRoutingPolicy -Identity user2@contoso.com -PolicyName “MYPROVIDER”
Optional: Create custom dial plans in Teams
A dial plan is a named set of normalization rules that translate dialed phone numbers by an individual user into an alternate format (typically E.164) for purposes of call authorization and call routing.
A dial plan consists of one or more normalization rules that define how phone numbers expressed in various formats are translated to an alternate format. The same dial string may be interpreted and translated differently in different dial plans, so depending on which dial plan is assigned to a given user, the same dialed number may be translated and routed differently.
If you want to be able to call from Teams using internal extensions, then a custom dial plan is needed. Example: A Teams user dials extension 200 that belongs to a callflow. Without custom dial plan, Microsoft Direct Routing will transform the called number “200” to “+32200”, which will not match your callflow in the portal. To make this possible, we will create this dial plan for 3 digits (if you use 4 digits, you need to adapt this script):
$nr1=New-CsVoiceNormalizationRule -Identity MYPROVIDER/ED3 -Description ‘MYPROVIDER-extension dialing – 3 digits’ -Pattern ‘^(\d{3})$’ -Translation ‘$1’ -InMemory
New-CsTenantDialPlan -Identity MYPROVIDER-internal-extensions -NormalizationRules @{Add=$nr1} -SimpleName MYPROVIDER-internal-extensions
When done, you need to assign this dial plan to the users:
Grant-CsTenantDialPlan -Identity user1@contoso.com -PolicyName MYPROVIDER-internal-extensions
Grant-CsTenantDialPlan -Identity user2@contoso.com -PolicyName MYPROVIDER-internal-extensions
If you get an error, saying that the policy cannot be applied, this user needs to login one time into the team client.
Note: If you get an error, saying that the policy cannot be applied, this user needs to login one time into the Teams client. It can takes a couple of minutes, even hours for this configuration to be completely propagated on all Microsoft servers.
Create the callflow(s) on AC3
Create the callflow to route the numbers to Microsoft Teams Direct Routing:
Test and validation
At this stage, you should contact our Support to validate the link between our services and your Microsoft Teams Direct Routing is well connected and that the configuration on our side is finished.
You should then be able to call in and out from/to Microsoft Teams.