• News
  • Idefisk
  • Tools
  • Tutorials
  • Forum
  • Reviews
  • VoIP Providers
  • Archives
  • Gallery
ZOIPER SIP softphone
Back to Tutorials

6.1.2.35. LookupBlacklist (dialplan application)

1. LookupBlacklist - this application allows you to check a number in the blacklist database.

NOTE: This application is valid for Asterisk version 1.0.9 and above.

 


Syntax:

LookupBlacklist() ;There are no arguments for this application

 


Purpose and usage

The purpose of this application is to check whether the Caller ID is within the Asterisk’s blacklist database or not. If the number is in the database, the next executed extension will be the one with priority n+101(where n is the priority of the current extension). If it is not, then the next executed extension will be the one with priority n+1. If there is no Caller ID received, then the LookupBlacklist has no effect.

You can use this application to restrict the access to your system. The undesired numbers could be entered into the blacklist database. Thanks to this application you can decide what to do with the numbers into the blacklist. For example you can send them a text message, to inform them that they are not wanted or that their access is cut off.

 


Prerequisites

To use this application you need a working Asterisk PBX with registered users in iax.conf, sip.conf or mgcp.conf(It depends on which protocol you would like to use) and made extensions.

To see how the application works we recommend to use our IAX softphone Idefisk. You can download it from here. Please also read our tutorial to learn how to configure it to work with Asterisk PBX.

 


Asterisk PBX configurations

NOTE: This is only an example of what for you can use this application. Of course you can use it and for other things.


iax.conf Configurations

We need three registered user in iax.conf file. This is because we are going to use the IAX2 protocol. If you want to use other protocol such as SIP or MGCP, you have to do the configurations below respectively in sip.conf or mgcp.conf.

iaxthreeusers.jpg

So, we have registered the users user1, anatoliy and ivan

Type=friend means that this user can make and receive calls. Host=dynamic means that the IP is not static but dynamic through a DHCP server. Allow=all means that the line which this user will use, could support all audio codecs. Context=test - this shows that this user is working with the extensions in this context of the configuration file extensions.conf.


Database Configurations

We have to put the desired Caller ID in the Asterisk’s blacklist database.

You can achieve this either by using the DBput application or by entering the command database put manually on the CLI

In our example, we will use the manual configuration. So, we will type the command database put blacklist test 1.

databaselook1.jpg

Here, the word blacklist is the desired family in the database. The key will be the word test. Actually test is the Caller ID of the user, which access we want to forbid. The digit 1 is the value. In this case, it does not matter what would be the value. The value could be any other digit.

You can verify whether the key(test) is entered in the database by typing the command database show or database show blacklist.

databaselook2.jpg

extensions.conf Configurations

extlookupblack.jpg

On the picture above you can see our extensions.conf file.

In our example, when somebody dials 1010, the first executed extension will be the LookupBlacklist one. It will check immediately whether the Caller ID is in the Asterisk’s blacklist database.

If the Caller ID is test, i.e. it is in the blacklist, then the next executed extension will be the with priority n+101. In our example this is the extension with priority 102. It contains the SendText application. This application will send a text message to the caller. The message in our example is: Your access to our system is forbidden! Please do not try to connect to our system again!. Then a Hangup application will be executed and the line will be closed.

If the Caller ID is different from test, the next executed extension will be the one with priority n+1. In our example this extension will run the Dial application. Thanks to it the call will be connected to the user user1 through the IAX2 channel.

If no Caller ID is received through the channel, the LookupBlacklist will have no effect and the next executed extension will be again the one with priority n+1 and with the Dial application.

If you want to remove a key(Caller ID) from the family blacklist of the Asterisk’s database, you can use either the DBdel application or the database del command on the CLI

For example:

database del blacklist test 1 ;where test is the key in the family blacklist with value 1

 


2. Screenshots of what you can see on your Idefisk and on the CLI of the Asterisk PBX

ide_lookupblack_00.jpg

clilookupblack.jpg

 


3. Additional information

For more information about extensions.conf you can check here.
For more information about iax.conf you can check here.

This application is tested with our IAX softphone Idefisk. You can download it from here. For more information about this softphone please read our tutorial.

If you would like to test this application with the SIP channel you can read our tutorials about the SIP Softphones to learn how to configure them to work with Asterisk PBX

 


4. Similar dialplan applications

LookupCIDName()

 

 
User Comments
Cipriano L. Hilario (clhilario at imatech dot com dot ph)
08 October 2008 10:06:26
Hello can I used the blacklist so that all the numbers is blacklisted and only the numbers on the blacklist can be dial on my asterisk
JiaZheng (jiazheng at juniper dot net)
15 December 2006 18:19:30
there is an optional argument for LookupBlacklist(). 'j' - jump to priority n+101.
Shawn (no at email dot com)
24 December 2005 09:50:42
You have to add a (j) to the end of LookupBlacklist in order for asterisk 1.2+ to actually make the jump. Like such:

exten => s,1,LookupBlacklist(j)
Omar (omarnina at gmail dot com)
16 December 2005 20:17:30
Doesn't work in asterisk 1.2.1, this is my script

exten => s,1,LookupBlacklist()
exten => s,2,Macro(internosdial,SIP/ger00-lpz)
exten => s,102,Hangup
 
Add Comment
Name:
Email:
Comment:
In order to prevent automatic posting on our website, we kindly request you to type in the number you see in the picture below.
Image Verification:
 

Latest Headlines:

  • T.38 faxing with Zoiper 2.15 is now easier than ever
    section: voip software
  • Asterisk 1.4.21 Released
    section: Asterisk
  • Asterisk 1.4.20 Released
    section: Asterisk
  • Asterisk 1.4.20-rc2 Released
    section: Asterisk
  • Asterisk 1.4.20-rc1 Now Available
    section: Asterisk
  • News Archives (older news)

Latest Tutorials:

  • VMAuthenticate (dialplan application)
    added 01/Mar/2008 15:57
  • Siptronic ST-530
    added 06/Nov/2007 17:57
  • Siemens C455 IP hardphone
    added 05/Nov/2007 10:24
  • Zoiper
    added 22/Oct/2007 17:53
  • Grandstream GXP-2020
    added 15/Oct/2007 18:17

Latest Comments:

  • i agry ur sip dialar ...
    tutorial: Idefisk - IAX2 softphone
  • It happened that a Dog <a href="http://w...
    section: voip hardware
  • It happened that a Dog <a href="http://w...
    section: voip hardware
  • thinks i installation <A href=\"http:...
    tutorial: Installation on CentOS
  • uh, why not just use the asterisk packag...
    tutorial: Installation on Debian
 
contact us at: support@asteriskguru.com - asterisKGuru.com © all rights reserved   |   *asterisk is registered trademark of © Digium™