Edit

Share via


Test-CsVoicePolicy

Tests a telephone number against a voice policy and determines which voice route would be used against that policy for that number. This cmdlet was introduced in Lync Server 2010.

Syntax

Default (Default)

Test-CsVoicePolicy
    -TargetNumber <PhoneNumber>
    -VoicePolicy <VoicePolicy>
    [-RouteSettings <PstnRoutingSettings>]
    [-Force]
    [<CommonParameters>]

Description

Voice policies are tied to voice routes through public switched telephone network (PSTN) usages. A call from a user who has been assigned a particular voice policy can only be sent through a route that has a PSTN usage matching a usage on the policy and also a number pattern that matches the number dialed. Call the Test-CsVoicePolicy cmdlet to determine which (if any) route will be used to route a call from a user with a particular voice policy, and also what phone usage ties the policy to the route.

Examples

Example 1

Get-CsVoicePolicy -Identity site:Redmond | Test-CsVoicePolicy -TargetNumber "+14255559999"

This example runs a voice policy test against the voice policy with the Identity site:Redmond. First the Get-CsVoicePolicy cmdlet is run to retrieve the policy with the Identity site:Redmond. That policy object is then piped to the Test-CsVoicePolicy cmdlet, where the policy is tested against the telephone number +14255559999. The output will be the first voice route (based on the Priority property of the route) that has a number pattern matching the TargetNumber value and a phone usage matching a phone usage in the policy. If no matching route is found (for example, if the number pattern matches the pattern for an 11-digit number and you supply a 7-digit number) a null value will be returned.

Example 2

$a = Get-CsVoicePolicy -Identity site:Redmond

Test-CsVoicePolicy -TargetNumber "+14255559999" -VoicePolicy $a

Example 2 is identical to Example 1 except that instead of piping the results of the Get operation directly to the Test-CsVoicePolicy cmdlet, the object is first stored in the variable $a and then is passed as the value to the parameter VoicePolicy to be used as the policy against which the test will run.

Example 3

Get-CsVoicePolicy | Test-CsVoicePolicy -TargetNumber "+12065559999"

This example runs a voice policy test against all voice policies defined within the Skype for Business Server deployment. First the Get-CsVoicePolicy cmdlet is run (with no parameters) to retrieve all the voice policies. The collection of policies that is returned is then piped to the Test-CsVoicePolicy cmdlet, where each policy in the collection is checked for a matching route based on the target phone number provided (+12065559999) and phone usages. The output will be a list of matching routes along with the phone usages that were matched.

Parameters

-Force

Applicable: Lync Server 2010, Lync Server 2013, Skype for Business Server 2015, Skype for Business Server 2019

Suppresses any confirmation prompts or non-fatal error messages that might occur when you run the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RouteSettings

Applicable: Lync Server 2010, Lync Server 2013, Skype for Business Server 2015, Skype for Business Server 2019

Route settings against which to run the test. The route settings can be retrieved with a call to the Get-CsRoutingConfiguration cmdlet.

Parameter properties

Type:PstnRoutingSettings
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-TargetNumber

Applicable: Lync Server 2010, Lync Server 2013, Skype for Business Server 2015, Skype for Business Server 2019

The phone number against which to run the test. This number should be in E.164 format (such as +14255551212).

Parameter properties

Type:PhoneNumber
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-VoicePolicy

Applicable: Lync Server 2010, Lync Server 2013, Skype for Business Server 2015, Skype for Business Server 2019

A reference to the voice policy object against which to run the test. Voice policy objects can be retrieved by calling the Get-CsVoicePolicy cmdlet.

Parameter properties

Type:VoicePolicy
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

Microsoft.Rtc.Management.WritableConfig.Policy.Voice.VoicePolicy

Accepts pipelined input of voice policy objects.

Outputs

Microsoft.Rtc.Management.Voice.VoicePolicyTestResult

Returns an object of type Microsoft.Rtc.Management.Voice.VoicePolicyTestResult.