D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Asterisk - Blacklist wildcard by area code?

 

Hi Gordon

Your REGEX sample works a treat.

Many thanks

Regards

Sam Graham

[office]
exten => 123456,1,Answer
exten => 123456,2,Verbose(2 - DB cidname lookup =##${DB(cidname/${CALLERID(num)})}## no = ##${CALLERID(num)}## name = ##${CALLERID(name)}## ${STRFTIME(${EPOCH},,%Y_%m_%d-%H:%M:%S)})
; Check for a Caller ID
exten => 123456,3,GotoIf($[$[${LEN(${CALLERID(num)}} > 0] & $["${CALLERID(name)}" != "Unknown"]]?4:6)
exten => 123456,4,Verbose(4 - Number > 0 and = ##${CALLERID(num)}## )
exten => 123456,5,Goto(14) ; then goto next test
; Unknown spam callers
exten => 123456,6,Verbose(6 - Caller ID wasn't shown - get rid of)
exten => 123456,7,Wait(1)
exten => 123456,8,Playback(privacy-screening-unidentified-calls)
exten => 123456,9,Wait(1)
exten => 123456,10,Playback(please-try-again&with&your&telephone-number&information&activated)
exten => 123456,11,Wait(1)
exten => 123456,12,Playback(goodbye)
exten => 123456,13,Hangup
; Check Area Codes 0843, 0844
exten => 123456,14,GotoIf($[${REGEX("^90843" ${CALLERID(num)})}=1]?15:17); then goto next test
exten => 123456,15,Verbose(15 - 0843 Area code found calling on 123456 - getting rid of)
exten => 123456,16,Goto(19)
exten => 123456,17,GotoIf($[${REGEX("^90844" ${CALLERID(num)})}=1]?18:27)
exten => 123456,18,Verbose(18 - 0844 Area code found calling on 123456 - getting rid of)
exten => 123456,19,Answer
exten => 123456,20,Wait(1)
exten => 123456,21,Playback(privacy-you-are-blacklisted&number-not-answering)
exten => 123456,22,Wait(1)
exten => 123456,23,Playback(privacy-stop-calling-not-welcome2)
exten => 123456,24,Wait(1)
exten => 123456,25,Playback(goodbye)
exten => 123456,26,Hangup
exten => 123456,27,Verbose(27 - Pest Area code - Checked to be OK)
exten => 123456,28,LookupBlacklist(j)
;
; Check if in DB for custom name tag match
exten => 123456,29,GotoIf($[${LEN(${DB(cidname/${CALLERID(num)}))} > 0]?30:33)
exten => 123456,30,Verbose(30 - If > 0 LEN = ##${LEN(${CALLERID(num)}}## was true - and has a value of ##${CALLERID(num)}## dbLEN = ##$[${LEN(${DB(cidname/${CALLERID(num)}))} > 0]## set value = ##EXT-${DB(cidname/${CALLERID(num)})}##)
exten => 123456,31,Set(CALLERID(name)=EXT-${DB(cidname/${CALLERID(num)})})
; else custom name tag found in DB goto final process
exten => 123456,32,Goto(35)
exten => 123456,33,Verbose(33 - If > 0 LEN = ##${LEN(${CALLERID(num)}}## was false - and has a value of ##${CALLERID(num)}## dbLEN = ##$[${LEN(${DB(cidname/${CALLERID(num)}))} > 0]##)
exten => 123456,34,Set(CALLERID(name)=EXT-${CALLERID(num)})
exten => 123456,35,Verbose(35 - BT ISDN Incoming for office); Testing for caller ID complete - process the call
exten => 123456,36,Set(_ALERT_INFO=<Classic-2>)
exten => 123456,37,Dial(SIP/201,10,tT)
exten => 123456,38,Dial(SIP/200&SIP/201&SIP/202&SIP/203&SIP/206&SIP/209,5,tT) ;Then ring some other phones for 5 seconds
exten => 123456,39,Dial(SIP/200&SIP/201&SIP/202&SIP/203&SIP/204&SIP/205&SIP/206&SIP/207&SIP/209&SIP/212&SIP/213&SIP/214&SIP/215&SIP/216&SIP/218&SIP/219&SIP/221,15,tT) ;Then ring all other phones for 15 seconds
exten => 123456,40,VoiceMail(201@internal) ;Failing that, go to X's voicemail
exten => 123456,41,Hangup
;
;
; This is for calls in the blacklist thing
exten => 123456,129,Verbose(Blacklisted caller ${CALLERIDNUM})
exten => 123456,130,Playback(thanks-for-calling-today)
exten => 123456,131,wait(1)
exten => 123456,132,Playback(privacy-if-sales-call-contact-in-writing)
exten => 123456,133,Hangup
;



From: sam_grabham@xxxxxxxxxxx
To: list@xxxxxxxxxxxxx
Subject: RE: [LUG] Asterisk - Blacklist wildcard by area code?
Date: Wed, 11 Jan 2012 16:15:50 +0000

Hi

Thanks Gordon

It was in bound sales pest phone calls, and the number had been TPS also.

Many thanks will give it a try.

Regards

Sam Grabham.

> Date: Wed, 11 Jan 2012 15:36:56 +0000
> From: gordon+dcglug@xxxxxxxxxx
> To: list@xxxxxxxxxxxxx
> Subject: Re: [LUG] Asterisk - Blacklist wildcard by area code?
>
> On Tue, 10 Jan 2012, Sam Grabham wrote:
>
> >
> > Hi
> >
> > Does anyone know if its possible to blacklist area codes via a wild card
> > such as 0843 & 0844?
> >
> > ie "database put blacklist 90843 1" and "database put blacklist 90844 1"
> >
> > does the number need a wild-card identifier? such as * # % to suffix the
> > number.
> >
> > Will look into to this, but for speed i thought i would ask the list
> > in-case someone has already done this.
>
> Do you mean to stop people dialing out, or dialling in?
>
> I've never used the built-in blacklist stuff, but I'm not sure it supports
> wildcards.
>
>
> For inbound stuff, just direct it to an extension that won't answer
>
> exten => _0844.,1,Noop(Bah)
> exten => _0844.,n,Hangup()
>
> To stop people dialling out, you can do it the same way, or just use an if
> statemnt.
>
> I do it based on other criteria, but it's all just code at the end of the
> day:
>
> ; Access Level 1 check:
> ; No 09x or 070x numbers (premium rate)
>
> exten => s,n(checkLevel1),Noop(Macro-dialOut: Level 1 access check - All but 09 and 070 ...)
> exten => s,n,Set(DIGIT=${ARG1:1:1})
> exten => s,n,GotoIf($[${DIGIT}=9]?noAccess)
> exten => s,n,Set(DIGIT=${ARG1:1:2})
> exten => s,n,GotoIf($[${DIGIT}=70]?noAccess:dialOutOK)
>
> (this is inside a macro which is called when people dial 0 for an outside
> line - you are using 9 - how quaint ;-)
>
> Gordon
>
> --
> The Mailing List for the Devon & Cornwall LUG
> http://mailman.dclug.org.uk/listinfo/list
> FAQ: http://www.dcglug.org.uk/listfaq
-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq