How to block specific CID for specific outgoing number


need help for the following topic:

Existing Call Routing:
incoming call from caller “A” will be forwarded after no answer internally after 30sec to an specific external number "B"
implemented over incoming route and ring group

needed enhancement:
if caller “A” CID number is in a list of specific numbers the forwarding to external number “B” will be prevented

How can I implement such filtering in FreePBX?

Asterisk Version
FreePBX Version

I don’t think there’s a simple way to do this.

Once the call is transferred to the extension, the “die is cast” in terms of how the call will be handled.

If you wanted to write a custom-context, you could probably set up a little program that checked the CID against ASTDB and processed it accordingly.

Take a look at your /var/log/asterisk/full file and find a call that should have gone to voicemail. This will give you the “base” context for your change. At that point, you might be able to add a “custom” version of that context that processes the CID against the database and diverts the call to the ‘h’ part of the context.