Enterprise Voice Setup Script for Lync 2013
I created this script as the need to set up the same rules (as a whole) exist in many of the projects I work on.
These rules can obviously be changed but should form the basis for your own personalised script. I have put in as many comments as I think are needed so it should guide you well.
These are specifically for Ireland as we use a different format for some numbers. For example freephone numbers in most countries are 0800 but in Ireland it is 1800 which means normalising this is not an easy task!
The script below assumes calls are being sent to a PSTN Gateway via a SIP trunk.
These are specifically for Ireland as we use a different format for some numbers. For example freephone numbers in most countries are 0800 but in Ireland it is 1800 which means normalising this is not an easy task!
The script below assumes calls are being sent to a PSTN Gateway via a SIP trunk.
Martin
#################
# #
# BEFORE #
# YOU BEGIN #
# #
#################
# Get the PSTN Gateway ID as you will need this later
# Get-CsService -PSTNGateway -- Change this on "VOICE ROUTES" section
# Assumes Gateway is already set up.
#
#################
# #
# DIAL #
# PLAN #
# #
#################
# First create a Dial Plan
# Change "SiteADialPlan" name to whatever suits your organisation
New-CsDialPlan -Identity "SiteADialPlan-National"
#################
# #
# NUMBER #
# NORMALIZATION #
# #
#################
# Next Create Number Normalisation Rules for this plan.
# Only include the numbers you wish for these users to be able to access
# E.G. Dont put in premium etc...
# EXAMPLE BELOW
# New-CsVoiceNormalizationRule -Parent "SiteADialPlan" -Name "RULE NAME" -Description "Rule Description" -Pattern '^(\d{4})$' -Translation '+3531999$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-National" -Name "Emergency Services 999" -Description "Emergency Services 999" -Pattern '^(999)$' -Translation '$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-National" -Name "Emergency Services 112" -Description "Emergency Services 112" -Pattern '^(112)$' -Translation '$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-National" -Name "Speaking Clock 1191" -Description "Speaking Clock 1191" -Pattern '^(1191)$' -Translation '$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-National" -Name "Telephone Cust services 19xx" -Description "Telephone Cust services 19xx" -Pattern '^(19\d{2})$' -Translation '$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-National" -Name "116 Social Values" -Description "116 Social Values (Samaritans etc...)" -Pattern '^(116\d{3})$' -Translation '$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-National" -Name "Directory Enquiries" -Description "Directory Enquiries" -Pattern '^(118\d{2})$' -Translation '$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-National" -Name "08x IRL Mobiles" -Description "08x IRL Mobiles" -Pattern '^0(8\d{7}\d+)$' -Translation '+353$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-National" -Name "National Calls" -Description "National Calls" -Pattern '^0([1-9]\d{3}\d+)$' -Translation '+353$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-National" -Name "1800 FreePhone" -Description "1800 FreePhone" -Pattern '^(1800\d{6})$' -Translation '$1'
# Change below line depending on where the users are located - this rule is for Dublin users - 7 digits add 01
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-National" -Name "Local Calls within 01" -Description "Local Calls within 01 / 7 Digits" -Pattern '^(\d{7}t?)$' -Translation '+3531$1'
# Change below line depending on what the internal dialling extensions are
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-National" -Name "Int 4 digit Ext starting 1-8" -Description "Int 4 digit Ext starting 1-8" -Pattern '^([1-8]\d{3})$' -Translation '$1'
# These two rules may need to be applied to a separate Dial Plan if users are limited in calling per minute/per call numbers
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-National" -Name "1850 Fixed Cost" -Description "1850 Fixed Cost" -Pattern '^(1850\d{6})$' -Translation '$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-National" -Name "1890 Per Minute" -Description "1890 Per Minute" -Pattern '^(1890\d{6})$' -Translation '$1'
#################
# #
# DIAL #
# PLAN #
# #
#################
#
# Create a new dialplan for International Calling allowed - this includes all the above plus extra
#
New-CsDialPlan -Identity "SiteADialPlan-International"
#################
# #
# NUMBER #
# NORMALIZATION #
# #
#################
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-International" -Name "Emergency Services 999" -Description "Emergency Services 999" -Pattern '^(999)$' -Translation '$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-International" -Name "Emergency Services 112" -Description "Emergency Services 112" -Pattern '^(112)$' -Translation '$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-International" -Name "Speaking Clock 1191" -Description "Speaking Clock 1191" -Pattern '^(1191)$' -Translation '$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-International" -Name "Telephone Cust services 19xx" -Description "Telephone Cust services 19xx" -Pattern '^(19\d{2})$' -Translation '$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-International" -Name "116 Social Values" -Description "116 Social Values (Samaritans etc...)" -Pattern '^(116\d{3})$' -Translation '$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-International" -Name "Directory Enquiries" -Description "Directory Enquiries" -Pattern '^(118\d{2})$' -Translation '$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-International" -Name "08x IRL Mobiles" -Description "08x IRL Mobiles" -Pattern '^0(8\d{7}\d+)$' -Translation '+353$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-International" -Name "National Calls" -Description "National Calls" -Pattern '^0([1-9]\d{3}\d+)$' -Translation '+353$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-International" -Name "1800 FreePhone" -Description "1800 FreePhone" -Pattern '^(1800\d{6})$' -Translation '$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-International" -Name "International Calls" -Description "International Calls" -Pattern '^00(\d*)$' -Translation '+$1'
# Change below line depending on where the users are located - this rule is for Dublin users - 7 digits add 01
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-International" -Name "Local Calls within 01" -Description "Local Calls within 01 / 7 Digits" -Pattern '^(\d{7}t?)$' -Translation '+3531$1'
# Change below line depending on what the internal dialling extensions are
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-International" -Name "Int 4 digit Ext starting 1-8" -Description "Int 4 digit Ext starting 1-8" -Pattern '^([1-8]\d{3})$' -Translation '$1'
# These two rules may need to be applied to a separate Dial Plan if users are limited in calling per minute/per call numbers
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-International" -Name "1850 Fixed Cost" -Description "1850 Fixed Cost" -Pattern '^(1850\d{6})$' -Translation '$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-International" -Name "1890 Per Minute" -Description "1890 Per Minute" -Pattern '^(1890\d{6})$' -Translation '$1'
#################
# #
# DIAL #
# PLAN #
# #
#################
#
# Create a new dialplan for International Calling allowed - this includes all the above plus extra
#
New-CsDialPlan -Identity "SiteADialPlan-Premium"
#################
# #
# NUMBER #
# NORMALIZATION #
# #
#################
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-Premium" -Name "Emergency Services 999" -Description "Emergency Services 999" -Pattern '^(999)$' -Translation '$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-Premium" -Name "Emergency Services 112" -Description "Emergency Services 112" -Pattern '^(112)$' -Translation '$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-Premium" -Name "Speaking Clock 1191" -Description "Speaking Clock 1191" -Pattern '^(1191)$' -Translation '$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-Premium" -Name "Telephone Cust services 19xx" -Description "Telephone Cust services 19xx" -Pattern '^(19\d{2})$' -Translation '$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-Premium" -Name "116 Social Values" -Description "116 Social Values (Samaritans etc...)" -Pattern '^(116\d{3})$' -Translation '$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-Premium" -Name "Directory Enquiries" -Description "Directory Enquiries" -Pattern '^(118\d{2})$' -Translation '$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-Premium" -Name "08x IRL Mobiles" -Description "08x IRL Mobiles" -Pattern '^0(8\d{7}\d+)$' -Translation '+353$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-Premium" -Name "National Calls" -Description "National Calls" -Pattern '^0([1-9]\d{3}\d+)$' -Translation '+353$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-Premium" -Name "1800 FreePhone" -Description "1800 FreePhone" -Pattern '^(1800\d{6})$' -Translation '$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-Premium" -Name "International Calls" -Description "International Calls" -Pattern '^00(\d*)$' -Translation '+$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-Premium" -Name "15xx Premium Rate Numbers" -Description "15xx Premium Rate Numbers" -Pattern '^(15\d{8})$' -Translation '$1'
# Change below line depending on where the users are located - this rule is for Dublin users - 7 digits add 01
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-Premium" -Name "Local Calls within 01" -Description "Local Calls within 01 / 7 Digits" -Pattern '^(\d{7}t?)$' -Translation '+3531$1'
# Change below line depending on what the internal dialling extensions are
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-Premium" -Name "Int 4 digit Ext starting 1-8" -Description "Int 4 digit Ext starting 1-8" -Pattern '^([1-8]\d{3})$' -Translation '$1'
# These two rules may need to be applied to a separate Dial Plan if users are limited in calling per minute/per call numbers
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-Premium" -Name "1850 Fixed Cost" -Description "1850 Fixed Cost" -Pattern '^(1850\d{6})$' -Translation '$1'
New-CsVoiceNormalizationRule -Parent "SiteADialPlan-Premium" -Name "1890 Per Minute" -Description "1890 Per Minute" -Pattern '^(1890\d{6})$' -Translation '$1'
#################
# #
# VOICE #
# POLICIES #
# & #
# PSTN #
# USAGES #
#################
# Voice Policies are used to restrict calling number types to specific users
# PSTN Usage restricts calling certian numbers to specific PSTN Gateways (Used to restrict numbers overall also)
# SAMPLE VIOCE POLICY
#New-CSVoicePolicy "VOICE POLICY NAME" -Description "Allows calls to National Numbers Only" -WarningAction:SilentlyContinue
# National Policy
Set-CsPstnUsage -Usage @{Add="SiteA-National"}
New-CSVoicePolicy –Identity "SiteA - National Voice Policy" -Description "Allows calls to National Numbers Only" -PstnUsages @{Add = "SiteA-National"} -WarningAction:SilentlyContinue
# International Policy
Set-CsPstnUsage -Usage @{Add="SiteA-International"}
New-CSVoicePolicy –Identity "SiteA - International Voice Policy" -Description "Allows calls to International Numbers" -PstnUsages @{Add = "SiteA-International"} -WarningAction:SilentlyContinue
# Premium Policy
Set-CsPstnUsage -Usage @{Add="SiteA-Premium"}
New-CSVoicePolicy –Identity "SiteA - Premium Voice Policy" -Description "Unrestricted Policy" -PstnUsages @{Add = "SiteA-Premium"} -WarningAction:SilentlyContinue
#################
# #
# VOICE #
# ROUTES #
# #
#################
# Voice Routes send calls to different gateways or endpoints
# PSTNUsage and Gateway must exist in advance for this command to work
# SAMPLE ADD PSTN USAGE
#
# Set-CsPstnUsage -Usage @{Add="MGTESTUSAGE"}
#
# Get the PSTN Gateway ID as you will need this later
# Get-CsService -PSTNGateway
# SAMPLE VOICE ROUTE
# New-CsVoiceRoute -Identity Route1 -PstnUsages @{add="Long Distance"} -PstnGatewayList @{add="PstnGateway:redmondpool.litwareinc"}
New-CsVoiceRoute -Identity "SiteA-National-Route" -Description "Route for all Irish National Group Calls" -PstnUsages @{add="SiteA-National"} -PstnGatewayList @{add="PstnGateway:10.245.1.27"} -NumberPattern '^((\+353)|([1-9]))'
New-CsVoiceRoute -Identity "SiteA-International-Route" -Description "Route for all International Group Calls" -PstnUsages @{add="SiteA-International"} -PstnGatewayList @{add="PstnGateway:10.245.1.27"} -NumberPattern '.*'
New-CsVoiceRoute -Identity "SiteA-Premium-Route" -Description "Route for all Premium Group Calls" -PstnUsages @{add="SiteA-Premium"} -PstnGatewayList @{add="PstnGateway:10.245.1.27"} -NumberPattern '.*'
#
# Suppress Caller ID on a Route Level
# Example to supress ID, need both SuppressID and Alternate Number
# New-CsVoiceRoute -Identity International-Route -PstnUsages @{add="National"} -PstnGatewayList @{add="PstnGateway:GATEWAYFQDN"} -SuppressCallerId $true -AlternateCallerId "+35311234567"
Comments
Post a Comment