Create a Response Group with an IVR

This script shows how to build a simple helpdesk interactive voice response (IVR), leading to two queues, each covered by two agents.

For a detailed explanation of how this script works, see the article Creating Your First Response Group Using Lync Server Management Shell .

$ServiceId = "service:ApplicationServer:rtc.contoso.com"

$Group_Sales = New-CsRgsAgentGroup `

                   -Parent $ServiceId `

                   -Name "Contoso Sales" `

              -AgentAlertTime 20 `

                   -ParticipationPolicy Informal `

                   -RoutingMethod LongestIdle `

                   -AgentsByUri("sip:franz@contoso.com", `

                                "sip:marco@contoso.com")

$Group_Support = New-CsRgsAgentGroup `

                   -Parent $ServiceId `

                   -Name "Contoso Support" `

                   -AgentAlertTime 20 `

                   -ParticipationPolicy Informal `

                   -RoutingMethod LongestIdle `

       -AgentsByUri("sip:david@contoso.com", `

                                "sip:john@contoso.com")

$Queue_Sales = New-CsRgsQueue `

                   -Parent $ServiceId `

                   -Name "Contoso Sales" `

                   -AgentGroupIDList($Group_Sales.Identity)

$Queue_Support = New-CsRgsQueue `

                      -Parent $ServiceId `

                      -Name "Contoso Support" `

                      -AgentGroupIDList($Group_Support.Identity)

$PromptA1 = New-CsRgsPrompt `

                 -TextToSpeechPrompt "Please wait while we're connecting `

                     you with the Contoso Sales department."

$ActionA1 = New-CsRgsCallAction `

                 -Prompt $PromptA1 `

                 -Action TransferToQueue `

      -QueueID $Queue_Sales.Identity

$Answer1 = New-CsRgsAnswer `

               -Action $ActionA1 `

               -DtmfResponse 1

$PromptA2 = New-CsRgsPrompt `

                 -TextToSpeechPrompt "Please wait while we're connecting `

             you with the Contoso Support department."

$ActionA2 = New-CsRgsCallAction `

                 -Prompt $PromptA2 `

                 -Action TransferToQueue `

                 -QueueID $Queue_Support.Identity

$Answer2 = New-CsRgsAnswer `

             -Action $ActionA2 `

               -DtmfResponse 2

$PromptQ = New-CsRgsPrompt `

               -TextToSpeechPrompt "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 $PromptQ `

                -AnswerList ($Answer1, $Answer2)

$ActionWM = New-CsRgsCallAction `

                -Action TransferToQuestion `

                -Question $Question

$Workflow = New-CsRgsWorkflow `

               -Parent $ServiceId `

               -Name "Contoso Helpdesk" `

               -Description "The Contoso Helpdesk line." `

               -PrimaryUri "sip:helpdesk@contoso.com" `

               -LineUri "tel:+14255554321" `

               -DisplayNumber "+1 (425) 555-4321" `

               -Active $true `

               -Anonymous $true `

               -DefaultAction $ActionWM