Numbers

Microsoft Teams – Routing calls to unassigned numbers

A new feature has turned up today in Microsoft Teams – the long awaited ability to route unassigned numbers. This was available in Skype for Business On-premises, and is great for misdials or when someone departs the firm, their calls can be sent to someone else, such as reception. There’s no ongoing work or maintenance required either, once a number is unassigned, it can be picked up by these rules.

The documentation is light at the moment and it’s in preview, but it does work. Note that I’ll cover the call redirect option, but there’s also an option to redirect calls to a pre-recorded message in WAV format.

First, make sure your MicrosoftTeams PowerShell module is at least 2.5.1. The latest live version at the time of writing is 2.6.0 so you don’t need to worry about preview module versions – just the PowerShell command:

Update-Module Microsoft Teams

will update. You can check the version afterwards with this command:

Get-Module MicrosoftTeams | Format-Table Name,Version

Once your MicrosoftTeams module is up to date, and if you’re redirecting the call to a user, auto attendant or calling group, you’ll first need to get the ObjectID. Here’s Microsoft’s example for a resource account:

$RAObjectId = (Get-CsOnlineApplicationInstance -Identity [email protected]).ObjectId

However, if you’re redirecting to a normal user account, use this command instead:

$UserObjectId = (Get-CsOnlineUser -Identity [email protected]).ObjectId

Once you have the $UserObjectID value set, it’s time to create the Unassigned Number Treatment. The possible options for this command are documented here and again here’s an example:

New-CsTeamsUnassignedNumberTreatment -Identity Unassigned1 -Pattern "^\+618xxxxxx\d{2}$" -TargetType User -Target $UserObjectId -TreatmentPriority 2

I’ll break down a few of these values.

Identity: This needs to be a unique value for the treatment and can be a descriptive name.

Pattern: This is where you define the number pattern. In my example above, I’m wanting the number to match what I’ve defined up to the last two digits, which can be anything.

TargetType: This needs to be defined as User, ResourceAccount or Announcement for the Target.

Target: This is the ObjectID from the first command.

TreatmentPriority: This needs to be a unique number for each treatment, and has an order preference in case of overlap in rules. I’m using 2 above purely because it’s the second one, and have no plans on overlapping rules.

Once the New-CsTeamsUnassignedNumberTreatment command has completed, it won’t apply immediately – in my testing it took roughly 15 minutes.

I’m really glad this feature is now available – and I expect others have also been waiting for it to be available, or weren’t aware it was even an option.