login | register
Tue 09 of Feb, 2010 [20:52 UTC]

voip-info.org

Discuss [5] History

Asterisk cmd LookupBlacklist

Created by: oej,Last modification on Fri 12 of Oct, 2007 [07:33 UTC] by chandave

Synopsis:

 Look up Caller*ID name/number from blacklist database

Description:

 LookupBlacklist

Looks up the Caller*ID number on the active channel in the Asterisk database (family 'blacklist'). If the number is found, and if there exists a priority n + 101, where 'n' is the priority of the current instance, then the channel will be setup to continue at that priority level.
Otherwise, it returns 0. Does nothing if no Caller*ID was received on the channel.

Example:

 
Sample Section for extensions.conf

[incoming]
exten => s,1,LookupBlacklist
exten => s,2,Dial(SIP/1234,15)
exten => s,3,Answer
exten => s,4,Wait(1)
exten => s,6,Voicemail(u1)
exten => s,7,Hangup
exten => s,102,Goto(blacklisted,s,1)


[blacklisted]
exten => s,1,Answer
exten => s,2,Wait(1)
exten => s,3,Zapateller
exten => s,4,Zapateller
exten => s,5,Playback(ss-noservice)
exten => s,6,Hangup

Note: On asterisk 1.2+ you must add (j) to the end, in order for it to actually make the priority jump. Like such:

exten => s,1,LookupBlacklist(j)

otherwise, it will just continue onto the next priority.


To insert a number into the Black list from the CLI

database put blacklist <name/number> 1

eg. database put blacklist 0123456789 1

Stores 0123456789 as a blackilsted CallerID

To delete a number from the blacklist using the CLI
database del blacklist <name/number>

eg. database del blacklist 0123456789

Deletes 0123456789 from the blacklist database


Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ


Comments

Comments Filter
222

333${CALLERIDNUM} also deprecated.

by Zhadnost, Thursday 05 of June, 2008 [09:25:56 UTC]
The below example should read as follows:

exten => s,1,GotoIf(${DB_EXISTS(blacklist/${CALLERID(number)})}?blacklisted,s,1) ; If the number portion of the callerid is matched to blacklist, jump to context blacklisted, ext s, priority 1
exten => s,2,NoOp( Not Blacklisted )
exten => s,3,Dial(SIP/.....)

Since ${CALLERIDNUM} was marked as deprecated in 1.4.0 and has been removed by 1.6.0.

If the caller withholds their number, the above produces an error (unless you make CALLERID(number) equal something on condition that it is empty in the first place). This error does not interrupt the call flow so can be ignored.

I can verify that this works in 1.6.0-beta9.
222

333${CALLERIDNUM} empty

by vshasm, Monday 01 of October, 2007 [11:55:47 UTC]
GotoIf($${DB(blacklist/${CALLERID(name)})}?blacklisted,s,1)

after first $ in GotoIf( need use [ and second ] after last }.


222

333${CALLERIDNUM} empty

by vshasm, Monday 01 of October, 2007 [11:48:58 UTC]
On Asterisk 1.4.11-BRIstuffed-0.4.0-test4 command exten => s,1,GotoIf(${DB_EXISTS(blacklist/${CALLERIDNUM})}?blacklisted,s,1) don't work, because ${CALLERIDNUM} empty. Working examples:

exten => s,1,LookupBlacklist(j)
or
exten => s,1,GotoIf($${DB(blacklist/${CALLERID(name)})}?blacklisted,s,1)
or
exten => s,1,GotoIf($ ${BLACKLIST()} ?blacklisted,s,1)
or
exten => s,1,GotoIf($ ${DB_EXISTS(blacklist/${CALLERID(name)}) ?blacklist,s,1)
222

333asterisk 1.4.4 tweaks

by lingolep, Friday 15 of June, 2007 [07:51:41 UTC]
for those following bromonts comment please keep in mind that asterisk 1.4.4 has since been released, which uses ${CALLERID(num)} instead of ${CALLERIDNUM}




222

333LookupBlacklist Deprecated

by bromont, Wednesday 30 of August, 2006 [18:44:56 UTC]

Looks like LookupBlacklist has been deprecated and is being replaced by the ${BLACKLIST()} function.

I've begun replacing my dialplan with DB_EXISTS() instead. Note that with DB_EXISTS you can match *any*
database family: blacklist, friendlist, whitelist etc.

exten => s,1,GotoIf(${DB_EXISTS(blacklist/${CALLERIDNUM})}?blacklisted,s,1) ; If callerid is matched to blacklist, jump to context blacklisted, ext 1, priority 1
exten => s,2,NoOp( Not Blacklisted )
exten => s,3,Dial(SIP/.....)