Blacklist by Caller Name instead of Caller Number?

Is there a way to get FreePBX to blacklist by the caller id Name field, instead of just the caller id Number field? I’d like to get rid of any telemarketing calls coming from “unknown”, “-------”, “NOT LISTED”, and strings like that.

It looks like you should be able to do a custom script type thing; something that gets called right before or after blacklist-checking, but I’m still learning asterisk/freepbx, and I’m afraid I’d break things with newbie-ish tinkering.

Take a look at the privacy manager in “Inbound Routes” setup. This requires a caller to manually enter their CID if there is none. Since most telemarketers use automated dialing, entering A cid probably won’t happen.

In addition, it allows a person with a legitimate call which for some reason doesn’t transmit a CID to get through.

Bill/W5WAF

Yup, got Privacy manager turned on already, but what I’m looking for is some way to stop the telemarketer/charity/political calls where they have a large bank of numbers (too many to just blacklist) but are “nice” enough to have the same Caller ID name. Is there a safe way on an incoming route to “jump-in” with a script before it continues processing?

You can add a context to extensions_custom.conf and then use the Custom Destinations module to make it selectable as a destination. Or actually, the third-party Dialplan Injection module would be ideal for this, except I’m not sure whether it works under FreePBX 2.5.1.

The technique described at How to automatically reject calls from telemarketers and other “junk” callers might give you some ideas for doing what you want to do.

Thanks, wiseoldowl; those suggestions look like something I can tinker with. The WAF is high on this little project; she’s already asking “can it do this?” questions. It’s nice to have a wife that actually encourages puttering around with computers/electronics.

All of my incoming calls hit an IVR first. That has eliminated almost all junk calls. The Telemarketers auto dialer doesn’t know to press 1 for John or 2 for Janet.

Yeah, first thing I did was create an IVR with the default being to hang up. That kills off all the robodialers, since they can’t press a button, heh heh. Blacklist by number takes out a few more, as does privacy manager, and if I can work up a script to blacklist by name that’ll pretty much silence the annoying calls!

Ok, been working on other stuff, and gotten back to this finally. Learned a few things, thanks to a lot of good documentation! I’m talking through this here in case anyone else wants to do something like this:

According to the Freepbx docs, some of its built-in functionality is found by looking in “extensions_additional.conf”. I searched there and found the blacklist function, and learned that if you want to extend or modify it, you would edit “extensions_custom.conf” and create an extension called “app-blacklist-check-custom”. This is exactly what I want to do: add some additional checks to “app-blacklist-check”. I’ve also found a couple of code snippets, over at NerdVittles, and this one: http://www.someguysname.com/category/asterisk, that essentially do what I want. Hope I’m using the right terminology here…

Now, I’m a little unclear on how the “include” directive works. My Asterisk docs didn’t clarify it to me, either. Does the include command literally insert the code at that point in the current extension, or does it behave like a subroutine call (create it’s own context, like an extension calling an extension)?

It vaguely looks like all I need to do is add the “app-blacklist-check-custom” extension to the end of “extensions_custom.conf”. There, I would put those additional “caller name” checks, and have them branch to “blacklisted” if any of them are true. Otherwise, the include pops back to “app-blacklist-check” and does the normal blacklist check.

Am I close?

I want to do the same thing. Why can’t the blacklist function simply accept words / other characters anyway?

Inbound routes acknowledges the words: Blocked, Unknown, Restricted, Anonymous, Unavailable, and Private. However, I’m experiencing an issue with some restricted calls coming in as " restricted " with a lower case " r " and not being rejected.

would it be easier to modify inbound routes to accept more words / characters, Or, as LKO is trying to do, modify the blacklist check to include words / characters?

I think modifying inbound routes to recognize more words / characters would allow more flexibility as to where you want to send rejected callees, but the Blacklist feature is quick and gets the job done.

Perhaps Phillipe has some insight into this?

A.J.

First of all, if I were you I’d file a bug report about the failure of the inbound route to match on “restricted”:

http://www.freepbx.org/trac/newticket

As for the problem(?) of the blacklist accepting only numbers, bear in mind that it’s not intended to match names - however I’m also aware that sometimes names or words appear in the Caller ID NUMBER field. With the caveat that I am NOT a PHP coder nor a developer, I have to wonder what would happen if someone were to go into /var/www/html/admin/modules/blacklist/page.blacklist.php and find lines 133 and 134, which currently look like this:

    if (!isDialDigitsPlus(theForm.number.value))
            return warnInvalid(theForm.number, "Please enter a valid Number");

If those two lines were commented out, I am betting that the javascript popup that keeps you from entering anything other than digits would go away. The only question I would have then is whether the database would actually accept a non-numeric value. As a matter of fact I can’t even find where these numbers are stored - if they are in the MySQL database that FreePBX uses they are well hidden, which leads me to believe that blacklisting is actually a built-in Asterisk function rather than a FreePBX function, and the page at http://www.who–da–man.com/page4/page2/page2.html seems to bear that out.

