Of Robocalls and Whitelists

(Lorne Gaetz) #1

[The functionality of these scripts is largely superseded by the AllowList Module]

… of cabbages and kings.

I have several DIDs published for business purposes, and as time passes, they become incrementally more prone to robocalls. This is to the point now that robocalls may well outnumber legitimate calls, with some days being intolerable. The FreePBX blacklist is unable to deal with them effectively because there is no consistency to the Caller ID, nor have I wanted to force all callers to navigate an IVR as it will negatively affect customer experience. And so, not unlike the walrus and the carpenter who lament all the sand on the beach, I’ve complained about robocalls but never did anything about it.

Until a few weeks ago when someone saw fit to wake me up at 5am with an offer to renew my Google listing. This was 5am on a national holiday. A holiday whose only practical purpose is reserved for hangover recovery. And so, with my beauty sleep interrupted, I spent some time writing AGI scripts that will:

  1. check a number against the FreePBX Contact manager and indicate if that number is present or not, and
  2. automatically add a contact to the FreePBX Contact Manager if not already present

With the above in place, I check the inbound Caller ID number against the Contact Manager, and if the number isn’t there, the caller gets sent to an IVR that challenges them with a DTMF entry. Once they successfully pass the challenge, the number is auto added to the Contact Manager, and the caller will never again be sent to the IVR. It’s assumed that no robocalls will get through, but if they evolve I can add some complexity to the IVR such as forcing callers to enter a randomly generated code.

I’m using the third party modue, DynRoutes for the Contact Mgr check, and just a normal Custom Destination to add CallerID to the Contact Manager.

Blacklist/WhiteList in FreePBX
How to bypass IVR for some specific callers
Route Calls to specific queue based on Specified Caller ID List
Inbound calls match specific number in Phonebook then ring specific Extension
CallerID groups (inbound)
Accept or reject call with IVR and transfer call upon acception
Call filtering with a pin/code
Automated Spam Filter
Block incoming anonymous fax
IVR Spam Block
Robo calls received between less or 1s
Anyway to link a ring group to a group of contacts?
If time is between hour x and hour y, send calls to IVR - UNLESS the caller is one of these
Conditional dump to VM
Incoming route based on callerid name
Banning current caller from IVR
Help with setting spam filter
Rate Limit Incoming Calls per Number?
FreePBX AllowList Caller Module -- to block all but a list of allowed callers
Conditional gate opener
IVR Spam Block
Allow a group of CID to access to extension on IVR, blocking others
WhiteListe Configuration
Any way to query the contact manager or phonebook over CLI?
Any chance we might see an updated blacklist module?
Is it possible to have a black (or white) list of inbound callers?
Inbound routes issues
Blocking inbound by caller ID using other than blacklist
Inbound dynamic routes based on phonebook or CID
Blacklist question
Incoming Route for multiple CallerIDs
Possible to do this with incoming calls?

As a migratory bird, spam comes in at all hours and I have a similar filter with a few additional features.

Called numbers are automatically added to the whitelist.

W (whitelisted), P (pass) or F (fail) is added to the User field of the CDR, to help troubleshoot incorrectly handled calls.

When first implemented, I used a script to examine the last two years of CDRs, populating the whitelist with all calls that lasted more than a minute and connected to a human.

On calls that fail the IVR challenge, TrueCNAM is used to choose between voicemail and hangup. It drops about half of unwanted voicemails and AFAIK has never disconnected a legitimate caller.

Unfortunately, two manual controls remain: The do-not-disturb button is still needed; calls from friends who don’t know my location or don’t figure the time correctly can come in at any time. A Call Flow Control BLF key temporarily bypasses the filter, needed when calling a large company whose “queue callback” does not present a predictable caller ID (it lights red when on, reminding me to turn it off after receiving the callback).

(Itzik) #3

Can you post yours? Thank you


I can’t easily post a complete solution, because my system updates the whitelist outside of FreePBX, in an app whose primary purpose is displaying recent calls in a small window, with click-to-call functionality.

However, the basic filtering code was posted in [SOLVED]Inbound routing .

The overall algorithm is described in https://www.dslreports.com/forum/r32191642-Can-spam-call-problems-really-be-solved-techically .

Ward Mundy made various changes (some of which I don’t agree with) but posted complete code. See http://nerdvittles.com/?p=27313 .

I hope that at least some of the above is useful.

(Lorne Gaetz) #6

So it turns out I overestimated the ability of some people who call me. I’ve gotten a few who called in, heard a recording telling them to press a button to continue, and they hung up. In order to minimize inconvenience, I thought it would be clever to automatically add all outbound dialed numbers to the white list, easily done using a few lines of custom dialplan:

exten => s,1,Noop(Entering user defined context [macro-dialout-trunk-predial-hook] in extensions_custom.conf)
exten => s,n,AGI(lgaetz-cmadd.php,${OUTNUM:-10}) ; normalize numbers to 10 digits
exten => s,n,MacroExit