Skip to content

Commit fc8682e

Browse files
committed
Update Blog “2022-01-31-manage-call-queue-and-auto-attendant”
1 parent 95e89b0 commit fc8682e

2 files changed

Lines changed: 58 additions & 7 deletions

File tree

14.3 KB
Loading

src/pages/blog/2022-01-31-manage-call-queue-and-auto-attendant.mdx

Lines changed: 58 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,34 @@ $aa.DefaultCallFlow.Greetings = @($audioFilePrompt)
106106
Set-CsAutoAttendant -Instance $aa
107107
```
108108

109-
## Adding out-of-hours workflow
109+
## Managing out-of-hours workflow
110+
111+
Let's now do the changes to out-of-hours workflow.
112+
113+
### Checking if out-of-hours workflow exists
114+
115+
First things first - the out-of-hours workflow must be defined. Let's check if we have it.
116+
117+
We'll check if there's an existing call handling association with the type *AfterHours*:
118+
119+
```powershell
120+
$aa.CallHandlingAssociations | Where-Object {$_.Type.Value -eq 'AfterHours'}
121+
```
122+
123+
We should see the object returned:
124+
125+
![](../../img/20220206-124420-zdhir7q27u.png "Checking if out-of-hours association exists")
126+
127+
If we don't see anything, we need to add the workflow first.
128+
129+
### Adding out-of-hours workflow
110130

111131
When we create an auto attendant we don't need to specify an out-of-hours workflow. If we hit **Submit** in the **Call flow** window (as in the image below), it won't be created:
112132

113133
![](../../img/20220204-134305-axntyw9ix9.png "Call flow window in auto attendant creator")
114134

115135
We can check if that's the case by inspecting the value of the *Call flows* property in the `$aa` variable. If it's empty, as in the image below, the out-of-hours workflow is not defined:
116136

117-
118-
119137
![](../../img/20220204-134647-r5p68s9p2h.png "Inspecting Call Flows value via PowerShell")
120138

121139
If there's no out-of-hours workflow, we won't be able to modify it. Modifying is described in the later stages. Let's now take care of the workflow.
@@ -130,11 +148,11 @@ The script below assumes there's no holiday workflow. If there's one defined, it
130148

131149
```powershell
132150
# First, menu option
133-
$newAAMenuOptionParams = @{
151+
$newAAOOHMenuOptionParams = @{
134152
Action = "DisconnectCall"
135153
DtmfResponse = "Automatic"
136154
}
137-
$AAOOHMenuOption = New-CsAutoAttendantMenuOption @newAAMenuOptionParams
155+
$AAOOHMenuOption = New-CsAutoAttendantMenuOption @newAAOOHMenuOptionParams
138156
139157
# Then, menu
140158
$newAAMenuParams = @{
@@ -160,13 +178,46 @@ $AAOOHFlow = New-CsAutoAttendantCallFlow @newAAOOHFlowParams
160178
# Now, assigning the workflow
161179
$aa.CallFlows = @($AAOOHFlow)
162180
163-
### TODO: Assign schedules and call handling association
181+
# We also need to assign the schedule
182+
# Let's create it first
183+
$tr = New-CsOnlineTimeRange -Start 00:00 -End 1.00:00
184+
$scheduleOOHParams = @{
185+
Name = "$attendantName OOH Schedule"
186+
WeeklyRecurrentSchedule = $true
187+
MondayHours = @($tr)
188+
TuesdayHours = @($tr)
189+
WednesdayHours = @($tr)
190+
ThursdayHours = @($tr)
191+
FridayHours = @($tr)
192+
Complement = $true
193+
}
194+
$OOHSchedule = New-CsOnlineSchedule @scheduleOOHParams
195+
196+
# And now, assign
197+
$aa.Schedules = @($OOHSchedule)
198+
199+
# And the same with call handling association
200+
# Creating
201+
$OOHCallHandlingAssociationParams = @{
202+
CallFlowId = $OOHSchedule.Id
203+
ScheduleId = $AAOOHFlow.Id
204+
Type = 'AfterHours'
205+
}
206+
$OOHAssociation = New-CsAutoAttendantCallHandlingAssociation @OOHCallHandlingAssociationParams
207+
208+
# And saving
209+
$aa.CallHandlingAssociations = @($OOHAssociation)
164210
211+
## TODO Fix Set-CsAutoAttendant: Schedule not found. Probably requires specifying configuration id for a schedule
165212
# And saving
166213
Set-CsAutoAttendant -Instance $aa
167214
```
168215

169-
## Changing out of hours greeting
216+
### Changing out-of-hours greeting
217+
218+
## Adding holiday workflow
219+
220+
170221

171222
## Changing holidays greeting
172223

0 commit comments

Comments
 (0)