[asterisk-users] block certain numbers

A J Stiles asterisk_list at earthshod.co.uk
Mon Jun 17 09:09:08 CDT 2013


On Monday 17 June 2013, binary dreamer wrote:
> i am using asterisk's internal database to create a phonebook. i was
> thinking to create something similar for the blocking, but i got stuck on
> how to block the numbers.

Well, once you've worked out whether the caller is welcome or not, then you 
need to dial your phone if the caller is allowed; or just play a suitable 
message and then Hangup() if they aren't.

exten => s,1,NoOp(Incoming call from ${CALLERID(num)})
exten => s,2,System(check_ban_db ${CALLERID(num)})
; goes to 3 if system cmd exited OK or 103 if exited non-zero
exten => s,3,Dial(${MY_PHONE})
exten => s,4,Hangup()
; step 103 is where we deal with unwelcome callers
exten => s,103,Playback(f-off)
exten => s,104,Hangup()

You just need to make sure that you have a suitable message saved in 
/var/lib/asterisk/sounds/f-off.wav .

-- 
AJS

Answers come *after* questions.



More information about the asterisk-users mailing list