Misunderstanding "Exclusion" in the Time Groups User Guide

In a September 2015 update to the Time Groups User Guide on the wiki a note about unset parameters was changed from:

Unset parameters will default to all. So setting time to start to 09:00 and End time to 17:00 and nothing else will make the condition true from 9AM to 5PM every day of the week, every day of the month, every month.

to:

Tip: Unset Parameters

Unset (blank) week day, month day, and month parameters will default to “all.” For example, setting a start time of 09:00 and an end time of 17:00, and nothing else (no day, month, etc.), will make the condition true from 9AM to 5PM every day of the week, every day of the month, every month of the year.

If times are unset (blank) and there is also a week day, month day, and/or month range set, the day/date range will be considered an exclusion. You are essentially telling the system, “I want no time during this day/date range to be considered a match.” You can use this technique to exclude certain days/dates from a broader time period. See examples below.

Based upon the additional information in bold above we configured a time condition and time group to play a special message to inbound calls during break time except during the first two weeks of March. We used the following times:

Time to Start: 10:25
Time to finish: 10:50
Week Day Start: Monday
Week Day finish: Friday
Month Day start: -
Month Day finish: -
Month start: -
Month finish: -

Time to Start: -
Time to finish: -
Week Day Start: -
Week Day finish: -
Month Day start: 01
Month Day finish: 15
Month start: March
Month finish: March

We were a bit puzzled to find the special message playing in the afternoons (actually all day long) during the first two weeks of March. schedtc.php --debug showed that our second time period with unset times was matching. The Time Group was active during the union of the time periods. It seems like time groups are behaving according to the older version of the wiki page. Unset times are interpreted as wildcards (just like any other unset parameters).

I spent some time looking through the source code. I looked at the timecondition module source (especially Timeconditions.class.php) and in the [timeconditions] context of extensions_additional.conf. I can’t find any code that even hints at the “exclusion” behavior of unset times as described in the wiki.

The behavior described in the wiki sounds extremely useful. I’m probably going to need to chain together 5 time conditions to make our system behave as desired (with a little more functionality than what I described above) and keep it maintainable. Does anyone have additional information about the feature described in the wiki? I’ve seen a few posts on this forum that imply that this feature can’t be implemented because time groups map directly to GotoIfTime, but it seems likely that the described behavior could be achieved with an extra layer of generated dialplan code. Should this behavior be implemented? If it is fiction, could that section of the wiki be reverted to prevent other people from following the same wrong path?

I have never heard of the exclusion you mentioned or even of someone using it.

But, based on your use case, I would suggest that the order of your time conditions is crucial.

If you want a special recording during lunch but also during business hours then you would need a time condition for both with the True destination of the Business Hours to go to the Lunch Time Condition.
Then the Lunch Time Condition if not matched goes to whatever your normal call flow should be.

If you have a time condition but want the exclusion create the time as
Time to Start: 10:25
Time to finish: 10:50
Week Day Start: Monday
Week Day finish: Friday
Month Day start: 16
Month Day finish: 31
Month start: March
Month finish: March

That way it will not play the first 2 weeks of March.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.