New pause feature for Allowlist

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.

Feature request:

And the first attempt at coding this is in the forked version here in the bugfix/FREEPBX-22744 branch

New feature works like this this:

  • 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.


I’m not sure if this is a bad choice or if it will make the checks too slow, but I think it would be possible to change the test inside [app-allowlist-check] from:

'$ ["$ {DB_EXISTS (allowlist / pause)}" = "1"]' 


'$ [$ {DB_EXISTS (allowlist / pause)} && "$ {DB (allowlist / pause)}" < "$ {EPOCH}"]' 


  • if “allowlist / pause” does not exist, there is no pause;
  • if “allowlist / pause” exists but is in the past, there is no pause;
  • there will be a pause only if “allowlist / pause” AND is in the future.

No need for a cronjob to remove the value from the database if the pause period has expired.

What do you think?

1 Like

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.

1 Like

I’m afraid I’m not familiar with hints - Lorne do you have a pointer to some info on them? I’d like to get this in when I commit some changes I made following comments from the QA folks as well.

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:

exten => 1,n(falsegoto),Set(DEVICE_STATE(Custom:TC1)=INUSE)
exten => 1,n(truegoto),Set(DEVICE_STATE(Custom:TC1)=NOT_INUSE)

The final step in such a process would be a method you can add to fwconsole job to run every few minutes, an example of which is also part of the TC module:

[[email protected] asterisk]# fwconsole job --list | grep tc
| 10 | timeconditions       | schedtc       | * * * * *    | 2021-08-24 21:11:00 | Class: FreePBX\modules\Timeconditions\Job

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