Time condition with holidays and working hours

Hello,
I need help refining my logic setup.

What I’m trying to achieve:
Create time conditions for working hours. If it’s within working hours, calls should be directed to a specific department. However, if it’s outside of working hours, during weekends, or on holidays, an announcement should play instead.

To accomplish this, I’m using a calendar where all holidays are defined, as well as another calendar for non-working hours and weekends. However, there’s an issue: every day, there’s a one-minute window between 23:59 and 00:00 (due to how calendar events are set up – you can’t create an event that spans from a higher hour to a lower hour, so I have to split non-working times into two events: one for the evening and one for the morning). As a result, FreePBX considers that one minute as working time, which is driving me crazy.

Next, I’ve created a calendar group that combines these two calendars. I then use this calendar group in my time condition for NON-WORKING HOURS.

While this setup technically works, it feels illogical. If someone else were to look at it, I doubt they would understand it easily.

On top of that, I’d like to implement this solution for multiple departments, each with different opening hours.

Does anyone have a simpler or better approach for this?

I would create a call-flow-toggle control (just to be able to override your settings)
normal (green) > time conditions holidays
override (red) > ringgroup office

… a time condition holidays (with a holiday calendar)
match > Announcement out-of-office
non-match > time condition office-hours

…a time condition office-hours (based on time group office-hours)
match > IVR > ringgroup
non-match > announcement out-of-office

…a time group office-hours
Mo-Fr 8:00-18:00h

You might have to create the time groups and announcements first :wink:
In this scenario you don’t need any 23:59 - 0:00h workarounds…except if you have unusual working hours.

1 Like

Hah, sounds it might work… Many thanks!