Commands › Microsoft Teams

Set-CsOnlineVoiceRoute

Microsoft Teams MicrosoftTeams Set-*

Modifies an online voice route. Online voice routes contain instructions that tell Microsoft Teams how to route calls from Microsoft or Office 365 users to phone numbers on the public switched telephone network (PSTN) or a private branch exchange (PBX).

Quick start script

# Set-CsOnlineVoiceRoute — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-MicrosoftTeams -CertificateThumbprint $thumb -ApplicationId $appId -TenantId $tenantId

# 2. Capture the current state first — you cannot roll back what you never recorded
$before = Get-CsOnlineVoiceRoute
$before | Format-List

# 3. Make the change (dry run first)
Set-CsOnlineVoiceRoute  -WhatIf
Set-CsOnlineVoiceRoute

# 4. Verify and diff
$after = Get-CsOnlineVoiceRoute
Compare-Object ($before | Out-String) ($after | Out-String)

Syntax

Set-CsOnlineVoiceRoute [-BridgeSourcePhoneNumber <String>] [-Description <String>] [[-Identity] <String>]
 [-NumberPattern <String>] [-OnlinePstnGatewayList <Object>] [-OnlinePstnUsages <Object>] [-Priority <Int32>]
 [-WhatIf] [-Confirm] [<CommonParameters>]

Parameters (9)

ParameterTypeRequiredWhat it controls
-BridgeSourcePhoneNumber String BridgeSourcePhoneNumber is an E.164 formatted Operator Connect Conferencing phone number assigned to your Audio Conferencing Bridge. Using BridgeSourcePhoneNumber in an online voice route is mutually exclusive with...
-Confirm SwitchParameter Prompts you for confirmation before running the cmdlet.
-Description String A description of what this phone route is for.
-Identity XdsGlobalRelativeIdentity The unique identity of the online voice route. (If the route name contains a space, such as Test Route, you must enclose the full string in parentheses.)
-NumberPattern String A regular expression that specifies the phone numbers to which this route applies. Numbers matching this pattern will be routed according to the rest of the routing settings. For example, the default number pattern,...
-OnlinePstnGatewayList PSListModifier This parameter contains a list of online gateways associated with this online voice route. Each member of this list must be the service Identity of the online PSTN gateway. The service Identity is the fully qualified...
-OnlinePstnUsages PSListModifier A list of online PSTN usages (such as Local, Long Distance, etc.) that can be applied to this online voice route. The PSTN usage must be an existing usage (PSTN usages can be retrieved by calling the...
-Priority Int32 A number could resolve to multiple online voice routes. The priority determines the order in which the routes will be applied if more than one route is possible. The lowest priority will be applied first and then in...
-WhatIf SwitchParameter Shows what would happen if the cmdlet runs. The cmdlet is not run.

Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.