Set-CsTeamsUnassignedNumberTreatment

Changes a treatment for how calls to an unassigned number range should be routed. The call can be routed to a user, an application or to an announcement service where a custom message will be played to the caller.

Syntax

Set-CsTeamsUnassignedNumberTreatment
   [[-Identity] <string>]
   [-Description <string>]
   [-Pattern <string>]
   [-Target <string>]
   [-TargetType <string>]
   [-TreatmentPriority <int>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

This cmdlet changes a treatment for how calls to an unassigned number range should be routed.

Examples

Example 1

$RAObjectId = (Get-CsOnlineApplicationInstance -Identity aa2@contoso.com).ObjectId
Set-CsTeamsUnassignedNumberTreatment -Identity MainAA -Target $RAObjectId

This example changes the treatment MainAA to route the calls to the resource account aa2@contoso.com.

Example 2

$UserObjectId = (Get-CsOnlineUser -Identity user2@contoso.com).Identity
Set-CsTeamsUnassignedNumberTreatment -Identity User2PSTN -TargetType User -Target $UserObjectId

This example changes the treatment User2PSTN to route the calls to the user user2@contoso.com.

Parameters

-Description

Free format description of this treatment.

Type:System.String
Position:named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Identity

The Id of the specific treatment.

Type:System.String
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Pattern

A regular expression that the called number must match in order for the treatment to take effect. It is best practice to start the regular expression with the hat character and end it with the dollar character. You can use various regular expression test sites on the Internet to validate the expression.

Type:System.String
Position:named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Target

The identity of the destination the call should be routed to. Depending on the TargetType it should either be the ObjectId of the user or application instance/resource account or the AudioFileId of the uploaded audio file.

Type:System.Guid
Position:named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TargetType

The type of target used for the treatment. Allowed values are User, ResourceAccount and Announcement.

Type:System.String
Position:named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TreatmentPriority

The priority of the treatment. Used to distinguish identical patterns. The lower the priority the higher preference. The priority needs to be unique.

Type:System.Integer
Position:named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

System.Object

Outputs

System.Object

Notes

The cmdlet is available in Teams PS module 2.5.1 or later.

Both inbound calls to Microsoft Teams and outbound calls from Microsoft Teams will have the called number checked against the unassigned number range.

To route calls to unassigned Microsoft Calling Plan subscriber numbers, your tenant needs to have available Communications Credits.

To route calls to unassigned Microsoft Calling Plan service numbers, your tenant needs to have at least one Microsoft Teams Phone Resource Account license.

If a specified pattern/range contains phone numbers that are assigned to a user or resource account in the tenant, calls to these phone numbers will be routed to the appropriate target and not routed to the specified unassigned number treatment. There are no other checks of the numbers in the range. If the range contains a valid external phone number, outbound calls from Microsoft Teams to that phone number will be routed according to the treatment.