Forum Discussion
Automate Auto Attendant Holiday Setup
- May 30, 2022Thanks,
Yes, having not found any better way to do it I now set the Holidays in advance for the year, unfortunately I can't use a generic message, I have to include the date we will be open again, so I have to go through every Auto-attendant and amend the message on every holiday. Plus we have leisure facilities who work different hours to the rest of the university who like the message read out what hours they're open over the holidays - It would be nice to have some way of setting that message in one go all Auto Attendants that need it, but it's not too bad going through and changing them all individually.
Thanks for the responses.
I have seen many people looking for help with this issue (including myself) and finally being frustrated enough I have built a PowerShell script that will allow the management of a large number of Auto Attendants Holiday settings. At first, I tried using the export/import-CSAutoAttendentHolidays commands but that action creates a new holiday instance for each AA and does not set the call flow, which means all calls just get disconnected with no message being read. Instead, I had to create a whole call flow based off the documentation on https://learn.microsoft.com/en-us/powershell/module/skype/new-csautoattendantcallhandlingassociation?view=skype-ps
While I am not an expert in powershell, and am sure there are others who could improve this but as I have yet to see this information online I thought I would share what I have.
Prep
First: You will need to setup your list of Holidays in Teams Admin Center to reference. These can be updated each year to have the dates set for the upcoming year.
Second: You will need 2 CSV files. The first contains the list of Auto Attendants that you want to set the holidays for. This CSV will need a column labeled "AutoAttendantIdentity" which contains all the object ID's for the auto attendants. To find the object ID's you can use the Get-CsAutoAttendant commandlet. The second CSV will contain your list of holidays to be added. Must include columns: "MenuName" (Holiday Name) " CallFlowName" (Holiday Name) and "ScheduleID" (Object ID of Holidays.) To get the Object ID's of the Holidays you have created use the Get-CsOnlineScheudule to see a list of all operation hours in your environment, holidays will all be "FixedSchedules" and you can ignore the many "WeeklyRecurrentSchdules" in your tenant.
Third: In our organization I created an Auto Attendant named "Holiday Message" which is where all calls will be sent to during holiday hours. This allows for easy message management and will be referenced by all Holiday call flows the script will build.
Script
#Paths to CSV File
$csvFile1 = "C:\temp\AutoAttendants.csv" # List of auto attendants to change. Must include column called "AutoAttendantIdentity" containing Object ID's for the Auto Attendants
$csvFile2 = "C:\temp\ScheduleIDs.csv" # List of Holidays to be added. Must include columns: "MenuName" (Holiday Name) " CallFlowName" (Holiday Name) "ScheduleID" (Object ID of Holidays)
#Import list of Auto Attendants
$autoAttendantIdentities = Import-Csv $csvFile1 | Select-Object -ExpandProperty AutoAttendantIdentity
#Loop through each Auto Attendant
foreach ($autoAttendantId in $autoAttendantIdentities) {
$autoAttendant = Get-CsAutoAttendant -Identity $autoAttendantId
#Send calls to "holiday Message" Auto Attendant
$callableEntityId = Find-CsOnlineApplicationInstance -SearchQuery "Holiday Message" -MaxResults 1 | Select-Object -Property Id
$callableEntity = New-CsAutoAttendantCallableEntity -Identity $callableEntityId.Id -Type ApplicationEndpoint
#Load List of Holidays and create call flow with unique naming for each holiday
Import-Csv $csvFile2 | ForEach-Object {
# Generate a unique name for each call flow
$uniqueId = get-random -Minimum 100 -Maximum 999
$uniqueName = $_.CallFlowName + - + $uniqueId
#Create call flow
$menuOption = New-CsAutoAttendantMenuOption -Action TransferCallToTarget -CallTarget $callableEntity -DtmfResponse Automatic
$menu = New-CsAutoAttendantMenu -Name $_.MenuName -MenuOptions $menuOption
$callFlow = New-CsAutoAttendantCallFlow -Name $uniqueName -Menu $menu
$callHandlingAssociation = New-CsAutoAttendantCallHandlingAssociation -Type Holiday -ScheduleId $_.ScheduleId -CallFlowId $callFlow.Id
$autoAttendant.CallFlows += $callFlow
$autoAttendant.CallHandlingAssociations += $callHandlingAssociation
}
#Apply Changes to Auto Attendant
Set-CsAutoAttendant -Instance $autoAttendant
}
Notes:
- If the auto attendant is set to force listeners to hear all of the greeting before picking an option it will cause the script to fail at that point.
- If you do not have an auto attendant called "Holiday Message" the script will fail.
- It will update you at each successful Auto Attendant completed.
- Each call flow had to have a unique name which is why the random number generator is used
- Dale_LTUJul 05, 2023Brass Contributor
TYoung-OC Thanks for this, that is really useful.
The way I do it now I just amend the dates in a single Holiday which is applied to all of our Attendants so it's not too laborious.
The only laborious part of it now is I'm still manually going through and editing the Holiday Greeting message on every AA manually - I had never considered just redirecting to a Holiday AA with a greeting message, to provide a single place to amend the message. I'm definitely going to do that in future that's going to make setting up holidays much easier.
Thanks
Dale