The scenario is you have created a Response Group (IVR) with an option to call an Out Of Hours engineer. You configure a queue overflow to forward straight to a mobile telephone number outside of your organisation as follows:
The out of hours engineer changes on a rota and you want staff to be able to change the queue overflow number without giving them having to access the Lync Control Panel. I have created a PowerShell script that allows users to accomplish this. They can select from a list of names in the menu or manually type a number. Any changes are logged to a text file.
Here is the script:
# Author: Created by Weakest Lync, www.WeakestLync.com # Purpose: Script to Change Queue Overflow Number # Version: 1.0 # Changes: DATE - Change # 12/07/2013 - Release 1.0 # Script Config Import-Module Lync $team = "ICT Service Desk" #Team script is used for $queue = "ICT Service Desk" #Lync Queue Name $sipdomain = "@Domain.com" #Lync Sip Domain $lyncpool = "Service:ApplicationServer:LyncFE01.domain.local" #Lync front end pool identity $logfile = "\fileservershareLynclog.txt" # Menu cls Write-Host "* Change" $team "On Call Number *" -ForegroundColor Cyan Write-Host " " Write-Host "Change the" $team "On Call number to:" Write-Host " " Write-Host "1. User1" -foregroundcolor Yellow Write-Host "2. User2" -foregroundcolor Yellow Write-Host "3. User3" -foregroundcolor Yellow Write-Host "4. User4" -foregroundcolor Yellow Write-Host "5. User5" -foregroundcolor Yellow Write-Host "6. Other" -foregroundcolor Yellow Write-Host " " $a = Read-Host "Select 1-6: " Write-Host " " # Logic to set sip URI based on menu selection switch ($a) { 1 { $forwardname = "User1" $forwardto = "+447123456781" } 2 { $forwardname = "User2" $forwardto = "+447123456782" } 3 { $forwardname = "User3" $forwardto = "+447123456783" } 4 { $forwardname = "User4" $forwardto = "+447123456784" } 5 { $forwardname = "User5" $forwardto = "+447123456785" } 6 { # Other Write-Host "Enter phone number in E.164 format e.g.: " -NoNewLine Write-Host "+44123456789" -ForegroundColor Magenta $forwardto = Read-Host "Phone Number" } } # Code to put E.164 phone numbers into sip format $forwardto = "sip:" + $forwardto $forwardto = $forwardto + $sipdomain # Code to change on call number in Lync $x = Get-CsRgsQueue -Identity $lyncpool -Name $queue $x.OverflowAction = New-CsRgsCallAction -Action TransferToPstn -Uri $forwardto Set-CsRgsQueue -Instance $x # Write to log file $date = Get-Date Write-output "$date, $team, $forwardname, $forwardto" | Out-File -append $logfile Write-Host "On call number changed to: " -NoNewline Write-Host $forwardname "-" $forwardto -ForegroundColor Green Write-Host " "
Users need to be a member of CSResponseGroupAdministrator and have the Lync Admin Tools installed. However, in my environment I have created a service account and used psexec to publish the script via Citrix (The Citrix server has the Lync Admin Tools installed).
c:\scripts\psexec.exe -e -u domain\RGSSVCAccount -p password C:\Windows\System32\Windows\PowerShellv1.0\powershell.exe -noexit “C:\Scripts\LyncScripts\Lync_QueueOverflow.ps1”
Technical Architect at Symity
Tank you!
Thank you for the script! I changed line 63 as we use a timeout instead of overflows
$x.TimeoutAction = New-CsRgsCallAction -Action TransferToUri -Uri $forwardto
I added the admin user accounts to CSResponseGroupAdministrator but am getting the following error when running remotely (it works fine directly on the pool server):
Get-CsRgsQueue : Cannot open database “rgsconfig” requested by the login. The login failed.
Login failed for user ‘DOMAIN\user.
Do you have any suggestions?
Thanks
Hello Daniel, try adding the user account to RTCUniversalReadOnlyAdmins.