[Asterisk-Users] Re: 24. Privacy Manager (Andi Strain)

Joe McConnaughey kenn10 at comcast.net
Thu Aug 11 13:47:59 MST 2005


Andi -

I have experienced the same issue you mention and gotten no reply as to a 
way to fix it.  I finally implemented "blacklist" into my Asterisk and added 
"Anonymous", "anonymous", "unknown", "Unknown", etc., into my blacklist 
file.  When those come in with an IP address instead of a phone number but 
have no real name, they get the blacklist treatment.  The way I coded it, I 
also catch people coming out of Privacy manager with fake numbers by adding 
common fake numbers (1111111111, 0000000000, 1234567890, etc.) to the 
blacklist file.

I used the info at this link: 
http://www.carrel.org/articles/2005/07/30/calling-features-with-asterisk to 
get started with blacklist.  The documentation has an error on the "remove 
from blacklist" portion.  It should have a "DBdel" instead of "DBput" in the 
statement.  In my version below, I add (and delete) the number with and 
without a "1" in front of it since calls don't always come in as a 10-digit 
number.  This is designed for use in the USA or other North American 
Numbering Plan areas.

Here's an example of whta I have in my extensions.conf (on Asterisk at Home I 
put it in extensions_custom.conf):


exten => *60,1,Goto(blacklist-add,s,1)
exten => *80,1,Goto(blacklist-remove,s,1)

---------------------------------------------------
[blacklist-add]
exten=s,1,Background(enter-num-blacklist)
exten=s,2,Background(or)
exten=s,3,Background(to-blklist-last-caller)
exten=s,4,Background(pound)
exten=s,5,DigitTimeout(2)
exten=s,6,ResponseTimeout(15)
exten=#,1,Dbget(lastcaller=CALLTRACE/${CALLERIDNUM})
exten=#,2,SayDigits(${lastcaller})
exten=#,3,DBput(blacklist/${lastcaller}=1)
exten=#,4,DBput(blacklist/1${lastcaller}=1)
exten=#,5,Playback(num-was-successfully)
exten=#,6,Playback(added)
exten=#,7,Hangup
exten=_NXXNXXXXXX,1,DBput(blacklist/${EXTEN}=1)
exten=_NXXNXXXXXX,2,SayDigits(${EXTEN})
exten=_NXXNXXXXXX,3,Playback(num-was-successfully)
exten=_NXXNXXXXXX,4,Playback(added)
exten=_NXXNXXXXXX,5,Hangup

[blacklist-remove]
exten=s,1,Background(enter-num-rmv-blklist)
exten=s,2,DigitTimeout(2)
exten=s,3,ResponseTimeout(15)
exten=_XXXXXXXXXX,1,DBdel(blacklist/${EXTEN})
exten=_XXXXXXXXXX,2,DBdel(blacklist/1${EXTEN})
exten=_XXXXXXXXXX,3,SayDigits(${EXTEN})
exten=_XXXXXXXXXX,4,Playback(num-was-successfully)
exten=_XXXXXXXXXX,5,Playback(removed)
exten=_XXXXXXXXXX,6,Hangup

[blacklisted]
exten => s,1,Answer
exten => s,2,Wait(2)
exten => s,3,Zapateller
exten => s,4,Playback(not-taking-your-call)
exten => s,5,Wait(2)
exten => s,6,Zapateller
exten => s,7,Playback(not-taking-your-call)
exten => s,8,Wait(2)
exten => s,9,Hangup

And then to make it work in the dial subroutines, I use this (again from my 
Asterisk at Home extensions.conf file.)

[macro-exten-vm]
include => blacklisted
exten => s,1,Setvar(FROMCONTEXT=exten-vm)
exten => s,2,GotoIfTime(${REGTIME}|${REGDAYS}|*|*?4)
exten => s,3,Goto(vm,_s-.,1)
exten => s,4,Macro(record-enable,${ARG2},IN)
exten => s,5,SetCIDName(${CALLERIDNAME})
exten => s,6,PrivacyManager  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
 >>>>>>>>>>>>>>>>>>>>>>
exten => s,7,LookupBlacklist  ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Relavent 
Code for Blacklist >>
exten => s,108,Goto(blacklisted,s,1) ; 
<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>
exten => s,8,Macro(dial,${RINGTIMER},${DIAL_OPTIONS},${ARG2})
exten => s,9,GotoIf($[${ARG1} = novm]?s-${DIALSTATUS},1) ; no voicemail in 
use for this extension
exten => s,10,NoOp(Sending to Voicemail box ${ARG1})
exten => s,11,Answer()
exten => s,12,Wait(1)
exten => s,13,Macro(vm,${ARG1},${DIALSTATUS})
exten => s-BUSY,1,NoOp(Extension is reporting BUSY and has no Voicemail)
exten => s-BUSY,2,Playtones(busy)
exten => s-BUSY,3,Busy()
exten => s-BUSY,4,Wait(60)
exten => s-BUSY,5,NoOp()
exten => _s-.,1,Congestion()

----- Original Message ----- 
From: <asterisk-users-request at lists.digium.com>
To: <asterisk-users at lists.digium.com>
Sent: Thursday, August 11, 2005 3:59 PM
Subject: Asterisk-Users Digest, Vol 13, Issue 81
> Message: 24
> Date: Thu, 11 Aug 2005 20:48:14 +0100
> From: "Andi Strain" <atspublic at dsl.pipex.com>
> Subject: [Asterisk-Users] Privacy Manager
> To: <Asterisk-Users at lists.digium.com>
> Message-ID: <20050811194816.C18EEE00024B at galaxy.systems.pipex.net>
> Content-Type: text/plain; charset="us-ascii"
>
> I'm trying to get privacy manager to kick in if an anonymous call is
> received on a Sip channel.  Unfortunately it seems to think a caller id is
> present even when it isn't.  I've searched the Wiki, but the documentation
> is fairly limited.  Has anybody any experience with getting this working?
>
> Here is the output of the CLI
>
> -- Executing NoOp("SIP/6950069-1f8a", ""anonymous" <213.166.5.134>") in 
> new stack
>  -- Executing PrivacyManager("SIP/6950069-1f8a", "") in new stack
>  -- CallerID Present: Skipping

> Any suggestions would be appreciated.
>
> Andi
> 




More information about the asterisk-users mailing list