Thanks again, wiseoldowl

I took your advice and posted a ticket about this issue. If my machine wasn’t a production machine, I would most likely give your suggestion a try.

I think your probably right about the blacklist feature being a part of asterisk and not FreePBX, therefore, making modification to the inboud routes area is probably where we’re headed…

A.J.

Ok, I decided to “just do it”, and implemented what I described. So far, so good (incoming/outgoing calls work), but the real test comes this week as the many telemarketer types try to get through. I went into “extensions_custom.conf” and added an extension called “app-blacklist-check-custom”. I based it on several examples I’d seen while Googling about. What I came up with looked like this:

[app-blacklist-check-custom]
exten => s,1,GotoIf($["${CALLERID(name):1:2}" = “–”]?blacklisted,1)
exten => s,n,GotoIf($["${CALLERID(num):0:6}" = “1-PSTN”]?blacklisted,1)
exten => s,n,NoOp(${CALLERID(name)}/${CALLERID(num)} has valid caller-id…check blacklist now…)

The first check is for the ones that show up as all dashes, and the second looks for when there is no caller id info at all, which in my case asterisk seems to just return the name I gave the inbound route from my SPA3102. I made the assumption that an include just did a literal include in-place (in this case at the beginning of “app-blacklist-check” extension in the “extensions_additional.conf” file. So I just told it to branch to that extension’s blacklisted label. If it gets past the noop, it should fall through to the existing code. I should know early this week if it works; we usually get two or three that would meet those criteria every day.

If it does work, this (along with the regular blacklist and privacy check) should just about kill off everything but a legit call, and anything else that creeps through I can add a check in the custom extension for it.

Hopes this helps someone!

You can also take a look at the following module upgrade that we did on the Blacklist module. It gives you a check box to include any phone call that comes in with no phone number such as unknown or blocked and sends it to the same destination as the blacklist module. To download the module go to http://freepbx.org/trac/log/modules/branches/2.6/blacklist

Looks Interesting LKO, I’m eager to hear how it works for you. I can’t really experiment, because my machine takes calls 24/7.

Schmoozecom,

 Do you know the procedure for installing that script?  Or it it easier than that?

A.J.

Well, I’m missing something simple, I think. Got in a couple of calls that would have met the criteria, but it acted as if my code wasn’t even there. Looked through the asterisk log, and it’s calling “app-blacklist-check|s|1”, but I saw no indication it was executing my “app-blacklist-check-custom”. Admittedly, I’m learning this “scripting language” on-the-fly.

So, at this point I think I’m close. I’ve got to either figure out why this way isn’t working like I think it should, or I can try another way at the problem, like the guy did here:
http://www.someguysname.com/category/asterisk
Which is, he just bypassed the built-in blacklist function with his own. I really don’t want to go that route, since the way I’m wanting to go at it seems more like the way the designers intended, by the docs. Otherwise, why would they have a ton of “include …custom” lines in the extensions?

Ok, after googling around more I came across this: http://www.trixbox.org/forums/trixbox-forums/help/app-blacklist-check-custom-not-working-advertised
Which looked like someone else was attempting to do something like I am, and it wasn’t working right either. Based on that, I’ve decided to go at this another way, since this method isn’t working as expected.

Based on the docs, I went into the “extensions_override_freepbx.conf” file, and overrode “app-blacklist-check” there, by borrowing the existing code from “existing_additional.conf” and modifying it to look like this:

[app-blacklist-check]
include => app-blacklist-check-custom
exten => s,1,GotoIf($["${CALLERID(name):1:2}" = “–”]?blacklisted)
exten => s,n,GotoIf($["${CALLERID(num):0:6}" = “1-pstn”]?blacklisted)
exten => s,n,NoOp(${CALLERID(name)}/${CALLERID(num)} has valid caller-id…check blacklist now…)
exten => s,n,LookupBlacklist()
exten => s,n,GotoIf($["${LOOKUPBLSTATUS}"=“FOUND”]?blacklisted)
exten => s,n,Return()
exten => s,n(blacklisted),Answer
exten => s,n,Wait(1)
exten => s,n,Zapateller()
exten => s,n,Playback(ss-noservice)
exten => s,n,Hangup

; end of [app-blacklist-check]

Which is pretty much the existing code with my additional tests tacked onto the beginning. I’ve tested incoming and outgoing calls and they still work, and examination of the logs now shows the new code being executed. Now, hopefully later today we’ll get some calls in that will further test the code.

Still not sure why my original idea of modifying the function didn’t work. I don’t like this way because I’ve replaced the function, and if changes come along later I would have to manually “resync” the code. But, if this works, great.

Ok, got several junk calls today that hit the “pre-tests”, and the code worked. So now, if there’s any caller name/id string filtering I want to do, I can put those before the no-op, and the blacklist (by number) check still performs as it used to. Still don’t like completely replacing the “built-in”; but, it works.

Thank goodness for all the documentation out there, along with plenty of code snippets to draw from!