Topic Last Modified: 2010-10-01

Modifies the properties of a public switched telephone network (PSTN) gateway. PSTN gateways help route calls between devices on the external PSTN network and devices on your internal Enterprise Voice network.


Set-CsPstnGateway [-Identity <XdsGlobalRelativeIdentity>] [-AlternateByPassId <String>] [-Confirm [<SwitchParameter>]] [-Default <$true | $false>] [-Force <SwitchParameter>] [-GatewaySipClientTcpPort <Nullable>] [-GatewaySipClientTlsPort <Nullable>] [-MediationServer <String>] [-RepresentativeMediaIP <String>] [-Routable <$true | $false>] [-WhatIf [<SwitchParameter>]]


Parameter Required Type Description



Xds Identity

Service identity of the PSTN gateway to be modified. For example: -Identity "PstnGateway:".

Note that you can leave off the prefix "PstnGatewayServer:" when specifying a PSTN gateway. For example: -Identity "".




Globally unique identifier (GUID) representing the alternate bypass ID. This ID is automatically generated by Lync Server 2010 and is used to help eliminate hairpin calls. Depending on the way you have configured your system, this allows hairpin calls to automatically bypass the Mediation Server without you having to define and associate individual subnets with all your sites and regions.

To do this, you typically need to globally enable bypass to use network configuration sites and regions, then enable bypass on the trunk configuration for your PSTN gateway.

A hairpin call occurs when an inbound call from the PSTN network is routed back to that network through call forwarding or simultaneous ringing.




If set to True, this gateway will handle calls sent from Office Communications Server 2007 R2. There can only be one default gateway in the collection of gateways managed by a single Mediation Server.




Listening port used for communicating with Mediation Servers by using Transmission Control Protocol (TCP). The default value is 5066.




Listening port used for communicating with Mediation Servers by using the Transport Layer Security (TLS) protocol. The default value is 5067.




Service identity of the Mediation Server to be associated with the PSTN gateway. For example: -MediationServer "".




IP address of the media processor associated with the gateway, provided that the processor location is different from the signaling address. Both media bypass and call admission control (CAC) are based on the location of the gateway’s media processor; by default, this is the same location as the signaling address. If the two locations differ (for example, with the media processor in a remote site and the signaling peer in the central site) then RepresentativeMediaIP must be configured with the IP address of the media processor.

If you have deployed multiple media processors in the same site, each with its own IP addresses, then you can use any of these IP addresses when configuring the RepresentativeMediaIP property.




If set to True, the gateway can be used in outbound routing routes.



Switch Parameter

Describes what would happen if you executed the command without actually executing the command.



Switch Parameter

Prompts you for confirmation before executing the command.

Detailed Description

PSTN gateways enable your Enterprise Voice users to make phone calls to, and receive phone calls from, people on the PSTN network. These gateways act as a bridge between the Mediation Server and the PSTN network.

PSTN gateways are typically required when you are using a Time Division Multiplex Public Branch Exchange (PBX) phone system; in that case, you will typically need to employ both a PSTN gateway and a Mediation Server in order to route Enterprise Voice calls to the PSTN network. By contrast, if you are using an IP-PBX system you can create a direct SIP connection between the PBX and the Mediation Server, eliminating the need for a PSTN gateway.

After your PSTN gateways have been installed and configured, they can be managed by using the Set-CsPstnGateway cmdlet.

Who can run this cmdlet: By default, members of the following groups are authorized to run the Set-CsPstnGateway cmdlet locally: RTCUniversalServerAdmins. To return a list of all the role-based access control (RBAC) roles this cmdlet has been assigned to (including any custom RBAC roles you have created yourself), run the following command from the Windows PowerShell prompt:

Get-CsAdminRole | Where-Object {$_.Cmdlets –match "Set-CsPstnGateway"}

Input Types

None. Get-CsPstnGateway does not accept pipelined input.

Return Types

Set-CsPstnGateway does not return any objects or values. Instead, the cmdlet modifies existing instances of the Microsoft.Rtc.Management.Xds.DisplayPstnGateway object.


-------------------------- Example 1 ------------------------

Copy Code
Set-CsPstnGateway -Identity "PstnGateway:" -Default $True

The command shown in Example 1 configures the gateway PstnGateway: to be the default gateway. That means that PstnGateway: can be used to handle calls originating from Office Communications Server 2007 R2.

-------------------------- Example 2 ------------------------

Copy Code
Get-CsService -PstnGateway | ForEach-Object {Set-CsPstnGateway -Identity $_.Identity -Routable $True}

The preceding command configures all the PSTN gateways in the organization, ensuring that each of these gateways can be used in outbound routing. To do this, the command first uses the Get-CsService cmdlet and the PstnGateway parameter to return a collection of all the PSTN gateways currently in use. This collection is then piped to the ForEach-Object cmdlet. ForEach-Object runs the Set-CsPstnGateway cmdlet against each gateway in the collection, setting the Routable property of each one to True.

See Also

Other Resources