Blacklist help

Morning all,

I need to implement the blacklist feature in my asterisk 11.11 and hoping you all can double check if I have my config setup correctly.

My current setup for incoming calls:

[bell]
exten => 5096,1,Goto(s,1)

    exten => s,1,Answer
    exten => s,2,Background(WELCOME)
    exten => s,3,Set(TIMEOUT(digit)=4)
    exten => s,4,Set(TIMEOUT(response)=10)
    exten => s,5,WaitExten

    exten => 1,1,Directory(default)

    exten => 8,1,VoicemailMain()

For the Blacklist I have:

[bell]

exten => 5096,1,GotoIf(${DB_EXISTS(blacklist/${CALLERID(num)})}?blacklisted,s,1);
exten => 5096,1,Goto(s,1)

exten => s,1,Answer
exten =>s,2,Background(WELCOME)
exten =>s,3,Set(TIMEOUT(digit)=4)
exten =>s,4,Set(TIMEOUT(response)=10)
exten =>s,5,WaitExten

exten =>1,1,Directory(default)

exten =>8,1,Voicemail Main()

[blacklisted]
exten => s,1,Answer
exten => s,n,Wait(2)
exten => s,n,Playback(ss-noservice)
exten => s,n,Wait(1)
exten => s,n,Hangup

You did not supply your hardware configuration but my guess is that you have VOIP service with analog phone sets? Correct me if I guessed wrong. I am no expert at dialplans, but I see some potential issues. Your Blacklisted context may loop. Your last line is Hangup. There are 2 things with this line. Hangup is the older version and it should still be supported, but it has been replaced by Hangup(). My experience is that Hangup() will not disconnect an analog call. If it does not disconnect, what will happen is the call will respawn and start at the beginning of the blacklisted context looping until the caller hangs up. You will need to test to see if that is true with your configuration. One way around this is to route the call to a silent mailbox just before the Hangup(). I had this issue and the silent mailbox is how I corrected it. A side benefit of this is that some of the frustration heard in the silent mailbox is very entertaining.

If you are just blocking telephone numbers, Asterisk has the blacklist function built in. You could use the line
exten => 5096,1,GotoIf($[${BLACKLIST()}]?blacklisted,s,1)
The Blacklist() function searches the blacklist family in the ASTdb and if it finds a match will route the call to your blacklisted context. I have not done a scientific test, but from reading my logs while they were in debug mode it seems the BLACKLIST() function searches the ASTdb faster than DB_EXISTS(). This is only important if you will have a lot of phone numbers in the ASTdb.

If you are using your dialplan to block telemarketers you will find that adding numbers to the ASTdb will become a daily job because the spammers are constantly spoofing new numbers to circumvent conventional call blockers. I have been running Asterisk at my home for about 6 months now for the purpose of blocking telemarketers and have made refinements to my dialplan to make it more effective. In the beginning I was blocking about 25% of the spammers. In my most recent week I had 84 calls total. 73 calls were spammers, and of these 1 got through to ring my home phones. If you are interested in my dialplan logic, let me know. I will be happy to share it.

Unless you have overridden the autofallthrough setting in extensions.conf, the dialplan should not loop.

However, analogue FXO lines typically implement called party clearing, so you will have to wait for the caller to hangup, or for a network timeout, before the line can be re-used. The only ways round this are ISDN, or possibly the use of a line intended for PABX use. (SIP ITSPs interface with ISDN, so should have both party clearing.)

Pilot2

I have a PRI line for my phone service and VOIP phones. I noticed caller hitting the IVR and must have had a war dialer type app that was trying extensions and looping back to the welcome prompt. I would like to have my system answer the call, check for a blacklisted number and kick it if its in the DB.