Voice Power Shell commands
Dial Plan
To create a new dial plan, we use the new-csdialplan command:
New-CsDialPlan -Identity site:Dubai -SimpleName DubaiSiteDialPlan
To add a new normalization rule to that dial plan we use the new-csvoicenormalizationrule command
New-CsVoiceNormalizationRule -Identity "site:DubaiPrefix" -Pattern "^9(\d*){1,5}$" -Translation "+9714$1"
To modify a dial plan with a new external access prefix
Set-CsDialPlan -Identity DubaisiteDialPlan –ExternalAccessPrefix 8
To create a new voice normalization rule, use the New-CsVoiceNormalizationRule cmdlet. The following rule has the name DubaiFourDigit and will be assigned to the dial plan DubaiUser
New-CsVoiceNormalizationRule -Parent SeattleUser -Name DubaiFourDigit -Description "Dialing with internal four-digitextension" -Pattern '^(\d{4})$' -Translation '+9714555$1'
More information
http://go.microsoft.com/fwlink/?LinkId=230986
Configuring Voice Policies, PSTN Usage Records, and Voice Routes
To create a new voice policy
New-CsVoicePolicy –Identity UserVoicePolicy2 -AllowSimulRing $False -PstnUsages @{Add = "Local"}
To modify a voice policy
Set-CsVoicePolicy UserVoicePolicy2 -AllowSimulRing $False -PstnUsages @{add = "Long Distance"}
To view a pstn usage
Get-CsPstnUsage | Select-Object –ExpandProperty Usage
To create a voice route
New-CsVoiceRoute -Identity Route1 -PstnUsages @{add="Long Distance"} -PstnGatewayList @{add="PstnGateway:10.0.0.15"}
To modify a voice route
Set-CsVoiceRoute -Identity Route1 -Description "Test Route"
to use both the Get-CsVoiceRoute and Set-CsVoiceRoute cmdlets to add a new PSTN gateway to a voice route
$x = Get-CsVoiceRoute -Identity Route1
$x.PstnGatewayList.Add("PstnGateway:10.0.0.15")
Set-CsVoiceRoute -Instance $x
To configure route with multiple gateways
Set-CsVoiceRoute -Identity “LocalRoute” -Description “local number routes” -NumberPattern “^(\+9714{7})$” -PstnUsages @{add=”Local”} -PstnGatewayList @{add=”pstngateway:10.0.0.15”, ”pstngateway:10.0.0.16”}
Configuring Trunks and Translation Rules
To configure media bypass on a trunk
New-CsTrunkConfiguration -Identity site:Dubai -EnableBypass $True –MaxEarlyDialogs 40 –SRTPMode Required
To configure trunk without media bypass
New-CsTrunkConfiguration -Identity site:Dubai -EnableBypass $False –MaxEarlyDialogs 40 –SRTPMode Required
To export a voice routing configuration:
Get-CsVoiceRoute –Identity "DubaiRoute" | Export-Clixml –Path "C:\Routes\DubaiRoute.xml"
To import a voice routing configuration:
Import-Clixml –Path "C:\Routes\DubaiRoute.xml" | Set-CsVoiceRoute