FOOD FOR THOUGHT Blacklist issue

AndyInNYC

Active Member
Joined
May 23, 2013
Messages
529
Reaction score
77
I keep getting calls from a callerid 'GO GREEN' or 'GOGREEN' from various, non-legitimate numbers. Some are in my area code, some not.

I'm using the blacklist module and have entered just the callerid (name) in an attempt to block the calls along with entries using (non-repeating or blocked after entry) the number.

Is there some way to block all calls from 'GOGREEN' or 'GO GREEN' that I'm missing?


Andrew
 

dicko

Still learning but earning
Joined
Oct 30, 2015
Messages
644
Reaction score
234
Perhaps send calls to a context like

[catch-trolls]
exten => _X.,1,gotoif($["${CALLERID(name)}" = "GOGREEN"]?troll)
exten => _X.,n,gotoif($["${CALLERID(name)}" = "GO GREEN"]?troll)
exten => _X.,n,Goto(from-pstn,${EXTEN},1)
exten => _X.,n(troll),Hangup()
 
Last edited:
  • Like
Reactions: wardmundy

AndyInNYC

Active Member
Joined
May 23, 2013
Messages
529
Reaction score
77
Dicko,

I like the idea, but the list is longer than just GO GREEN. I'd love to work in side the blacklist module (ie have blacklist use the description field as well, perhaps).

Plus, your context should likely be added in with some other additional code - so that I don't ignore blacklist to just remove GO GREEN, for example. Where would your context be added?

Andrew
 

dicko

Still learning but earning
Joined
Oct 30, 2015
Messages
644
Reaction score
234
It's a little harder than you think, the blacklist "module" is a wrapper around an internal asterisk function blacklist() it only operates on CallerID(number) , you could certainly add either another db or multitask the blacklist one in the sqlite3 astdb table and query it instead of my simplistic "GO GREEN" example , but populating the table with alphabetical data essentially a phone dial pad would be very difficult, you could look at the app-blacklist* contexts in the FreePBX code and perhaps use something like app-blacklist-last but replicating all of the blacklist() functions to use CallerID(name) would "not be trivial"

either way you would put your code in extensions_custom.conf , send all inbound calls to it and make sure you pass successful calls on to whatever context you are using right now.
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
15,083
Reaction score
2,601
@dicko: Since this is being sent by the caller as the CallerID, I'm just curious what would happen if you manually added GOGREEN and GO GREEN to the Asterisk DB blacklist table:
Code:
asterisk -rx 'database put blacklist "GO GREEN" 1'
asterisk -rx 'database put blacklist GOGREEN 1'
You can always delete them if it causes problems or doesn't work:
Code:
asterisk -rx 'database del blacklist "GO GREEN"'
asterisk -rx 'database del blacklist GOGREEN'
 
Last edited:

dicko

Still learning but earning
Joined
Oct 30, 2015
Messages
644
Reaction score
234
That would probably work no trouble as blacklist() just checks whethere CALLERID(number) is in the db. However one could argue that if the CALLERID(number) contains anything but numbers it would not be kosher, then one could simply have

exten => _X.,1,gotoif($["${CALLERID(number)}" : "[0-9]+"]?from-pstn,${EXTEN},1:app-blackhole,hangup,1)


Edit:-
I just looked at func_blacklist.c and it would appear that blacklist actually checks both CALLERID(name) and CALLERID(number)

if (ast_channel_caller(chan)->id.number.valid && ast_channel_caller(chan)->id.number.str) {
if (!ast_db_get("blacklist", ast_channel_caller(chan)->id.number.str, blacklist, sizeof (blacklist)))
bl = 1;
}
if (ast_channel_caller(chan)->id.name.valid && ast_channel_caller(chan)->id.name.str) {
if (!ast_db_get("blacklist", ast_channel_caller(chan)->id.name.str, blacklist, sizeof (blacklist)))
bl = 1;
}

So very little is needed , just populating the blacklist DB.
 
Last edited:
  • Like
Reactions: wardmundy

AndyInNYC

Active Member
Joined
May 23, 2013
Messages
529
Reaction score
77
After getting yet another call (from yet another DID) I added 'GO GREEN' per Ward's post. I'll let everyone know if they get through again.

Thanks.


Andrew
 
  • Like
Reactions: wardmundy
Joined
Aug 10, 2010
Messages
9
Reaction score
0
Can Blacklist catch invalid area codes? For example a Social Security scam group is using 822 area code this morning and it is very annoying. If Blacklist could match an area code it would be nicer.
 

ostridge

Guru
Joined
Jan 22, 2015
Messages
382
Reaction score
69
Location
UK
Can Blacklist catch invalid area codes?
You could add inbound route(s) that include a pattern match in the DID(Number) field, and set the destination as required perhaps to 53669 LENNY

Perhaps its not a neat solution if you have a lot of such area codes.

FWIW I have for some time included the following in my blacklist
UNKNOWN
anonymous
private
restricted
unknown
witheld

These seem to work fine.
 

Members online

PIAF 5 - Powered by 3CX

Forum statistics

Threads
22,319
Messages
137,021
Members
14,550
Latest member
treimers