[asterisk-users] Automating blacklists

Forrest Beck jonforrest.beck at gmail.com
Thu Oct 18 09:54:44 CDT 2007


How do you know that the call is a prank call, an not just someone  
that likes calling your company alot... ?

If you just want a database of callerid's to block, here is what I  
have used, I hope it helps some....

My SQL table looks has 4 columns id (autoincrement), callerid,  
blockenabled (to enable or disable the block), and notes.

[general]
realdb_host=localhost
realdb_user=asterisk
realdb_pass=password
realdb_db=asterisk_realtime

[pri-in]
; Conference Room Number
exten => 193,1,Answer()
exten => 193,2,Macro(checkblacklist,${CALLERID(num)})
exten => 193,3,GoTo(us-conference,s,1)

[macro-checkblacklist]
; This Macro will check the blacklist table to see if the callerid of  
the
; caller exist and blockenabled =1 (TRUE). If the callerid is listed,  
then
; tell the caller they have been blacklisted and politely HangUp()
;
; ${ARG1} = CallerID of incoming call
;
exten => s,1,MYSQL(Connect connid ${realdb_host} ${realdb_user} $ 
{realdb_pass} ${realdb_db})
exten => s,2,MYSQL(Query resultid ${connid} SELECT\ callerid\ from\  
blacklist\ where\ callerid=${ARG1} and blockenabled = 1)
exten => s,3,MYSQL(Fetch fetchid ${resultid} blacklistid)
exten => s,4,MYSQL(Clear ${resultid})
exten => s,5,MYSQL(Disconnect ${connid})
exten => s,6,GoToIf($["${blacklistid}" = ""]?7:fail,1)
exten => s,7,NoOp(Not blocked in Blacklist)
; If the callerid is listed in the database, then send to  
blacklistednumber
;  context
;
exten => fail,1,NoOp(${blacklistid})
exten => fail,2,GoTo(blacklistednumber,s,1)

[blacklistednumber]
; This is where a call will land if the macro-checkblacklist decides  
that
; the number should not be allowed to dial DA
exten => s,1,Wait(2)
exten => s,2,Playback(privacy-you-are-blacklisted)
exten => s,3,HangUp()


Forrest Beck
jonforrest.beck at gmail.com
www.shift8.biz



On Oct 18, 2007, at 10:25 AM, Lenz wrote:

>
> It's not technically complex to do - you can probably use the astdb  
> for
> that, or store all incoming numbers with timestamp in MySQL and run
> something like:
>
> SELECT count(*) > 5 AS blacklisted
>  FROM incoming_calls
> WHERE callerid = "12345"
> AND timestamp > DATE_SUB( NOW(), INTERVAL 15 MINUTE )
>
> you should be very well aware of the risks that can stem from such a
> program - in case of bugs, or anomalous situations, you might end up
> blacklisting somebody who actually needs to call in.
>
> I hope this helps
> l.
>
>
>
>
>
>
>
>
>
>
> On Thu, 18 Oct 2007 15:02:11 +0200, Brian Hutchinson
> <b.hutchman at gmail.com> wrote:
>
>> Hi,
>>
>> I've been reading all I can on Google (and Asterisk TFOT book)  
>> looking
>> for
>> ideas on how to implement an automated blacklist feature.
>>
>> I would like to automatically blacklist a incoming number based on
>> timestamp
>> and count information.
>>
>> For example, if I get a prank call from the same number 5 times  
>> within 15
>> minutes, I want my dialplan to automatically blacklist this number.
>>
>> Should I be looking at AGI to do something like this?
>>
>> Thanks for any ideas or pointers!
>
>
>
> -- 
> Loway Research - Home of QueueMetrics
> http://queuemetrics.com
>
> _______________________________________________
> --Bandwidth and Colocation Provided by http://www.api-digital.com--
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20071018/a70c51d2/attachment-0001.htm 


More information about the asterisk-users mailing list