Topic Last Modified: 2010-10-01

Modifies a voice route. Voice routes contain instructions that tell Microsoft Lync Server 2010 how to route calls from Enterprise Voice users to phone numbers on the public switched telephone network (PSTN) or a private branch exchange (PBX).

Syntax

Set-CsVoiceRoute [-Identity <XdsGlobalRelativeIdentity>] [-AlternateCallerId <String>] [-Confirm [<SwitchParameter>]] [-Description <String>] [-Force <SwitchParameter>] [-NumberPattern <String>] [-Priority <Int32>] [-PstnGatewayList <PSListModifier>] [-PstnUsages <PSListModifier>] [-SuppressCallerId <Nullable>] [-WhatIf [<SwitchParameter>]]
Set-CsVoiceRoute [-AlternateCallerId <String>] [-Confirm [<SwitchParameter>]] [-Description <String>] [-Force <SwitchParameter>] [-Instance <PSObject>] [-NumberPattern <String>] [-Priority <Int32>] [-PstnGatewayList <PSListModifier>] [-PstnUsages <PSListModifier>] [-SuppressCallerId <Nullable>] [-WhatIf [<SwitchParameter>]]

Parameters

Parameter Required Type Description

Identity

Optional

XdsIdentity

The unique identity of the voice route. (If the route name contains a space, such as Test Route, you must enclose the full string in parentheses.)

Instance

Optional

Route

Allows you to pass a reference to an object to the cmdlet rather than set individual parameter values. This object must be of type Microsoft.Rtc.Management.WritableConfig.Policy.Voice.Route and can be retrieved by calling Get-CsVoiceRoute.

AlternateCallerId

Optional

String

If the SuppressCallerId parameter is set to True, the value of the AlternateCallerId parameter will be displayed to receiving parties rather than the caller’s actual number. This number should be a valid number and could be used to represent a division within an organization, such as Support or Human Resources.

If the SuppressCallerId parameter is set to False, the AlternateCallerId parameter is ignored.

This value must match the regular expression (\+)?[1-9]\d*(;ext=[1-9]\d*)?. In other words, the value can begin with a plus sign (+) but doesn’t need to; must consist of any number of digits; and may be followed by an extension that begins with ;ext= followed by any number of digits. (Note that if you include an extension the string must be placed within double quotes.)

Description

Optional

String

A description of what this phone route is for.

NumberPattern

Optional

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, [0-9]{10}, specifies a 10-digit number containing any digits 0 through 9.

Priority

Optional

Int32

A number could resolve to multiple voice routes. The priority determines the order in which the routes will be applied if more than one route is possible.

PstnGatewayList

Optional

PSListModifier

A Mediation Server can be associated with multiple gateways. This parameter contains a list of gateways associated with this voice route. Each member of this list must be the service Identity of the PSTN gateway or Mediation Server. The value can refer to a Mediation Server only if the Mediation Server is configured for Microsoft Office Communications Server 2007 or Microsoft Office Communications Server 2007 R2. For Lync Server 2010 a PSTN gateway must be used. The service Identity is a string in the format ServiceRole:FQDN, where ServiceRole is the name of the service role (PSTNGateway), and FQDN is the fully qualified domain name (FQDN) of the pool or the IP address of the server. For example, PSTNGateway:redmondpool.litwareinc.com. Service identities can be retrieved by calling the command Get-CsService | Select-Object Identity.

If you make changes to a voice route and leave the PstnGatewayList list empty, or if the change you make removes all the items in the list, you’ll receive a warning message that users will be unable to make PSTN calls.

PstnUsages

Optional

A list of PSTN usages (such as Local or Long Distance) that can be applied to this voice route. The PSTN usage must be an existing usage. (PSTN usages can be retrieved by calling the Get-CsPstnUsage cmdlet.)

If you make changes to a voice route and leave the PstnUsages list empty, or if the change you make removes all the PSTN usages in the list, you’ll receive a warning message that users will be unable to make PSTN calls.

SuppressCallerId

Optional

Boolean

