I have a file named blacklist.conf that all incoming calls must access before continuing the current extension. So far it has worked for blacklisting unwanted callers. Currently I have a nuisance call center that won’t stop calling, I’m not sure if there selling/scamming or what, However they keep spoofing the CALLERID(num) and it’s almost impossible to block them. The caller also changes up the CALLERID(name) but stays within a certain format that can be pattern matched.
Here is an example of the caller name X2050127171544859521. I found a piece of code that looks like it might do the trick if modified correctly, however I’m not sure how to do the pattern match correctly in asterisk.
Here’s the code I found that needs modified.
exten => s,1,GotoIf(["{CALLERID(name)}" = “FOO INC”]?blacklisted)
Here is my attempt to modify the code to run in my blacklist.conf file. I’m not sure if it will work.
exten => s,1,GotoIf(["{CALLERID(name)}" =~ /X\d+/]black,blocked,1)
;BEGIN FILE blacklist.conf
[blacklist]
exten => s/_121255512XX,1,Goto(black,blocked,1) ; Credit Card Scammer
; Returns to and completes preivous extentions script if no blocked callerids
exten => _.,1,Return()
[black]
exten => blocked,1,NoOp(Blocked Call)
same => n,Playback(silence/1)
same => n,Zapateller
same => n,playback(were-sorry&discon-or-out-of-service)
same => n,Hangup
;END FILE