If like me you get tons of telemarketers calls, there’s an easy way to get rid of them with a quick Asterisk hack. The following Asterisk configuration snippet will immediately send any hidden caller ID (99% telemarketers, and I have a general policy of not picking up the phone for hidden caller ID anyway) to a holding music making them waste money and time…

This snippet is to place into the extension.conf file :

[incoming] ; incoming calls exten => s,1,GotoIf($["${CALLERID(NUM)}" = "anonymous"] ? 10) exten => s,2,Dial(SIP/phone1&SIP/phone2,10) exten => s,3,Congestion() exten => s,4,Hangup() exten => s,10,Answer exten => s,11,Wait(1) exten => s,12,MusicOnHold(default) exten => s,13,Hangup

This block will check for the NUMber information of the Caller ID and if it is “anonymous”, it will send it to the step 10 which will pick up the call and start the holding music. If the Caller ID is not “anonymous”, it will ring 2 SIP phones for 10 secs, and if no one picks those, send it to congestion mode.

That’s all !

Edit : On a second thought, I think I’ll change that to have Asterisk to pick up the call and let the caller leave a message. That’s still going to catch those telemarketers (waste time & money), while giving a chance to legit callers to speak their message.