Day/Night Mode and Time Condition auto-toggle

Hey guys.

I’ve read a couple posts about this in the past, but all of them are dated a couple years back at this point, so I thought i’d poke in and see if its been done yet (or can be done by a way of a hack/workaround)

I have a time condition for open/closed hours, and also have a day/night mode defined - currently it works where the time condition is followed in a normal case, and if ‘night mode’ is turned on, it puts the system into a forced night mode state no matter what.

That’s all fine and good but what I’m looking for is to have the Day/Night status automatically toggle when the time rolls over when the time condition would normally toggle it.


The office is open from 8am-5pm as defined in the Time Condition
At 7am, the system’s night mode button would be lit up and it would say night mode on the screen.
If someone were to press the night mode button, it would toggle the office back to an open mode state.
8am rolls around, the system will now proceed to stay in open mode, but if it was not forcefully toggled earlier, it would now switch from Night mode to Day mode (reflecting its status on my aastra with xml+devstate blf hints.

Likewise, during the day, the office is open. If the receptionist toggles night mode, it would go into night mode and presumably stay there until 8am the next morning when it would force the system back to ‘day mode’. also, if the receptionist was to not touch the button at alll, at 5pm the system would automatically roll over into night mode.

I would think it would require some sort of daemon to run and check once a minute or something to compare against a time condition, since time conditions are only evaluated in a dialplan as the dialplan is executed, and the day/night mode is typically a toggle that cannot match itself to a time.


It would be fantastic to have a real day/night “state” button as well as a toggle from whatever state its in, to the opposite, until the next scheduled auto-toggle was to occur.



maybe this is a good one to try and get into 2.9.

I don’t think I would do it with a daemon, probably better to do it with a call file and some dialplan (similar to the way some of the wakeup call module/agi scripts work).

Might be worth a feature code request into the system (or if there is already one, point it out) so we can mark it for 2.9 and keep it on the radar to consider doing.

Use Crontab, I have an example posted on the PBXINaFlash site…