How to BLOCK all 800/888 numbers

Hi guys,

I’m getting bombarded with telemarketer calls at home these days and I want to block them all.

I did some searching around here, but couldn’t find the info I needed to make this work. I’m also an asterisk newb with minimal knowledge of the scripting involved.

My setup right now is very simple…

My DID is forwarded to the DEFAULT context and it looks like this:

exten => xxxxxxxxxx,1,SetAccount(xxxxxxxxxx)
exten => xxxxxxxxxx,2,Ringing()
exten => xxxxxxxxxx,3,Answer()
exten => xxxxxxxxxx,4,Dial(SIP/Rob_Home,22,r)
exten => xxxxxxxxxx,5,Voicemail(uxxxxxxxxxx@home)
exten => xxxxxxxxxx,6,Hangup()

How can I stuff a line or 2 in here that sends all 1-800-, 1-888-, 800-, 1-866 etc to a dead end??



If you are in the US you can just sign up for the Do Not Call List.

You can also try this (I wrote this for some one that is in the US)
exten => xxxxxxxxxx,1,GotoIf($["${CALLERID(num):0:3}" = “800”]?20:2)
exten => xxxxxxxxxx,2,GotoIf($["${CALLERID(num):0:3}" = “888”]?20:3)
exten => xxxxxxxxxx,3,GotoIf($["${CALLERID(num):0:3}" = “877”]?20:4)
exten => xxxxxxxxxx,4,GotoIf($["${CALLERID(num):0:3}" = “866”]?20:5)
exten => xxxxxxxxxx,5,GotoIf($["${CALLERID(num):0:4}" = “1800”]?20:6)
exten => xxxxxxxxxx,6,GotoIf($["${CALLERID(num):0:4}" = “1888”]?20:7)
exten => xxxxxxxxxx,7,GotoIf($["${CALLERID(num):0:4}" = “1877”]?20:8)
exten => xxxxxxxxxx,8,GotoIf($["${CALLERID(num):0:4}" = “1866”]?20:9)
exten => xxxxxxxxxx,9,SetAccount(xxxxxxxxxx)
exten => xxxxxxxxxx,11,Dial(SIP/Rob_Home,22,r)
exten => xxxxxxxxxx,12,Voicemail(uxxxxxxxxxx@home)
exten => xxxxxxxxxx,14,Hangup
exten => xxxxxxxxxx,20,Congestion
Exten => XXXXXXXXXX,21,Hangup

Every line checks the CID to see if it starts with a Toll Free prefix. If it does then send it to priority 20 which plays a busy signal. If not keep going through all the lines until it makes it to your phone. I have removed the ringing line since the r in your dial command will do that. I have also removed the answer Command since asterisk will send answer supervision once you pick up the phone.

EDIT: The board seems to replace 8 ) with a smiley face. Argh !!!

to do this plz set at your incoming call context where ur call land fisrt

exten => XXXXXXXXXX/800xxxxxxx,1,Congestion
exten => XXXXXXXXXX/800xxxxxxx,1,plzayback(plz do not call)
exten => XXXXXXXXXX,1,Answer()
then your further call processing
here second line to recive ur other call other than 800 or 866 number

try among this 2 it will work for you.

Thanks a lot guys! I’m going to try this now and hopefully will not hear the phone ringing in the morning (and all day) anymore!!

I’m in Canada so not sure the donotcall list applies.


You could add a little menu that discourage telemarketers to continue. Something like:

Thank you for calling me, if you are a telemarketer please press 1 otherwise press 2.

exten => s,1,Answer()
exten => s,n,Background(telemarketers_1_rest_2)
exten => 1,1,Playback(please_do_not_call_me_again)
exten => 2,1,Dial(${INTERNAL_PHONES},30,t)

You must be very blockheaded as a telemarketeer to press 2 and try seriously to start a promo talk.

Alright, I’ve had about 20 telemarker calls since I put in this new code… any ideas why it’s not working???

I checked /var/log/asterisk and messages didn’t have anything interesting in there… is there any diagnostics I can watch when a rogue caller comes in?



are they calling from an unknown location, if so try the zapateler application

at the beginning of your dialplan pass this to your incoming first

exten => s,1,Zapateller(nocallerid)

In your case, like this

exten => xxxxxxxxxx,1,SetAccount(xxxxxxxxxx)
exten => xxxxxxxxxx,2,Zapateller(nocallerid)
exten => xxxxxxxxxx,3,Ringing()
exten => xxxxxxxxxx,4,Answer()
exten => xxxxxxxxxx,5,Dial(SIP/Rob_Home,22,r)
exten => xxxxxxxxxx,6,Voicemail(uxxxxxxxxxx@home)
exten => xxxxxxxxxx,7,Hangup()

Is Zapateller something that is preinstalled? Asterisk doesn’t give an error when I reload my config… do I need to download it?

I added that line, but nothing changed … just got a call from a telemarketer. I can’t believe I can’t block these f**kers!!!

Is there some other approach I can take?