Determines whether a caller’s ID will be revealed on outbound calls. If this parameter is set to True, caller ID will be suppressed. In place of the actual ID, the value of the AlternateCallerId will be displayed. When SuppressCallerId is set to True, a value for AlternateCallerId must be supplied.

Confirm

Optional

SwitchParameter

Prompts you for confirmation before executing the command.

Force

Optional

SwitchParameter

Suppresses any confirmation prompts that would otherwise be displayed before making changes.

WhatIf

Optional

SwitchParameter

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

Detailed Description

Use this cmdlet to modify an existing voice route. Voice routes are associated with voice policies through public switched telephone network (PSTN) usages. A voice route includes a regular expression that identifies which phone numbers will be routed through a given voice route: phone numbers matching the regular expression will be routed through this route.

Who can run this cmdlet: By default, members of the following groups are authorized to run the Set-CsVoiceRoute 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-CsVoiceRoute"}

Input Types

Microsoft.Rtc.Management.WritableConfig.Policy.Voice.Route object. Accepts pipelined input of voice route objects.

Return Types

Set-CsVoiceRoute does not return a value or object. Instead, the cmdlet configures instances of the Microsoft.Rtc.Management.WritableConfig.Policy.Voice.Route object.

Example

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

Copy Code
Set-CsVoiceRoute -Identity Route1 -Description "Test Route"

This command sets the Description of the Route1 voice route to "Test Route."

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

Copy Code
Set-CsVoiceRoute -Identity Route1 -PstnUsages @{add="Long Distance"}

The command in this example modifies the voice route with the identity Route1 to add the PSTN usage Long Distance to the list of usages for this voice route. Long Distance must be in the list of global PSTN usages (which can be retrieved with a call to Get-CsPstnUsage).

-------------------------- Example 3 --------------------------

Copy Code
$x = (Get-CsPstnUsage).Usage
Set-CsVoiceRoute -Identity Route1 -PstnUsages @{replace=$x}

This example modifies the voice route named Route1 to populate that route’s list of PSTN usages with all the existing usages for the organization. The first command in this example retrieves the list of global PSTN usages. Notice that the call to Get-CsPstnUsage is in parentheses; this means that we first retrieve an object containing PSTN usage information. (Because there is only one--global--PSTN usage, only one object will be retrieved.) The command then retrieves the Usage property of this object. That property, which contains a list of PSTN usages, is assigned to the variable $x. In the second line of this example, Set-CsVoiceRoute is called to modify the voice route with the identity Route1. Notice the value passed to the PstnUsages parameter: @{replace=$x}. This value says to replace everything in the PstnUsages list for this route with the contents of $x, which contain the PSTN usages list retrieved in line 1.

-------------------------- Example 4 --------------------------

Copy Code
$x = Get-CsVoiceRoute -Identity Route1
$x.Name = "RouteA"
Set-CsVoiceRoute -Instance $x

This set of commands changes the Name property of the voice route with the identity Route1 to RouteA. Changing the Name property automatically changes the Identity property, in this case to RouteA.

In the first line, Get-CsVoiceRoute is called to retrieve the voice route with the identity Route1. The returned object is stored in the variable $x. Next, the Name property of that object is assigned the string value "RouteA". Finally, the object (contained in the variable $x) is passed to the Instance parameter of Set-CsVoiceRoute to make the change.

-------------------------- Example 5 --------------------------

Copy Code
$y = Get-CsVoiceRoute -Identity Route1
$y.PstnGatewayList.Add("PstnGateway:192.168.0.100")
Set-CsVoiceRoute -Instance $y

This example modifies the voice route named Route1 and populates that route’s list of PSTN gateways (PstnGatewayList) with the server role of the gateway with the identity PstnGateway:192.168.0.100. In the first line of this example, Get-CsVoiceRoute is called to retrieve the voice route we want to modify, in this case Route1. Next we call the Add method on the PstnGatewayList property of Route1. We pass the Add method the Identity of the service we want to add. Finally, we call Set-CsVoiceRoute, passing the Instance parameter the variable $y, which will update Route1 (stored in $y) with the newly-added PSTN gateway.

See Also