[This is pre-release documentation and subject to change in future releases. This topic's current status is: Milestone-Ready]

Topic Last Modified: 2010-07-18

The following script creates a new interactive response group for use with the Response Group Service in Microsoft Communications Server 2010. To use the script, copy the code, paste it into a text editor such as Windows Notepad, and then save the file using a .ps1 file extension (for example, C:\Scripts\NewInteractiveGroup.Ps1). From within the Communications Server Management Shell you can then run the script by typing in the full path to the script file:

Copy Code
C:\Scripts\NewInteractiveGroup.ps1

The script itself is as follows:

Copy Code
<#
	Description  : Create an interactive response group.
	Author	 : Frédéric Dubut (Microsoft)
#>

$serviceid = "service:Contoso-ApplicationServer-1"

#
# Create groups
#
$group_sales = New-CSRgsAgentGroup `
	-Parent $serviceId `
	-Name "Contoso Sales" `
	-AgentAlertTime 20 `
	-ParticipationPolicy Informal `
	-RoutingMethod LongestIdle `
	-AgentsByUri("sip:franz@contoso.com", `
								"sip:marco@contoso.com")
Set-CSRgsAgentGroup $group_sales

$group_support = New-CSRgsAgentGroup `
	-Parent $serviceId `
	-Name "Contoso Support" `
	-AgentAlertTime 20 `
	-ParticipationPolicy Informal `
	-RoutingMethod LongestIdle `
	-AgentsByUri("sip:david@contoso.com", `
		"sip:john@contoso.com")
Set-CSRgsAgentGroup $group_support

#
# Create queues
#
$queue_sales = New-CSRgsQueue `
	-Parent $serviceId `
	-Name "Contoso Sales" `
	-AgentGroupsId($group_sales.Identity)
Set-CSRgsQueue $queue_sales

$queue_support = New-CSRgsQueue `
	-Parent $serviceId `
	-Name "Contoso Support" `
	-AgentGroupsId($group_support.Identity)
Set-CSRgsQueue $queue_support

#
# Create IVR
#
$prompt_a1 = New-CSRgsWorkflowPrompt `
	-PromptTTS "Please wait while we're connecting you with the Contoso Sales" + `
		" department."
$action_a1 = New-CSRgsCallAction `
	-Prompt $prompt_a1 `
	-Target TransferToQueue `				 -TargetQueueId $queue_sales.Identity
$answer1 = New-CSRgsAnswer `
	-Action $action_a1
$answer1.DtmfResponse = 1

$prompt_a2 = New-CSRgsWorkflowPrompt `
	-PromptTTS "Please wait while we're connecting you with the Contoso " + `
		"Support department."
$action_a2 = New-CSRgsCallAction `
	-Prompt $prompt_a2 `
	-Target TransferToQueue `
	-TargetQueueId $queue_support.Identity
$answer2 = New-CSRgsAnswer `
			 -Action $action_a2
$answer2.DtmfResponse = 2

$prompt_q = New-CSRgsWorkflowPrompt `
	-PromptTTS "Thank you for calling Contoso. To speak with a Sales representative," + `
		" press 1. To be connected with our Support line, press 2."
$question = New-CSRgsQuestion `
	-Prompt $prompt_q
$question.Answers.Add($answer1)
$question.Answers.Add($answer2)

#
# Create workflow
#
$sipuri = "sip:helpdesk@contoso.com"
$action_wm = New-CSRgsCallAction `
	-Target TransferToQuestion `
	-TargetQuestion $question

$rg = New-CSRgsWorkflow `
	-Parent $serviceId `
	-Name "Contoso Helpdesk" `
	-Description "The Contoso Helpdesk line." `
	-PrimaryUri $sipuri `
	-Active $true `
	-Anonymized $true `
	-NextTarget $action_wm
Set-CSRgsWorkflow $rg