FreePBX AllowList Caller Module -- to block all but a list of allowed callers

You want a dialplan hook, which currently rely on the deprecated macro application, but you can be the first to create a gosub hook:

In your case you don’t need the macro part at all, just use gosubif and check for the existence of the context. Not tested:

exten => s,n,GoSubIf($[${DIALPLAN_EXISTS(app-allowlist-check-predial-hook,s,1)}]?app-allowlist-check-predial-hook,s,1())