Possible new source to block "bad" numbers (telemarketers, etc.)

40 posts / 0 new
Last post
wiseoldowl
wiseoldowl's picture
Possible new source to block "bad" numbers (telemarketers, etc.)

If you are tired of getting "expiring vehicle warranty" scam calls and similar total wastes of your time, you might find this page interesting:

http://www.everycall.us/top_100_phone_number_comments

At this page you can download a list (which is updated daily) that lists the top 100 commented numbers on this site (which usually indicates the number is associated with "junk calls" of some type). The list is in .csv format, which I assume means it could be directly loaded into a database.

Now, what I sort of wish is that someone who has figured out how to write FreePBX modules would create one that would have the ability to download this list nightly, optionally weed out the listings that are not in NANP format, and insert the numbers into a database along with the current date. Numbers that already in the database should be overwritten (so the date is refreshed), not duplicated. This list would then act as a secondary blacklist, and if a call comes in with one of the Caller ID's from this list it would get the blocked call treatment. When the module does its nightly update, it would also check the database for any numbers that haven't been "seen" on the list in the past n days or months (can be set by the user; I'd default to six months or 180 days) and delete those, so you don't wind up with a database that is years out of date.

There are several other services that offer lists of this type; I'm not saying this is the only one or even necessarily the best.

KodaK
KodaK's picture
I'm pretty sure I could do

I'm pretty sure I could do this in perl and shove it into a _custom.conf file pretty easily. Not so familiar with modules, though.

Also, if you trust the list you can just ditch the old one and re-read in a new one every time, no need to have it try to remember anything.

everycall
everycall's picture
Hello everyone, my name is

Hello everyone, my name is Ben and I own EveryCall.us. I was looking at my server logs and saw a couple of visits from freepbx.org and I thought I would check it out. I think your idea is a great one and I wanted to let you know that I would actively support any projects that you guys wanted to take on to configure some kind of active call blocking into the PBX software.

I could create another CSV file that is updated nightly with all of the telephone numbers and a score, then the PBX can be configured to block any number that are higher than the user defined allowable score. Or I could write a script that would allow for active passing of telephone numbers from the PBX to EveryCall.us through the web and return a score.

What do you guys think? Feel free to email me if you'd like, I think it would be a lot of fun to come up with something that really works well, my email address is admin [at] everycall.us

Ben

wiseoldowl
wiseoldowl's picture
If there would be a way to do a quick data dip

Ben, sorry for not responding sooner, but here is my thought. Let's suppose you could do a data dip in real time. For example, the incoming caller ID is something like 8005552368 (which could also be in the format 18005552368, or even +18005552368). It would then be sent to you as part of a HTTP request such as this:

http://www.everycall.us/query?8005552368 (<--- This is just a sample, any format that would work is fine as long as the number could be sent as part of the HTTP request).

The "page" returned should probably be one very simple line of plain text (or maybe two, see below). It should contain a score OR some other character(s) to indicate that the number is not in one of the allowable formats (meaning it might be an international call). However, if the number is not in a usual format but has still been associated with "spam" calls then a score should be returned anyway, if you have that information in your database.

The biggest issue would be that the server would have to be reasonably fast, so that call processing is not delayed significantly. You may also want to somehow keep records of the number of data dips per month sorted via IP address so that if anyone is abusing the service, you can block their IP address and/or request they make some contribution toward your server expenses. If all you are returning is a single line of text containing a one or two digit score then this may never become an issue, but still it seems that whenever anyone offers a free service there is always someone else who will figure out a way to abuse it. And then there's also the issue that someone's bad code might get stuck in a loop and continually make the same request every second or two for hours on end.

Anyway, the single line of text should be reasonably easy to handle in an AGI perl script. The biggest issue in FreePBX would be figuring out how to intercept the incoming call and then direct it based on the result of the data dip. I can think of at least one way to do it - change the context in a trunk definition from "from-trunk" to a new context in extensions_custom.conf, then in that custom context call the AGI script and based on what that script returns, either pass the call along to the normal "from-trunk" context or send it elsewhere (maybe a congestion tone). This is not something I could whip out in ten minutes but on the other hand it's probably fairly trivial to code (especially for anyone who regularly writes code in perl or php). The biggest concern would be making sure that in the AGI script there is a short timeout on the HTTP request, so that if your site is cannot be accessed for some reason the call flow is not delayed by more than a second or two.

If your service were to become really popular than maybe the developers would consider adding a field on the inbound route configuration pages that would optionally do the data dip and then send the call to a "black hole" (or some other alternate) destination if the score were above a specified level.

Of course, in my ideal world your service would return two lines of plain-text information: the score as discussed above on the first line, and a best guess at the Caller ID name on the second line. That way, if the Caller ID name field on the incoming call were already populated we could ignore the second line, otherwise we could actually use it to provide some information about the call. The bonus is that for known spam callers you might actually associate a company name (or some other descriptive information about the type of call, such as "WARRANTY SCAM", although you'd have to be very careful about doing something like that so as not to get sued for misidentifying a legitimate company), so that the name or information could be made to appear in the system log even if the original incoming Caller ID name were blank. I'm obviously not saying you should go paying the phone companies to do a real Caller ID data dip, but for numbers you know nothing about you could always return the state or province associated with the area code, like some cell phone companies do (e.g. NEW YORK CALL). But, that second line might add complexity and would also increase the load on your servers, so it's entirely up to you if you'd want to do something like that.

everycall
everycall's picture
I've been checking this

I've been checking this thread once a week or so and I'm glad that you were able to respond. I really like your ideas and I think that we could come up with something very useful pretty quickly. I see this happening in two (or more) phases, phase 1 would be getting the score function going on EveryCall.us and then phase 2 would be working on returning the caller name if it exists in my database. Of course there will probably be a host of other great ideas that come up as we work on this and I'm pretty open to help developing anything that makes the freepbx product better using EveryCall.us.

I wanted to make sure and point out that I have no knowledge about the FreePBX product other than a cursory understanding of how it works. I propose that the programming of the FreePBX software be done by you or others interested in contributing, and then myself and my team would work on anything on the EveryCall.us side of the equation. Does that make sense? Are their other developers that would be willing to contribute to the FreepPBX side of things?

Also regarding the potential for load on my servers, can you give me an idea of how many freepbx systems are out there and how many might use the spam interface that we're discussing?

For now I will get working on returning a score for queried numbers with my developers. I'd be interested in getting your thoughts on calculating the score, variables to consider, etc.

It is better for me to communicate via email admin [at] everycall.us, however I'll check back to this forum to see if you've responded.

wiseoldowl
wiseoldowl's picture
I'm not a programmer, actually

Just to be clear, I don't really consider myself a programmer, but now and then I will try to hack together a short code segment in Perl. It's difficult because I use Perl so infrequently that I forget most of what I know about it from one time to the next (too bad I didn't learn it when I was in my 20's; I still remember all the old BASIC commands and syntax I learned back then). Nevertheless, I THINK I could make this work through an AGI perl script, since I have done things that are fairly similar in other code segments. What I cannot do (but perhaps someone else could) is properly integrate it into FreePBX. For whatever reason, the FreePBX developers have pretty much enforced a defacto requirement that all "official" FreePBX modules be written in PHP, which I don't know at all (the closer a language gets to "C", the less likely I will ever touch it with the proverbial ten foot pole - my brain just can't wrap itself around some of the newer languages).

However, using an AGI script is not necessarily a bad thing; there are several other AGI scripts (both Perl and PHP, and possibly in other languages as well) floating around that are successfully used with FreePBX. And if this becomes popular I suspect that the functionality could fairly easily be added to the inbound route module, or a placed in a separate FreePBX module, if someone with more programming experience than I cares to do it.

The only real downside of using a Perl script is that you wind up calling Perl modules, and almost invariably one or more of those will not installed on the machine that runs FreePBX. So the user has to install the Perl module(s), which is easy enough to do using yum (in CentOS) or Webmin, and probably second nature for anyone who's ever used Perl. But it does mean that it would not be as easy as installing the typical FreePBX module (not point-and-click, in other words).

On the flip side, you can do what needs to be done on your end by simply making the http request work. You wouldn't really need to know anything about FreePBX or Asterisk at all. But you would need to have the http requests working on your end before any code could be written to utilize them (obviously).

I cannot comment on how many people might actually use this. Clearly a lot more would use it if the ability to make the http request were incorporated into an "official" FreePBX module, but I can't predict how many people would take the 15 minutes or so necessary to install an AGI script (and any associated Perl modules) and add some lines to extension_custom.conf and make a couple other tweaks.

As far as calculating the score, I guess I don't know enough about that to really comment. Obviously you'd want to avoid "false positives" and also people reporting a number for malicious reasons (for example, members of one political party reporting the robo-callers of the other party - while those are definitely a nuisance and many of us would want to block those calls anyway, you can see how that's in a different class from a warranty scam call). So the numbers really fall into two categories - "telephone spam" and scams, and then what we might call "annoyance" calls, which are technically neither spam nor scams. Annoyances might include political calls, solicitations from charities (the ones not known to be fake) and perhaps similar types of calls. I'd give the spam/scams a higher score than the "annoyance" calls, but the annoyances should definitely return a non-zero value (I, for one, don't want either type of call, but maybe there is someone who really wants those annoying political calls that are mostly lies anyway). With that said, maybe others might have some ideas on scoring. I'd like to see some input from other people in this thread anyway; if only two or three people have any interest in this then I don't know if it's worth our time to try and make it work. That's also why I'm posting publicly rather than going to e-mail - I keep hoping someone else will chime in on this thread.

everycall
everycall's picture
Is anyone interested in

Is anyone interested in assisting with developing the FreePBX side of this? If so please comment in the forum.

Basildane
Basildane's picture
Folks, you know this has already been done for a year now

www.whocalled.us. The AGI code even on their webpage.
I use it and it works great.

I'm not knocking the everycall guys... The more the merrier.

wiseoldowl
wiseoldowl's picture
The problem with whocalled.us is they require registration

Not only do they require registration to use their scripts, but you have to send your user name and password (in the clear) with every lookup request made via their AGI script. So they could, if they wanted to, build a database of every number you've looked up (which for many people, might mean every incoming call). If you didn't like Trixbox's "phoning home" trick then you probably should not be in any big rush to use whocalled.us - it's about the same principle in my book.

And, the AGI scripts they provide are intended for use with plain Asterisk, and would doubtless have to be tweaked for use with FreePBX. Anyway, if I were going to use a service like this, I'd prefer one that does not require registration details to be sent with every lookup (also, when milliseconds count, I wonder how long it takes them to verify the login before they return the data?).

Basildane
Basildane's picture
Good points

The call tracking part bothers me too.
Another problem is that there is no mechanism to remove a number from their list if there was a mistake.
There is also NO contact link to contact the website maintainer. None.

However, I am using it with FreePBX. And the lookup speed is so fast I can't tell it is happening. And it WORKS!

I really enjoy looking at the log files and seeing all the vermin who tried to get through...
I remember a time when I got 32 telemarketers a day. Now, its about 2 a year.

I love the smell of telemarketers hitting the blacklist in the morning.

wiseoldowl
wiseoldowl's picture
How did you get it to work with FreePBX?

I have to ask, how did you interface it with FreePBX? No sense in everyone else trying to reinvent the wheel, and your method might be easily adaptable to the other service (if they ever get their mods in).

Basildane
Basildane's picture
Here is an example

My dialplan is very complex, but I cut out a snippet and shortened it to show just a few lines related to calling WhoCalled.US.
Have your inbound route go to "custom-spam-lookup".
Install "junk_lookup.agi" in your agi bin folder, and set the userid and password.

[custom-spam-lookup]
exten => s,1,GotoIf(${DB_EXISTS(cidname/${CALLERID(NUM)})}?whitelisted)
exten => s,n,AGI(junk_lookup.agi|${CALLERID(number)}|"${CALLERID(name)}")
exten => s,n,NoOp(whocalled.us returned spammer set to ${spammer})
exten => s,n,GotoIf($["${spammer}" = "yes"]?blacklisted)
exten => s,n(whitelisted),Goto(app-daynight,0,1)
exten => s,n(blacklisted),Answer
exten => s,n,Wait(1)
exten => s,n,Zapateller()
exten => s,n,Playback(ss-noservice)
exten => s,n,Hangup

bubba
bubba's picture
blacklist

I always figured this should be handled Upstream (providers)

With VOIP it should be a no brainer...
We should all ask our providers to allow us to opt in to a blacklist
no need to worry about the lookup time nor the 'tracking' as they do that now.

I know many folks who would pay to have this feature handled upstream
I know folks who port out POTS lines to a VOIP provider who could offer this, just because of those "warranty" calls...

Bubba

everycall
everycall's picture
EveryCall.us

That's great that whocalled.us offers a similar kind of service to their database, I was unaware of that. However I think there are many improvements that can be made if we're up for it. I agree that having to send a username and password is not a good thing, although it does prevent abuse. My thinking is to require a registration and use some other form of checking the registration other than a username/password situation, maybe a secret code or something. It is a good thing to prevent abuse, keeps the system fast, lessens bandwidth usage, etc.

I also think that each local PBX system should have an allow list, so that even if a call is flagged as spam in the EveryCall.us database, it will be allowed to prevent against false positives. I'd also like to see an easy way to report the call to EveryCall.us, maybe #EVERYCALL or something similar will report the telephone number on the caller id to EveryCall.us?

I'm currently working on the developing the scoring system, shouldn't be but a couple of weeks before I have something up and running. Meanwhile any comments you guys have would be great.

Basildane
Basildane's picture
This is really easy

It shouldn't take weeks. It's just a couple of lines of code.

1. You provide a URL for user to lookup a number. The results of that http get should be a number, the number would be how many people reported them as a telemarketer. If I get a zero back, I let the call pass. 1 or more, the call goes to Jordan... He'll play with them as long as they keep talking. (Jordan is a BOT).
The URL could look like: http://www.everycall.us/query?2025551212
It would simply return the number of hits.

2. The allow list. Better known as a "whitelist". I use my asterisk phonebook as the whitelist. Anyone I talk to regularly is in my phonebook, primarily so the callerid name displays correctly (instead of just saying ANNAPOLIS MD, for example).
In my context, I just see if the incoming number is in my phonebook. If it is, I skip the blacklist lookup and pass the call.
Example:

exten => s,1,GotoIf(${DB_EXISTS(cidname/${CALLERID(NUM)})}?whitelisted)

There is nothing to it. Done.

Oh, and you MUST use a username and password to register telemarketer phone numbers. And provide a mechanism to dispute mistakes.
Otherwise it will be abused to the point of being useless in a matter of hours.

everycall
everycall's picture
More Intuitive Scoring System

Basildane, thanks for the feedback. I will definitely incorporate an authentication system to prevent abuse, I agree that without it there is a large potential for the system becoming unusable.

Regarding the scoring system, I don't think it is adequate enough to return a simple 0 or 1 result for your system to make a decision on. Here's why.

Anyone in the world can go to EveryCall.us and report a telephone number. So let's say that someone reports your cell number to the database as a telemarketer, a simple 0 or 1 result would incorrectly classify your number as a spam number.

What I am trying to do is to come up with a more intelligent classification system that will score each telephone number based upon a number of different factors that we can derive from the report data we have to eliminate false positives as much as possible.

The other advantage with a 0-100 score is that now you can setup a low, medium, high threat level in your PBX system so that you can then play with the tolerance levels of the scores to fine tune calls that are blocked. For instance, a number with only one call report from two years ago probably isn't going to be a threat, whereas a number that has been reported 425 times in the past week should definitely be blocked.

Hence why it's going to take a week or two to get the scoring mechanism in place, but once we do I think it will be a very powerful tool which will better allow your system to intelligently block spam telephone numbers.

What do you think?

Basildane
Basildane's picture
I wasn't suggesting a 1 or 0 return

But to return the number of hits, then we can make a decision ourselves. For example, some may want to block if > 10.
Anyway, I agree with what you are saying, and I can offer my help. At the least I'll test stuff for you. But I am an experienced software developer too.

Anything that takes a hit at telemarketers is good in my book. Let's get to it!

everycall
everycall's picture
Same Page

I misunderstood you then, we're on the same page Smile I'd welcome any assistance you're willing to give, I should have something ready tomorrow or at the latest Friday... can you email me your contact info so that I can give you access to test our service? admin [at] everycall.us.

Thanks!

wiseoldowl
wiseoldowl's picture
Yet another service of this type (I think)

Just came across this one, haven't had a chance to really look it over yet...

PhoneSpamFilter.com [Report and Stop Annoying Telemarketers]

Installing PhoneSpamFilter on Your Asterisk PBX

No idea how it compares to the others, just thought I'd mention it as a possible additional option.

Basildane
Basildane's picture
I tried them for 2 days

Server CONSTANTLY busy and returned errors.
Maybe they fixed it, but I already switched.

everycall
everycall's picture
Beta Done

Ok I've got a beta version of the lookup going. Here is the address if you want to give it a try

http://www.everycall.us/query?502-447-4497

Simply enter http://www.everycall.us/query? and then the phone number. It will return a score if it is in the database and -1 if the number is not in the database. Please feel free to give it a test and let me know if you think any changes need to be made.

We are going to look into the verification of username/secret code to prevent abuse. Any comments on that would be helpful too.

Thanks.

wiseoldowl
wiseoldowl's picture
I have 95% of this figured out, but...

Okay, here's what I did. I warn you up front this DOES NOT WORK, but I can't figure out where I am going wrong. First I created a file /share/var/lib/asterisk/agi-bin/check-everycall-us.agi which contains this:

BADCALLSCORE="0"
RETRIEVEDSCORE=`/usr/bin/curl -s -m 2 -A Mozilla/4.0 http://www.everycall.us/query\?${1}`
BADCALLSCORE=`echo ${RETRIEVEDSCORE} | grep score | sed -e 's/.*score=//' -e 's/ <br />//'`

if [ -z $BADCALLSCORE ]
then
	BADCALLSCORE=0
fi

echo "SET VARIABLE badcallscore ${BADCALLSCORE}"

This works fine if I run it from the command line (it gets the score of a number I put in). Of course you do have to remember to change the permissions and ownership so they match the other agi files in that directory (must be executable, and user and group are asterisk, etc). Also be careful not to lose any of the backticks when copying the code.

Now the part that is oh so close, but giving me fits. I added this to /etc/asterisk/extensions_custom.conf (if YOU do this make sure there's not already a from-pstn-custom context - if there is you'll have to add this code to it):

[from-pstn-custom]
exten => _.,1,NoOp(Checking Everycall.us for bad caller)
exten => _.,n,AGI(check-everycall-us.agi,${CALLERID(number)})
exten => _.,n,NoOp(Everycall.us returned score of ${badcallscore})
exten => _.,n,GotoIf($["${badcallscore}" < "10"]?notbadcaller:badcaller)
exten => _.,n(badcaller),NoOp(Bad caller score above threshold, blocking call)
exten => _.,n,Congestion(20)
exten => _.,n,Macro(hangupcall,)
exten => _.,n(notbadcaller),NoOp(Bad caller score below threshold - continuing)
exten => h,1,Hangup()

The above may be a bit longer than it needs to be but keep in mind I'm still trying to debug it. The real issue seems to be the AGI call. I'm not doing it correctly, apparently, but I'm not sure what the correct format is. When a call comes in, I get an error like this (phone numbers have been munged for privacy reasons):

-- Executing [8005551212@from-trunk:1] NoOp("SIP/trunk1-08c47fa0", "Checking Everycall.us for bad caller") in new stack
-- Executing [8005551212@from-trunk:2] AGI("SIP/trunk1-08c47fa0", "check-everycall-us.agi|8005552368") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/check-everycall-us.agi
== check-everycall-us.agi|8005552368: Failed to execute '/var/lib/asterisk/agi-bin/check-everycall-us.agi': Exec format error
!!!!! NOTE THE ABOVE LINE !!!!!
-- Executing [8005551212@from-trunk:3] NoOp("SIP/trunk1-08c47fa0", "Everycall.us returned score of ") in new stack
-- Executing [8005551212@from-trunk:4] GotoIf("SIP/trunk1-08c47fa0", "1?notbadcaller:badcaller") in new stack
-- Goto (from-trunk,2124007595,8)
-- Executing [8005551212@from-trunk:8] NoOp("SIP/trunk-1-08c47fa0", "Bad caller score below threshold - continuing") in new stack

So everything is working EXCEPT the actual AGI call. I'm 99% sure it's just a syntax error but I've been looking at other examples and cannot figure out what I am doing wrong. I need to take a break from this so I'll throw what I've done so far out there, in case anyone spots the obvious flaw in my code. By the way, suggestions for making it shorter/more efficient are also appreciated!

Basildane
Basildane's picture
Try this (I don't have time to test it right now)

exten => _.,n,AGI(check-everycall-us.agi|${CALLERID(number)})

wiseoldowl
wiseoldowl's picture
Exact same error

Actually I tried the bar instead of the comma first, and got the same error. Nevertheless I tried it again, but still it doesn't work. I know, it looks like it SHOULD work, but it doesn't.

wiseoldowl
wiseoldowl's picture
SEEMS to work (BUT maybe not), but untested on "bad" caller

DON'T USE THIS - KEEP SCROLLING DOWN!!!

/share/var/lib/asterisk/agi-bin/check-everycall-us.agi contains this:

#!/bin/bash

BADCALLSCORE="0"
RETRIEVEDSCORE=`/usr/bin/curl -s -m 2 -A Mozilla/4.0 http://www.everycall.us/query\?${1}`
BADCALLSCORE=`echo ${RETRIEVEDSCORE} | grep score | sed -e 's/.*score=//' -e 's/ <br />//'`

if [ -z $BADCALLSCORE ]
then
	BADCALLSCORE=0
fi

echo "SET VARIABLE badcallscore ${BADCALLSCORE}"

The from-pstn-custom context added to /etc/asterisk/extensions_custom.conf:

[from-pstn-custom]
exten => _.,1,NoOp(Checking Everycall.us for bad caller)
exten => _.,n,AGI(check-everycall-us.agi|${CALLERID(number)})
exten => _.,n,NoOp(Everycall.us returned score of ${badcallscore})
exten => _.,n,GotoIf($["${badcallscore}" < "10"]?notbadcaller:badcaller)
exten => _.,n(badcaller),NoOp(Bad caller score above threshold - blocking call)
exten => _.,n,Playtones(busy)
exten => _.,n,Busy(20)
exten => _.,n,Macro(hangupcall,)
exten => _.,n(notbadcaller),NoOp(Bad caller score below threshold - continuing)
exten => h,1,Hangup()

Seems to work on "good" calls (passes them through) but don't know for sure that it will properly block bad ones, since I haven't received any yet! However the bigger issue is it's not returning to the proper point in the original context, resulting in incomplete calls.

Note: In the call to curl, the -m 2 option means to wait no more than two seconds for a response from Everycall.us.

The original (major) problem was apparently the lack of the #!/bin/bash, although I did catch a comma that should not have been there.

wiseoldowl
wiseoldowl's picture
DON'T use the above....

Until I or someone else figures out why it's not returning to the proper point in the original context - otherwise you may have missed calls!

wiseoldowl
wiseoldowl's picture
Okay, this is a bit more work but it doesn't miss the contexts

/var/lib/asterisk/agi-bin/check-everycall-us.agi still contains this:

#!/bin/bash

BADCALLSCORE="0"
RETRIEVEDSCORE=`/usr/bin/curl -s -m 2 -A Mozilla/4.0 http://www.everycall.us/query\?${1}`
BADCALLSCORE=`echo ${RETRIEVEDSCORE} | grep score | sed -e 's/.*score=//' -e 's/ <br />//'`

if [ -z $BADCALLSCORE ]
then
	BADCALLSCORE=0
fi

echo "SET VARIABLE badcallscore ${BADCALLSCORE}"

But instead of the context shown above in /etc/asterisk/extensions_custom.conf, use this (it may still be a bit more verbose than necessary) (EDIT: also see the next message for a possibly better alternative to this part):

[custom-check-everycall-us]
exten => _.,1,NoOp(Checking Everycall.us for bad caller)
exten => _.,n,AGI(check-everycall-us.agi|${CALLERID(number)})
exten => _.,n,NoOp(Everycall.us returned score of ${badcallscore})
exten => _.,n,GotoIf($[0${badcallscore} < 10]?notbadcaller)
exten => _.,n,NoOp(Bad caller score above threshold - blocking call)
exten => _.,n,Playtones(busy)
exten => _.,n,Busy(20)
exten => _.,n,Macro(hangupcall,)
exten => _.,n(notbadcaller),NoOp(Bad caller score below threshold - continuing)
exten => _.,n,Goto(from-trunk,${EXTEN},1)
exten => h,1,Macro(hangupcall,)

Now for what makes this more difficult - in every trunk you want to monitor, you need to go into the trunk setup and change the statement "context=from-trunk" to "context=custom-check-everycall-us" (without the quotes, of course). The good part about this method is you can choose to check incoming calls on some trunks but not others. The bad part is you have to change it in every trunk that you want to check. Also, if you are already using a custom context in a trunk for another reason, you'll have to change the jump from that context into this one rather than from-trunk (and make sure the EXTEN variable is set correctly). For example, the fix to get incoming DID on a ViaTalk line becomes:

[custom-from-viatalk]
exten => _.,1,Noop(Fix ViaTalk DID, set DTMF mode)
exten => _.,n,SIPDtmfMode(inband)
exten => _.,n,Set(EXTEN=your-viatalk-number)
exten => _.,n,Goto(custom-check-everycall-us,your-viatalk-number,1)
exten => h,1,Macro(hangupcall,)

EDIT: This should still be considered experimental code. Use it at your own risk, and please let us know how it works for you, particularly if you actually receive any calls that score high enough to get "the treatment." Also please watch for any "false positives" - keep in mind that I am NOT a programmer, so don't rely on my code without testing it for yourself!

wiseoldowl
wiseoldowl's picture
Another approach that's maybe not as "messy"

I don't really like terminating calls outside of the usual FreePBX dialplan - I never know if I am causing unintentional bad things to happen. So if you use this context in /etc/asterisk/extensions_custom.conf rather than the ones in the previous messages...

[custom-check-everycall-us]
exten => _.,1,NoOp(Checking Everycall.us for bad caller)
exten => _.,n,AGI(check-everycall-us.agi|${CALLERID(number)})
exten => _.,n,NoOp(Everycall.us returned score of ${badcallscore})
exten => _.,n,GotoIf($[0${badcallscore} < 10]?notbadcaller)
exten => _.,n,NoOp(Bad caller score above threshold - changing DID to 9999999999)
exten => _.,n,Goto(from-trunk,9999999999,1)
exten => _.,n(notbadcaller),NoOp(Bad caller score below threshold - continuing)
exten => _.,n,Goto(from-trunk,${EXTEN},1)
exten => h,1,Macro(hangupcall,)

... then you can create an inbound route with a DID of 9999999999 and then select whatever destination you like. I personally like the option "Terminate call: Play Ringtones to the caller until they hangup" but you can do whatever you like, including creating a special IVR just for those folks, if that's your bent. And you are terminating the call inside the FreePBX dialplan, which may have some implications for call detail recording, etc.

By the way, I don't really know what would be considered a high score at everycall.us - I picked 10 as the threshold, but that may require some tweaking once you have some actual experience with this.

Basildane
Basildane's picture
Attention EveryCall guy

You emailed me and I replied, but your email address does not work. "451 Temporary local problem"

This thread is great though. I like Wiseoldowl's idea of changing the DID on telemarketer calls. That never occurred to me.

everycall
everycall's picture
Hi guys I just spent some

Hi guys I just spent some time reading through the thread, seems like there has been much progress made.

Wiseoldowl- Thanks for all of your effort. Are you satisfied with the speed and performance? The reason that my email isn't working is that I moved to a dedicated server and haven't moved the email accounts yet. Minor details, sorry for that.

Anyhow, I would agree that a score of 10 or more is a good starting point to filter calls out.

I don't have a PBX system (as I think I stated earlier) so I'm curious how the interface with EveryCall.us is working....?

wiseoldowl
wiseoldowl's picture
Speed is great...

Well, the speed of the lookups seems to be nearly instantaneous, as far as I can tell... when I watch the CLI (a terminal window that lets me watch the calls progressing through the switch) I don't even notice any hesitation. However the only problem I have is that our system is basically a home system that is primarily used for "intercom" type service and although we do get occasional incoming calls, they primarily come from the same few numbers (people we know) and are always scored -1 (so far), which I assume means they are not in your list at all. Yes, occasionally someone else stumbles in, but that hasn't happened in the last couple of days (should have had this up before the election!).

So I am not really the best person to test this, but since I started this thread I at least wanted to put in the effort to try to get something working. But in the testing I have done, I have yet to see the lookup slow down the call flow. So I can say that I am very satisfied with the speed of the lookups, and as far as I can tell the code I wrote is working fine, but I do wish that others would test it and report back (sometimes the person who writes the code is not in any position to judge it objectively!).

Thanks for your effort in getting the interface up and running!

wiseoldowl
wiseoldowl's picture
Created a HowTo on this subject

For those that don't want to have to wander through this thread every time you want to set this up, try this page:

http://www.freepbx.org/support/documentation/howtos/how-to-automatically-reject-calls-from-telemarketers-and-other-junk-cal

Please let me know (in this thread) if you spot any errors or if anything isn't clear.

everycall
everycall's picture
Testing

Thanks for your feedback wiseoldowl, sounds like the performance is good which is nice to hear. It would be great if we could get a few more folks testing the interface to get some more feedback.

Also your how to thread is awesome, great work. I might need to look into purchasing a PBX system for my house just so I can use this interface!!!

wiseoldowl
wiseoldowl's picture
FreePBX is, uh, FREE...

You don't really need to purchase a PBX, just grab a PC that you are no longer using (as long as it is not older than dirt and has at least 512K memory it should work, though a meg is better, and it should probably have at least a 10 GB hard drive though some people have got by with a smaller one) and download the ISO file for any of the distributions you might like to try, burn that to a CD, and stick it in the CD-rom drive and boot it up, then follow the installation screens. You can have a working PBX in about an hour, though obviously there's a bit of a learning curve after that. Note this will destroy anything previously on the hard drive.

Distributions that you could try include AsteriskNow, Elastix, and PBX in a Flash. If you are a raw beginner you might prefer the last one because of the amount of online documentation, but I don't care for it because it makes some assumptions about how you will use your system that I don't necessarily agree with (and also the last time we tried it, it was really slow in completing calls for some unknown reason). We use Elastix right now, which has a great online e-book you can download called Elastix Without Tears (link is to PDF file), but AsteriskNow was not yet available (in its current incarnation) when we did that install, otherwise we might have tried it (the only thing I don't care for about Elastix is that they don't automatically let you get to the "unembedded" FreePBX, by default you are taken to their branded version which isn't always kept current with the current FreePBX version. But the "unembedded" FreePBX is only one click away, so it's usually not that big of a deal, and they do have some nice additions that come with their package). Steer clear of Trixbox, they have "forked" the FreePBX distribution and are doing their own thing.

You don't even need to buy any other equipment just to try it out - you can use softphones (I like the free edition of Zoiper, it is a cross-platform softphone) for testing. But eventually you may want to buy some SIP-based phones or, if money is tight, an unlocked Linksys PAP2-NA (note the NA suffix) adapter or two, into which you can plug regular analog phones (for business applications you can buy an adapter that supports 8 phones at once, but most businesses prefer the SIP-based phones - but you said you were going to try this in your home).

I will also say to beware of bad advice from certain people who lurk in the #elastix or #freepbx IRC channels, should you choose to go there. The people that come off sounding as though they know everything are often telling you how THEY would do things, which isn't necessarily the BEST way. Don't trust advice from anyone who isn't a FreePBX developer (and note that they don't spend much time on those IRC channels), at least not until you have lurked a while and figure out who knows what they are talking about and who is full of B.S., unless you like doing things the hard/expensive/wrong way! Smile

everycall
everycall's picture
Another thought I had was to

Another thought I had was to try and use a number spoofing service to try and replicate a junk call to confirm that it is handled correctly. I am not sure if there are any free services, but www.spoofcard.com is one that I see advertised... it might be worth a shot?

everycall
everycall's picture
Thanks for the intro to the

Thanks for the intro to the different PBX systems that are out there, I think I may have found a holiday project to work on ;). I assumed that I needed some specific hardware, not just a PC... I'll look into what you suggested over Christmas and see if I can get something running at my home.

This will actually be quite easy for me, I will pickup one of the Linksys adapters you suggested and plug my Panasonic wireless phone system into that, which is the only phone I have in the house... everything else is wireless stations.

Thanks again for your help, much appreciated.

everycall
everycall's picture
Next Step?

I want to gauge your interest in the value of being able to report spam calls that make it through to EveryCall.us directly from your FreePBX system. If it is possible to setup a code such as #555 which prompts the user to enter a small amount of data to report the call to EveryCall.us.

Here are a couple of my thoughts:

- #555 (or similar) would prompt the user with a couple of options:
- Report last call.
- Pick a category of the call (1 - Unknown, 2 - Telemarketing, etc.)
- Calls reported via #555 would automatically add the received call to the black list.
- Need function for inbound whitelist.
- With an EveryCall.us account, users could manage their FreePBX blacklist from the EveryCall.us user administration area. This would eliminate having to manage the blacklist through the PBX and would potentially allow administration of it from any computer.
- With an account, users could manage their whitelist also.
- With an account users to could log in to add more information like who called, add a call comment, etc.

What do you guys think? I imagine this would require significant effort on the FreePBX programming side of things, as it undoubtedly would on my side. However I could rather easily extend the EveryCall.us API to include this functionality.

Thoughts?

wiseoldowl
wiseoldowl's picture
Re: Next Step

While I think this would be a good idea, it's probably a bit beyond my coding abilities, but feel free to have at it. :) And there is another issue - in FreePBX the "last calling number" feature just doesn't seem to work right. If I pick up the phone and dial *69, it gives me "Information about your last call" - which is just wrong (it always reads an extension number that in fact is incapable of making an outgoing call to my extension). I don't know if anyone else has that problem, and maybe I should have filed a bug report on it but I was never sure if it was something I might have done (though I can't imagine what).

Another problem is that even if the "last call" thing did work right, there's always a chance another call may come in just as you pick up to dial the code, and that might be considered the "last call" by the time you finish dialing, resulting in the wrong number being reported.

I'm NOT throwing cold water on your idea, in fact I think it's a good one, but I am just saying that it appears for now you may not be able to trust the "last call" information stored by the system. Of course, I'm sure no one would mind if you actually discovered the bug and patched it. :)

(Is anyone else having problems with the last call not being properly reported when you dial *69, particularly with incoming calls from outside the system, that is, NOT from another extension? I know that this USED to work but for some reason it does not appear to be working properly in the FreePBX 2.4.0 branch included in the current Elastix distribution).

chrisphotonic
chrisphotonic's picture
It appears this is now BROKEN - everycall always returns -1

Did they turn off this service?

http://www.everycall.us/query?502-447-4497

kelvinmile
kelvinmile's picture
Hi, I was just browsing on

Hi,

I was just browsing on how to configure our FreePBX office phone systems in blocking some calls. I guess I found the answer here:

http://www.freepbx.org/support/documentation/howtos/how-to-automatically-reject-calls-from-telemarketers-and-other-junk-cal