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>] |
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 |
The voice policy against which to run the test. 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 |
Detailed Description
Voice policies are tied to voice routes through 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 as well as 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, as well as what phone usage ties the policy to the route.
Return Types
Returns an object of type Microsoft.Rtc.Management.Voice.VoicePolicyTestResult.
Examples
-------------------------- Example 1 --------------------------
Copy Code | |
---|---|
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 --------------------------
Copy Code | |
---|---|
$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 --------------------------
Copy Code | |
---|---|
Get-CsVoicePolicy | Test-CsVoicePolicy -TargetNumber "+12065559999" |
This example runs a voice policy test against all voice policies defined within the Communications 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.