So I know this is a fairly simple question, but I can't seem to find a good answer to it. I have a DID which is getting hit fairly hard (or at least for me, about 1-3 calls per day) with telemarketers from non 1-8XX numbers. However there are only a handful of numbers that call day in and day out. So naturally I would just like to block them so my phone doesn't ring and I don't get billed for a call.
I'm looking to send a SIP/404 or some other non-answer response-- not send them to voicemail or another recording. I don't really care about logging or anything like that, I just would like to be able to add (or remove) a number fairly easily so I can cut down on unnecessary calls.
Everything I find seems to be either too complex or too simple (only one blocked number) and I can't find a good medium. Hopefully someone else will have better insight! I am using Asterisk 1.6. Thank you!
How are your programming skills? I'm not sure about all the details, but I guess from your question:
Have a look at the code in the link kaptk2 mentioned.
And then have a look at the DB() functions of asterisk: Asterisk function DB(). You would do a lookup of each incoming caller-id as database key and you can maintain database keys from the asterisk commandline.
Short example of DB management:
You could access the value with something like:
The best way to 'kill' the call would be to use the Hangup() function. Or if you insist on a 404 code: send it to a non-existing extension.
I've done something similar and like the other submitter, I used a database. Instead of using the built int DB functionality, I used cmd MySQL. This was so I could write a web page that interacts with the same DB AND my DBA could do cross DB selects between this "Directory" table and the MySQL CDR.
In my example, I setup a table with 4 fields.
id
(auto_increment int),number
(the phone number),name
(The name of user),ban
(an int that defaults to 0). The example does 2 things, 1- it looks up name from the DB and sets that as the caller id (Since our POTS line doesn't communicate that) 2- It looks up to see ifban
is set to 1, and blocks the call.After this you'd have your [mainmenu] and [wedontlikeyou]. The later is your ban, it could be a simple hangup, error message, what ever you want. My preference is Congestion() since that tends to make people think the phone number is out of service.