Best way to access Day/Night controls etc. from the command line?

I’m trying to determine the best way to control Day/Night and reflect Time Conditions status via the command line.

For example, I have phones which subscribe to hints on Day/Night and would like also to subscribe to time conditions to see which are in currently active.

For the time conditions I would probably link those to Day/Night contexts but I need a way to update the hint to reflect the true status so that subscribed phones are also updated.

I thought about using a .call file from cron jobs to simple toggle but then the time condition would have already done that and I’d end up toggling back.

Is there another way other than using a call file where I could update the hints/status to reflect reality?

I’ve probably made this sound much more complicated that it really is but any tips would be most appreciated.


I think I’ve answered my own question but need to test it.

I found the devstate command, e.g.

devstate change Custom:DAYNIGHT4 INUSE

I wonder if this is all I need to do and can call this from cron…

… OK, so this sets the hint only, then I also need to update the DB for the dialplan used by FreePBX:

So I guess: database put DAYNIGHT C4 DAY|NIGHT would do that…

Sorry to be thinking out loud and answering my own question. At least when I forget what to do next week I can come back here :slight_smile: