Lync RGS Emergency Failover Script


Todays script was created as a result of unending fire drills 🙂

What happens to my Response Group Calls when we have to suddenly evacuate the building?

Since the environments I come across most refers here to the DDI’s called to reach said Response Groups I have come up with the simplest solution. Basically I have a Emergency Workflow preconfigured complete with announcement and destination.

The Script offers the administrator the option to select Y or N to activate or de-activate Emergency Workflow respectively. If selecting Y, the Script then lifts the DDI from the normal Response Group Workflow and assigns it to the Emergency Workflow. Selecting N reverts the DDI to its original Workflow.

<#    
    .NOTES
    ===========================================================================
     Created on:       04/11/2014 8:13 p.m.
     Created by:       Paul Bloem
     Blog:     UCSorted.com
     Twitter twitter.com/PaulB_NZ
     Filename:         
    ===========================================================================
    .DESCRIPTION
        This script takes a DDI assigned to a RGS Workflow and re-assigns it to a Emergency Workflow - and vice versa depending on the 
        menu selection. You will need a pre-configured 
        Emergency RGS Queue, Group and Workflow. For simplicity you can configure the Emergency Queue to overflow to a destination with
        a Threshold of 0 (meaning that any calls will overflow immediatly.
        You then have the choice on the Emergency Queue to deliver the calls to another SIP address, a PSTN number (such as a cell phone)
        or to a UM enabled mailbox (Voicemail).
#>
# Script Config
Import-Module Lync
#The following Variables need to be manually edited to match your environment
$RGSWorkflow = "Support Workflow"                                    #RGS Workflow you want to failover
$RGSWorkflowDDI = "tel:+123456789"                                    #Line URI of the RGS Workflow
$EmergencyWorkflow = "Emergency - Support Workflow"                    #Name of the Emergency Workflow
$sipdomain = "@ucsorted.com"                                         #Lync Sip Domain
$ServiceID = "service:ApplicationServer:lyncFEPool1.ucsorted.com"     #Lync front end pool identity
$logfile = "c:\RGSEmergency-log.txt"                                #Specify a log file for this script

# Menu
#The Menu items below are displayed as TXT for selection purpose only. Once selected the next section (Selection Logic) is engaged
cls

Write-Host "* Set Emergency state for" $RGSWorkflow "" -ForegroundColor Cyan
Write-Host " "
Write-Host "Select one of the following options (Y\N):"
Write-Host " "
Write-Host "Y - Activate Emergency RGS" -foregroundcolor Yellow
Write-Host "N - De-Activate Emergency RGS" -foregroundcolor Yellow
Write-Host " "
$a = Read-Host "Select Y or N: "
Write-Host " "

# Selection Logic to set DDI for RGS based on Menu Selection

switch ($a)
{
    Y {
        $ActiveWorkflow = $EmergencyWorkflow
        $DeactiveWorkflow = $RGSWorkflow
    }
    N {
        $ActiveWorkflow = $RGSWorkflow
        $DeactiveWorkflow = $EmergencyWorkflow
    }
}

#Removing DDI from Active RGS
$a = Get-CsRgsWorkflow -Identity $ServiceID -name $DeactiveWorkflow
$a.LineUri = ""
set-csrgsworkflow -Instance $a

#Assigning the DDI to new Active RGS
$b = Get-CsRgsWorkflow -Identity $ServiceID -name $Activeworkflow
$b.LineUri = $RGSWorkflowDDI
set-csrgsworkflow -Instance $b

# Write to log file
$date = Get-Date
Write-output "$date, $ActiveWorkFlow, $RGSWorkflow1DDI" | Out-File -append $logfile

Write-Host "Active RGS changed to: " -NoNewline
Write-Host $ActiveWorkFlow -ForegroundColor Green
Write-Host " "

Download script

Advertisements

About Paul B

My name is Paul Bloem and I am employed at Lexel Systems in New Zealand as a Principal Consultant for Unified Communications. I have been working on enterprise voice solutions for over 20 years. My first 10 years were spent working for a Telco in South Africa (Telcom SA). This is where all the groundwork happened as I was exposed to just about every aspect of telecommunication you could imagine. I develop an interest in PBX technologies and eventually became the go-to guy. Next, I had a 10 year run at Siemens South Africa, most of my time there was as a Technical Trainer. During this time VoIP hit the world stage, I had the privilege of introducing VoIP both as H.323 and later SIP across the Siemens HiPath 4000 solution stack. In 2008 I immigrated to New Zealand with my newly attained MCSE, I was ready to go where no PBX Techie had gone before. I was employed to explore OCS 2007 and that was pretty much the beginning of the end for me. I have been working on OCS and Lync ever since. My current role focuses exclusively on Lync and associated technologies.. That includes pre-sales, consulting, architecture and design, training and support. I even get to play in the development space from time to time - focus on play ;-) I was nominated as a Microsoft VTSP for Lync early in 2013 and also awarded Microsoft's MVP award for Lync in 2014.
This entry was posted in Powershell Scripts, RGS and tagged , , , . Bookmark the permalink.

2 Responses to Lync RGS Emergency Failover Script

  1. Pingback: Lync RGS Emergency Failover Script | UC Sorted | JC's Blog-O-Gibberish

  2. Pingback: Weekly IT Newsletter – November 10-14, 2014 | Just a Lync Guy

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s