[asterisk-users] block one number in incoming calls

Geoff Lane geoff at gjctech.co.uk
Mon Jan 14 09:48:37 CST 2013


On Monday, January 14, 2013, Salaheddine Elharit wrote:

> my problem i have a lot of calls coming  from this number
> (0666xxxxxx) and i want to block it.

You can either create an extension to handle it, or you can use 1.4's
blacklist feature to block calls from all unwanted numbers. Danny's
dealt with the specific extension. Here's some bits from my
extensions.conf to help you use the blacklist:

; main
exten => main,1,GotoIf($[${BLACKLIST()}]?banned,1)
exten => main,n,Dial(${rgMain},${RINGTIME},t)


; Blacklisted numbers
exten => banned,1,Playback(silence/2&im-sorry)
exten => banned,n,Playback(cannot-complete-as-dialed)
exten => banned,n,Playback(privacy-you-are-blacklisted)
exten => banned,n,Playback(goodbye)
exten => banned,n,Hangup()

Any number stored in the in the blacklist section of astdb with a
value of 1 gets dumped to the 'banned' extension and the caller hears,
"I'm sorry, your call cannot be completed as dialled. Your number is
blacklisted on this system" (or similar).

All that remains is to blacklist any number that you don't like. For
example, if your nemesis has CLI 06661234567, you'd enter:
  database put blacklist 06661234567 1
at the Asterisk CLI prompt.

HTH,

-- 
Geoff




More information about the asterisk-users mailing list