<br><font size=2 face="sans-serif">Hello!</font>
<br>
<br><font size=2 face="sans-serif">I have a question regarding time-based
includes in the dialplan. How are boundary conditions handled? And
is there a definitive, documented procedure for how to handle overlapping
time includes? For example, if I want to have day/night service from
8 A.M. to 5 P.M., there are two ways I can do it:</font>
<br>
<br><font size=2 face="sans-serif">No overlapping times:</font>
<br>
<br><font size=2 face="sans-serif"> [PSTN]</font>
<br><font size=2 face="sans-serif"> include
=> PSTN-Nighttime|17:00-7:59|mon-fri|*|*</font>
<br><font size=2 face="sans-serif"> include
=> PSTN-Daytime|8:00-16:59|mon-fri|*|*</font>
<br><font size=2 face="sans-serif"> include
=> PSTN-Nighttime|*|sat-sun|*|*</font>
<br>
<br><font size=2 face="sans-serif">On this one, no time has more than one
valid time entry associated with it. Each entry ends the previous
minute to the next one starting. This is the correct one to use iff
Asterisk matches the time to the includes inclusive of both the start and
end time. However, if Asterisk is *not* inclusive of, say, the end
time, you will end up with one-minute holes at the boundaries.</font>
<br>
<br><font size=2 face="sans-serif">Overlapping time:</font>
<br>
<br><font size=2 face="sans-serif"> [PSTN]</font>
<br><font size=2 face="sans-serif"> include
=> PSTN-Nighttime|17:00-8:00|mon-fri|*|*</font>
<br><font size=2 face="sans-serif"> include
=> PSTN-Daytime|8:00-17:00|mon-fri|*|*</font>
<br><font size=2 face="sans-serif"> include
=> PSTN-Nighttime|*|sat-sun|*|*</font>
<br>
<br><font size=2 face="sans-serif">On this one, there are two times that
have more than one valid time entry associated with it: One minute
at each of 8:00 A.M. and 5:00 P.M. Each entry overlaps the other.
This is the correct one to use iff Asterisk matches the time to the
includes inclusive of the start time but *exclusive* of the end time (or
vice-versa) However, if this is not the case, you will end up with
one-minute overlaps at the boundaries.</font>
<br>
<br><font size=2 face="sans-serif">The following link in the Wiki describes
how to use Asterisk's time-based includes, and even includes overlapping
time entries, but does not document these corner-cases:</font>
<br><font size=2 face="sans-serif"> http://www.voip-info.org/wiki/index.php?page=Asterisk+tips+openhours</font>
<br>
<br><font size=2 face="sans-serif">Does anyone know the difinitive anser
to how Asterisk matches time ranges?</font>
<br>
<br><font size=2 face="sans-serif">A difinitive, precise statement of what
happens with overlapping includes would be nice. Given the right
answer, it would allow nice and easy holiday nighttime includes:</font>
<br>
<br><font size=2 face="sans-serif"> include
=> PSTN-Nighttime|*|*|25|dec
; Night on Christmas</font>
<br><font size=2 face="sans-serif"> include
=> PSTN-Nighttime|*|sat-sun|*|*
; Night on weekends</font>
<br><font size=2 face="sans-serif"> include
=> PSTN-Nighttime|17:05-7:55|mon-fri|*|* ;
Night on evenings</font>
<br><font size=2 face="sans-serif"> include
=> PSTN-Daytime|*|*|*|*
; Default: Handle
as daytime</font>
<br>
<br><font size=2 face="sans-serif">Even a simple order-based priority would
be great: whichever time entry matches *first* (or last) would work
well. In fact, it may even already work that way. I just don't
see anything describing how boundaries and overlaps are handled. I'm
also not sure that that final entry will work as an "include only
if there is no other time entry matching". I would hope so.
You can't use an include *without* time matching, otherwise it would
always be included and would mess things up.</font>
<br>
<br><font size=2 face="sans-serif">Does anyone know the answer to this?</font>
<br>
<br><font size=2 face="sans-serif">Tim Massey</font>
<br>