Forum Discussion
Assign a phone number for user using Direct Routing
Hi VoipJedi,
To enable users for Direct Routing, you must have the following:
- A Direct Routing trunk configured in Teams.
- The appropriate licensing for your users, including the Phone System license and a calling plan.
Once you have these things in place, you can enable users for Direct Routing by following these steps:
- Go to the Microsoft Teams admin center.
- Click Users > Manage users.
- Select the user or users that you want to enable for Direct Routing.
- Under Account, click Edit.
- Under Assign phone number, select Enable users for Direct Routing.
- Click Apply.
Enable users for Direct Routing - Microsoft Teams | Microsoft Learn
To assign a phone number for a user using Direct Routing, follow these steps:
- Go to the Microsoft Teams admin center.
- Click Users > Manage users.
- Select the user to whom you want to assign a phone number.
- Under Account, click Edit.
- Under Assign phone number, select Direct Routing from the Phone number type drop-down menu.
- Enter the phone number that you want to assign to the user.
- Click Apply.
Assign phone numbers for users in Teams: https://learn.microsoft.com/en-us/microsoftteams/assign-change-or-remove-a-phone-number-for-a-user
You can also do that with PowerShell:
To enable users for Direct Routing in Teams using PowerShell, follow these steps:
- Open PowerShell as an administrator.
- Import the Teams PowerShell module:
Import-Module MicrosoftTeams​
- Connect to Teams:
Connect-MicrosoftTeams -Credential $credential​
where $credential is a variable that stores your Teams administrator credentials.
- Get a list of all users that are enabled for Phone System:
Get-CsOnlineUser | Where-Object { $_.EnterpriseVoiceEnabled -eq $true }​
- Enable the users for Direct Routing:
Set-CsUser -Identity "<User name>" -PhoneSystemRoutingPolicyName "DirectRouting"​
where <User name> is the name of the user that you want to enable for Direct Routing.
- Assign a phone number to the user:
Set-CsUser -Identity "<User name>" -LineUri "<Phone number>"​
where <Phone number> is the phone number that you want to assign to the user.
- Disconnect from Teams:
Disconnect-MicrosoftTeams​
For example, to enable a user named John Doe for Direct Routing and assign him the phone number 123-456-7890, you would use the following PowerShell commands:
Import-Module MicrosoftTeams
Connect-MicrosoftTeams -Credential $credential
# Get a list of all users that are enabled for Phone System
$users = Get-CsOnlineUser | Where-Object { $_.EnterpriseVoiceEnabled -eq $true }
# Enable John Doe for Direct Routing
Set-CsUser -Identity "John Doe" -PhoneSystemRoutingPolicyName "DirectRouting"
# Assign the phone number 123-456-7890 to John Doe
Set-CsUser -Identity "John Doe" -LineUri "123-456-7890"
Disconnect-MicrosoftTeams
You can also use PowerShell to enable multiple users for Direct Routing at once. For example, to enable all users that are enabled for Phone System for Direct Routing, you would use the following PowerShell command:
Get-CsOnlineUser | Where-Object { $_.EnterpriseVoiceEnabled -eq $true } | Set-CsUser -PhoneSystemRoutingPolicyName "DirectRouting"
Once you have enabled users for Direct Routing and assigned them phone numbers, they will be able to make and receive calls using their Direct Routing trunk.
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.
If the post was useful in other ways, please consider giving it Like.
Kindest regards,
Leon Pavesic
(LinkedIn)
- hjan-22Dec 26, 2023Copper Contributor
Hi LeonPavesic ,
I have the below licenses attached to my account:
- MS Teams Phone Standard
- MS 365 Business Standard
- MS Teams Domestic and International Calling Plan (I disabled this because of the same problem VoipJedi is having).
However, when I use PowerShell to assign the number, this is what it gives me:
This is what shows under the Voice > Phone Number:
As it can be seen, the number that I procured from Microsoft while setting up my account is of Calling Plan type which is why I am unable to use it for Direct Routing.
Can you please guide me on how can I make use of a Direct Routing Number for my testing and usage?
Any degree of help will be highly appreciated.
Best Regards,
Hisham