Skip to content

Asterisk blacklist

CentOS, Asterisk 12.0.0

Get content of BlackList:

asterisk*CLI> database show blacklist
/blacklist/0671111111                             : 1
/blacklist/0672222222                             : 1
2 results found.

Add the phone number to BlackList:

database put blacklist 0673333333 1

Remove the phone number from BlackList:

database del blacklist 0673333333

Use in /etc/asterisk/extensions.conf

[someplace]
; CO=8
exten => _0441238899,1,NoOp()
exten => _0441238899,n,GotoIf($[${BLACKLIST()}=1]?blacklist)
exten => _0441238899,n,Dial(SIP/user1&SIP/user2,18,Tt)
exten => _0441238899,n(blacklist),Hangup()
exten => _0441238899,n,Goto(menu-office,s,1)