This came to me the other night on the OpenSourceLounge call where we briefly discussed @mitchmitchell’s very cool Allowlist module. I recently missed an automated call with covid test results because my home DIDs all pass thru the Allowlist module first. No robots allowed.
New *39 dialable feature code to toggle allowlist pause on and off
when pause is enabled, inbound calls bypass the allowlist check
when pause is disabled, allowlist works as normal
New astDB key allowlist/pause which sets the epoch time when pause will end. Right now it’s current time plus 24hr
When feature code enables pause, dialplan writes a epoch time in future to allowlist/pause
disabling pause deletes the allowlist/pause key
Each time an inbound call hits the allowlist check, a new pause check occurs to see if the astDB value is in the future or past. Delete the key if it’s in the past, which disables the pause
Possible future improvement. Right now pause is hard coded for one day, but could modify the toggle feature code to accept trailing digits so pause can span multiple days. To pause for 5 days, dial *395 etc. Perhaps better would be to have a user field in the GUI to allow the admin to set the pause delay.
Extra credit would be hint that corresponds to the status of the Allowlist pause, but since it expires automatically, there needs to be a cron task that runs regularly to check the value of allowlist/pause and update the hint when it expires. Possibly more work than warranted unless someone wanted a pause feature to never expire automatically, only be manually enabled/disabled, in which case a hint would be very useful.
My post was a bit rushed, but my point about the cron was that it would only be needed if there is an associated hint for the pause feature code. There needs to be some mechanism to update the hint once the pause expires similar to what is done for the time conditions feature code hints.
A hint is the Asterisk mechanism that controls the LED on a phone BLF. Taking time conditions as a starting point, if you have a time condition defined, there is a toggle feature code that can be used to temporarily override the TC action. The feature code has a hint. Example:
freepbx*CLI> core show hint *271
*[email protected]: Custom:TC1 State:Idle Presence:not_set Watchers 0
The dialplan that generates the above forms part of the feature code dialplan with this line:
exten => *271,hint,Custom:TC1
and in dialplan when you need to change the device state associated with the hint, you set the function with lines like: