Using LookupBlackList() Application

At times we get those annoying callers. They usually end up being a waste of our time and resources. So what can you do? You can block them from calling in. Asterisk has an application in place to make this an easy task. It’s called: LookupBlackList()

It’s actually an older application. But in trying to use it, I didn’t see many examples for using it, or the options that can be used with it. And for good reason. It seems it’s depreciated, in favor of using the GotoIf application. However, I did find it will available with Asterisk 1.4.x so I thought I would give a quick writeup, in the event someone wants to use it.   I’ll also be posting about it’s limitations, and soon will post an article with my quick ‘solution’ to the problems I faced with LookupBlackList app.  So let’s dive right in.

First thing is first. We need to setup our table of callers to block. It’s going to be using AstDB for this. So from the Asterisk CLi:


database put blacklist <blockednumber> 1
database put blacklist 4801115432 1
database put blacklist John Smith 1

Okay, so the tables are set. Once we have the rest of our dialplan setup, any calls coming from the callerid ’4801115432′ or from ‘John Smith’ will be blocked.

Okay, so let’s switch over to our dialplan. I’ll assume that you are using extensions.conf for your dialplans.

exten => 18003337123,1,Answer()
exten => 18003337123,2,LookupBlacklist(j)
exten => 18003337123,3,Queue(CSR1)

exten => 18003337123,103,Playback(not-taking-your-call)
exten => 18003337123,104,Playback(vm-goodbye)
exten => 18003337123,105,Hangup()

To explain the above, 18003337123 is of course, my incoming phone number. First it answers the call, and then runs the LookupBlacklist app. There’s only one option for this app that I could fine – the ‘j’ option, which will jump the dialplan if the callerid is found in the blacklist database. Otherwise, it will take the caller into a queue that I have created. When it comes to jumping, it will always jump within the same context, and extension. It just jumps priorities. It will add 101 priority to whatever the current priority is. So in this case: priority 2 + 101 = 103 as the starting priority. Here I can tell Asterisk want to do with the blocked caller. In the above example, I’m playing an audio file that informs them that I’m not accepting their call, it says goodbye, and then hangs up.



If you are like me, you hate recording your own messages. Luckily there’s already one there. The default Asterisk install doesn’t have it in the sounds directory. But I found one in an older Asterisk Sounds zip. Here’s the file I used above in gsm format. Download it here.

Disadvantages to this application is that it doesn’t allow you to block callers on a per DID bases. What I mean by that, is this… Say you have multiple phone numbers coming into your PBX. You want to allow John Smith to call this phone number, but not another number coming into the PBX. This isn’t so easy with this application – in fact it doesn’t have this ability. What to do this? Check back shortly for a followup article of my little ‘alternative’ solution.


One Response to “Using LookupBlackList() Application”

Leave a Reply