Commands › Microsoft Teams

Set-CsOnlinePSTNGateway

Microsoft Teams MicrosoftTeams Set-*

Modifies the previously defined Session Border Controller (SBC) Configuration that describes the settings for the peer entity. This cmdlet was introduced with Microsoft Phone System Direct Routing.

Quick start script

# Set-CsOnlinePSTNGateway — 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-CsOnlinePSTNGateway
$before | Format-List

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

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

Syntax

Set-CsOnlinePSTNGateway [[-Identity] <string>]
 [-BypassMode <string>]
 [-Confirm]
 [-Description <string>]
 [-Enabled <boolean>]
 [-FailoverResponseCodes <string>]
 [-FailoverTimeSeconds <int>]
 [-ForwardCallHistory <boolean>]
 [-ForwardPai <boolean>]
 [-GatewayLbrEnabledUserOverride <boolean>]
 [-GatewaySiteId <string>]
 [-GatewaySiteLbrEnabled <boolean>]
 [-IPAddressVersion <string>]
 [-InboundPstnNumberTranslationRules <Object>]
 [-InboundTeamsNumberTranslationRules <Object>]
 [-MaxConcurrentSessions <int>]
 [-MediaBypass <boolean>]
 [-MediaRelayRoutingLocationOverride <string>]
 [-OutboundPstnNumberTranslationRules <Object>]
 [-OutboundTeamsNumberTranslationRules <Object>]
 [-PidfLoSupported <boolean>]
 [-ProxySbc <string>]
 [-SendSipOptions <boolean>]
 [-SipSignalingPort <int>]
 [-WhatIf]
 [<CommonParameters>]

Parameters (25)

ParameterTypeRequiredWhat it controls
-BypassMode String Possible values are "None", "Always" and "OnlyForLocalUsers". By setting "Always" mode you indicate that your network is fully routable. If a user usually in site "Seattle", travels to site "Tallinn" and tries to use...
-Confirm SwitchParameter Prompts you for confirmation before running the cmdlet.
-Description String Free-format string to describe the gateway.
-Enabled Boolean Used to enable this SBC for outbound calls. Can be used to temporarily remove the SBC from service while it is being updated or during maintenance. Note if the parameter is not set the SBC will be created as disabled...
-FailoverResponseCodes String If Direct Routing receives any 4xx or 6xx SIP error code in response on outgoing Invite (outgoing means call from a Teams client to PSTN with traffic flow :Teams Client -> Direct Routing -> SBC -> Telephony network)...
-FailoverTimeSeconds Int32 When set to 10 (default value), outbound calls that are not answered by the gateway within 10 seconds are routed to the next available trunk; if there are no additional trunks, then the call is automatically dropped....
-ForwardCallHistory Boolean Indicates whether call history information will be forwarded through the trunk. If enabled, the Office 365 PSTN Proxy sends two headers: History-info and Referred-By. The default value is False ($False).
-ForwardPai Boolean Indicates whether the P-Asserted-Identity (PAI) header will be forwarded along with the call. The PAI header provides a way to verify the identity of the caller. The default value is False ($False). Setting this...
-GatewayLbrEnabledUserOverride Boolean Allows an LBR enabled user working from a network site outside the corporate network or a network site on the corporate network not configured using a tenant network site to make outbound PSTN calls or receive...
-GatewaySiteId String PSTN Gateway Site Id.
-GatewaySiteLbrEnabled Boolean Used to enable this SBC to report assigned site location. Site location is used for Location Based Routing. When this parameter is turned on, the SBC will report the site name as defined by tenant administrator. On...
-Identity String The parameter is mandatory when modifying an existing SBC.
-InboundPSTNNumberTranslationRules Object Creates an ordered list of Teams translation rules, that apply to PSTN number on inbound direction.
-InboundTeamsNumberTranslationRules Object This parameter assigns an ordered list of Teams translation rules, that apply to Teams numbers on inbound direction.
-IPAddressVersion String Possible values are "IPv4" and '"Pv6". When "IPv6" is set, the SBC must use IPv6 for both signaling and media. **Note: IPv6 is supported only for non-media bypass scenarios.**
-MaxConcurrentSessions Int32 Used by the alerting system. When any value is set, the alerting system will generate an alert to the tenant administrator when the number of concurrent session is 90% or higher than this value. If this parameter is...
-MediaBypass Boolean Parameter indicated of the SBC supports Media Bypass and the administrator wants to use it for this SBC.
-MediaRelayRoutingLocationOverride String Allows selecting path for media manually. Direct Routing assigns a datacenter for media path based on the public IP of the SBC. We always select closest to the SBC datacenter. However, in some cases a public IP from...
-OutboundPSTNNumberTranslationRules Object Assigns an ordered list of Teams translation rules, that apply to PSTN number on outbound direction.
-OutboundTeamsNumberTranslationRules Object Creates an ordered list of Teams translation rules, that apply to Teams Number on outbound direction.
-PidfloSupported Boolean Enables PIDF-LO support on the PSTN Gateway. If turned on the .xml body payload is sent to the SBC with the location details of the user.
-ProxySbc String The FQDN of the proxy SBC. Used in Local Media Optimization configurations.
-SendSipOptions Boolean Defines if an SBC will or will not send the SIP options. If disabled, the SBC will be excluded from Monitoring and Alerting system. We highly recommend that you enable SIP options. Default value is True.
-SipSignalingPort Int32 Listening port used for communicating with Direct Routing services by using the Transport Layer Security (TLS) protocol. The value must be between 1 and 65535.
-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.