Microsoft Teams - Unassigned Numbers

Posted by     "Erwin Bierens" on Tuesday, October 26, 2021

Back in the days of Skype for Business Onpremises this was a default feature that was being used for announcements of old number ranges and severeral other cases like people leaving the company and reroute phone calls to reception.

For this new feature in Microsoft Teams you will need to have the PowerShell Microsoft Teams module version 2.5.1 or higher.

In this article about the Microsoft Teams PowerShell module you can check your version and method to upgrade.

In order to route calls to an unassigned number Microsoft created 4 new cmdlets

  • New-CsTeamsUnassignedNumberTreatment
  • Get-CsTeamsUnassignedNumberTreatment
  • Set-CsTeamsUnassignedNumberTreatment
  • Remove-CsTeamsUnassignedNumberTreatment

Configuration number range to resource account

First make sure you’ll have a resource account that we will assigned to the unassigned numbers.

$RAObjectId = (Get-CsOnlineApplicationInstance -Identity

With above cmdlet we will write the Object ID to an variable that will be used when creating the unassigned number range.

New-CsTeamsUnassignedNumberTreatment -Identity AAUnassigned -Pattern "^\+3188446\d{4}$" -TargetType ResourceAccount -Target $RAObjectId -TreatmentPriority 1

The pattern is based on regex, in this case the last 4 digits will be variable.

Configuration number range to user account

You can also choose to deliver the unassigned number range to a specific user. In this case you will need to change your script to:

$UserObjectId = (Get-CsOnlineUser -Identity

New-CsTeamsUnassignedNumberTreatment -Identity UnassignedUser -Pattern "^\+3188446\d{4}$" -TargetType User -Target $UserObjectId -TreatmentPriority 2

Configuration announcement service

It’s also possible to route your number range with an announcement message. This can be a WAV file. First step is to upload the WAV file by PowerShell and write this to an variable.

$Content = Get-Content "C:\temp\Annoucement.wav" -Encoding byte -ReadCount 0

$AudioFile = Import-CsOnlineAudioFile -FileName "MainAnnouncement.wav" -Content $Content

$fid = [System.Guid]::Parse($AudioFile.Id)

Next step is to create the unassigned number range with the announcement.

New-CsTeamsUnassignedNumberTreatment -Identity AAUnassigned -Pattern "^\+3188446\d{4}$" -TargetType Announcement -Target $fid.Guid -TreatmentPriority 2

when using the announcement service, the message will be played only once to the caller.

Reference Microsoft Docs

comments powered by Disqus