Automatically Enable Overflow Action on Call Queues if No Agents are Opted In

One of the biggest pain points of Microsoft Teams Call Queues is that a configured time out is always honored, even if no agents are…

One of the biggest pain points of Microsoft Teams Call Queues is that a configured time out is always honored, even if no agents are available to answer the calls. It doesn’t matter if they have opted out, are offline or even if the queue has no agents configured at all. The call will only be forwarded after the timeout has been reached.

To conquer this issue, I’ve created a small PowerShell script which can be implemented and executed on a schedule as an Azure Runbook.

The idea is quite simple. The script loops through all Call Queues and checks if there’s at least one agent opted in. If all agents are opted out, the script will set the Queue’s overflow threshold to zero.

If there’s at least one agent who’s opted in, it will check if the overflow threshold is still zero. If that’s the case, the script will update the overflow threshold to any value you set in the script.

This means that every time the script detects a Queue where no agents are opted in, the configured overflow action will be active immediately. As soon as the script sees that agents are available again, the immediate overflow action is disabled again.

I’ve also added a simple alerting mechanism using Teams incoming webhooks. Messages will only be sent when something was changed.

Azure Runbook Code Example

Here’s the example code. Please keep in mind that this is in fact only an example. All the Message Cards go into the same Teams Channel because there’s no link between a Queue and a Channel which it might be associated with (e.g., a Voice Enabled Channel). I’m also using the same $defaultOverFlowThreshold for all Call Queues.

If you’re not familiar with Azure Runbooks, Automation Credentials and Teams Webhooks, please refer to this article. The steps to create these things are the same.

Insert your webhook URL on line 3 and make sure that the name of the Automation Credentials matches yours on line 5.

Unless the examples of my previous articles, were the Runbooks were triggered by a webhook, we’ll need to create a schedule for this one. I recommend a schedule which runs every 15 minutes. This should be good enough to cover most scenarios.

In the Azure Portal, switch to Schedules and click + Add a schedule.

Next, click Link a schedule to your runbook.

Click on + Add a schedule.

Give it a name and use the settings below. The smallest increment Azure Runbooks support is hourly. If we want to run it every 15 minutes, we’ll need to create four schedules where each schedule starts at a different time. Let’s start with the one which will run at every full hour.

Repeat the same step three more times using the following start times (based on this example): 15:15, 15:30, 15:45.

Once you’re done, it should look like this.

The Runbook will now run every 15 minutes and automatically enable or disable the immediate overflow action based on agent availability (opt in status).

Let me know if you would be interested in a more sophisticated solution of this Runbook. I’m thinking of a way where we can store and link information about individual Call Queues such as different webhook URLs, different overflow thresholds etc. or even the minimum number of agents which should be available before a Queue is being enabled again. I already have an idea in store how this could be achieved…

Licensed under CC BY-NC-SA 4.0
comments powered by Disqus
Hosted on GitHub Pages
Built with Hugo
Theme Stack designed by Jimmy