On 30th April, Microsoft Teams PowerShell module 2.3.0 was released. As a result the Set-CSCallingLineIdentity command now allows the ability to create Caller Line Identities policies which utilise Direct Routing resource accounts. Check out the release notes for the updated version here.
Before we can use the new module, we need to update it.
Run PowerShell as an admin and run the following command.
Update-Module MicrosoftTeams
We can confirm the update was completed successfully by running the two commands.
Import-Module MicrosoftTeams
Get-Module MicrosoftTeams
Now that we’ve updated, we can create the new Caller ID policy for our Direct Routing enabled Call Queue.
In this example, we’ll create a new Caller ID policy using the Front Desk telephone number, 01632 960 000
Note: All numbers used in this example are fictional and allocated by Ofcom for TV and Radio use only.
THIS CODE IS SAMPLE CODE. THESE SAMPLES ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND.
First, we’ll connect to Microsoft Teams.
Connect-MicrosoftTeams
To create a new Caller ID Policy, we can run the following script.
$ResourceId = Read-Host "Please enter the UPN of the Resource Account"
$PolicyName = Read-Host "Please enter the name of the new policy"
$CompanyName = Read-Host "Please enter the Company Name"
$ObjId = (Get-CsOnlineApplicationInstance -Identity $ResourceId).ObjectId
New-CsCallingLineIdentity -Identity $PolicyName -CallingIDSubstitute Resource -ResourceAccount $ObjId -CompanyName "$CompanyName"
If we’re making a change to a Caller ID policy already created, we can run the following script.
$ResourceId = Read-Host "Please enter the UPN of the Resource Account"
$PolicyName = Read-Host "Please enter the name of the policy to update"
$CompanyName = Read-Host "Please enter the Company Name"
$ObjId = (Get-CsOnlineApplicationInstance -Identity $ResourceId).ObjectId
Set-CsCallingLineIdentity -Identity $PolicyName -CallingIDSubstitute Resource -ResourceAccount $ObjId -CompanyName "$CompanyName"
Get-CsCallingLineIdentity -Identity $PolicyName
Now the Caller ID policy is ready to be assigned to our users via the Teams Admin Center.
Now that the user has been assigned our new Caller ID policy, any outbound call will show the Direct Routing number as the Caller ID.