Using an extension to block a caller

I have a couple of SIP phones and use callcentric. I get a lot of junk calls. I'd like to implement the following feature and would like some suggestions on how to do this:

Once I get a junk call, I typically hang up. I want to dial some number (like *23 or something) and I'd like the last number that was received to be put in a database. Any future call from that number will be directed to VM or a busy tone.

I'd appreciate some pointers on how I'd go about doing this.. I prefer an open source solution.


Solution 1:

We use a phone system called Swyx (which is similar in functionality to Asterisk, but runs on Windows).

As a part of the call route scripts, we can execute external scripts. We just wrote a very small script on our shitlist extension that puts the phone number of the caller into a special table that gets scanned when a call comes in in our automatic call routing script. It then plays a pre-recorded announcement the caller.

I don't know if Asterisk has something similar, but I'm guessing that it should be able to execute an external script as a part of a call route.

Solution 2:

First hit for "asterisk blacklist" on the Googletubes sends me to http://www.voip-info.org/wiki/view/Asterisk+func+BLACKLIST, which suggests that functionality similar to what you're after is built-in. And, in fact, another few seconds of reading brings me to http://www.jackenhack.com/adding-blacklist-to-an-asteriskhome-pbx-voip-server/ -- which, while it's purportedly out-of-date with regards to current versions of Asterisk, should get you 90+% of the way to your solution.