Dela via


Test-CsVoicePolicy

 

Topic Last Modified: 2012-03-26

Tests a telephone number against a voice policy and determines which voice route would be used against that policy for that number.

Syntax

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

Detailed 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.

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

Parameters

Parameter Required Type Description

TargetNumber

Required

PhoneNumber

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

Full data type: Microsoft.Rtc.Management.Voice.PhoneNumber

VoicePolicy

Required

VoicePolicy

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.

Full data type: Microsoft.Rtc.Management.WritableConfig.Policy.Voice.VoicePolicy

RouteSettings

Optional

PstnRoutingSettings

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

Full data type: Microsoft.Rtc.Management.WritableConfig.Policy.Voice.PstnRoutingSettings

Force

Optional

Switch Parameter

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

Input Types

Microsoft.Rtc.Management.WritableConfig.Policy.Voice.VoicePolicy object. Accepts pipelined input of voice policy objects.

Return Types

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

Example

-------------------------- 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 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 Lync Server 2010 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.