New-UcmCsFixedNumberDiversion

Creates an AutoAttendant to forward a PSTN number to an external number permanently, which can be used as a batch to produce large quantities of forwards.

Description

Diverts a number associated with Microsoft Teams Via Microsoft Calling plans or Telstra Calling to an external PSTN number by performing the following actions

  • Creates a Resource Account with named "PSTN_FWD_(inboundNumber)@domain.onmicrosoft.com" by default (Configurable using -AccountPrefix)

  • Licences the account with a Virtual Phone System Licence

  • Licences the account with an appropriate calling licence (Will attempt to locate a calling licence using Locate-CsCallingLicence)

  • Creates an AutoAttendant with a 24-hour schedule

  • Configures a forward rule in the AutoAttendant

circle-check
circle-exclamation
triangle-exclamation

Examples

PS> New-CsFixedNumberDiversion -OriginalNumber +61370105550 -TargetNumber +61755501234

Creates an AutoAttendant associated with the number +61370105550 to forward calls to +61755501234

circle-info

The target number does not need to be internal to the Teams Tenant, but the resource account will require licences/policies for PSTN calling as per your tenant.

Parameters

-OriginalNumber: The number of the new AutoAttendant. IE: The number you wish to forward from

-TargetNumber: The number the AutoAttendant will forward calls to. IE: the number you wish to forward to

-Domain: This domain name will be used to create the resource accounts for the diversion. This should be an "onmicrosoft" domain or fully AzureAD-hosted domain to minimise any directory sync issues For example, "Contoso.onmicrosoft.com"

-LicenceType: This specifies how the cmdlet will licence the AutoAttendant to make PSTN calls. Valid options are, MCOPSTN1, MCOPSTN2, MCOPSTNEAU2

circle-exclamation

-Country: As we set licences for the virtual users, we need to know what country to licence them in. Make sure to use upper case!

-AccountPrefix: (optional) This is the name that will be placed before the inbound phone number in the account name, used if you have a special naming convention for service accounts "PSTN_FWD_" by default

-AADisplayName: (optional) The display name to assign to the AutoAttendant "<original number> Forward" by default

Inputs

circle-info

This cmdlet also supports pipeline input, so you can pass a whole bunch of numbers using multiple objects on the pipeline!

Pipeline Example

This will create a forward for each number in the New-UcmCsFixedNumberDiversion-Example.csv file using their OriginalNumber and TargetNumber properties and licence them for Telstra Calling for Office 365 in Australia.

Example CSV file (Downloadarrow-up-right)

OriginalNumber
TargetNumber

61370105550

61755501230

61370105551

61755501231

61370105552

61755501232

61370105553

61755501233

61370105554

61755501234

Outputs

This Cmdet returns a PSCustomObject with multiple keys to indicate the cmdlet results.

chevron-right$Return.Statushashtag

$Return.Status returns one of four values "OK" : The operation was successful, nothing of concern "Warn" : The operation was successful, but there is something you should be mindful of (For example trying to create a forward that already exists, or running low on licences to assign) More information will be found in $Return.Message "Error" : The operation was unsuccessful, Something happened when attempting to perform the operation that the function couldn't handle automatically, check $Return.Message for more information "Unknown" : Cmdlet reached the end of the function without returning anything, this shouldn't happen, if it does please log an issue on GitHub with your relevant log files.

chevron-right$Return.Messagehashtag

$Return.Message returns descriptive text relevant to the status, mainly for logging, reporting or diagnosis.

Last updated