Anyone ever used script to automatically block "junk" calls?

We’ve been having trouble for some time now with a particular “junk caller”/telemarketer that always leaves the same voicemail message (along the lines of “it is urgent you call about your credit card debt”) but that seems to change caller ID numbers every couple of weeks. Whenever we enter the caller ID number into one of the “junk call” tracking sites, invariably several other people have complained about that same number. The sites I am referring to are:

What’s interesting about the last site is that although it’s the least flashy of the bunch, it offers something that apparently none of the others offer - an Asterisk AGI script to do a lookup on incoming numbers to see if they appear in their database. If the score is above a minimum score (10 by default, but you can change it) it will return with variable ${spammer} set to “yes” and also report the call to the database.

I was just wondering if anyone has ever used this script with FreePBX and if so, if you could tell me how you hooked it into the FreePBX call flow. It should only be run on incoming calls with a valid NANP format number (never on internal calls). It looks to me like it is an extremely simple script (most of the action is in a curl command) but what I don’t know is how to get FreePBX to call it on an incoming call, and I just wondered if anyone else had ever done this. I’m guessing that you could change the incoming context from from-trunk to some kind of custom context in extensions-custom.conf, call the .agi from within the custom context and then if it’s not a junk call send it on to from-trunk, but that seems like a rather inelegant way to do it (if it would even work) and I’m wondering if there is a better way.

If anyone wants to take a look at the script in question it can be found on the page at (under the “scripts” heading); a direct link to the “junk lookup” script is - note I’m not married to the notion of using if someone has a script that will work with one or more of the other services. My only real concern is that the lookup be fast so as not to unduly delay call progress. Anyone ever tried using one of these services for real-time lookups?