A regular expression is the way to go. However I find them a pretty
confusing concept -- we didn't learn this stuff when I went to school many
decades ago. Never-the-less, I do use a couple of regular expressions in
my own privacy manager dialplan. Trial and error, and reading up on regular
expressions on the internet got me this far. Doesn't do exactly what you
want, but may help. Here is a section of my dialplan...
; First lookup number in asterisk DB for a Caller ID name.
exten =
s,n,Set(CALLERID(name)=${IF(${DB_EXISTS(cidname/${CALLERID(num)})}?${DB_RESULT}:${CALLERID(name)})})
; Now check against whitelist.
exten = s,n,GotoIf(${DB_EXISTS(whitelist/${CALLERID(num)})}?onwhitelist)
; Not on whitelist, Check against blacklist
exten = s,n,GotoIf(${DB_EXISTS(blacklist/${CALLERID(num)})}?onblacklist)
; Not on blacklist either, check Caller ID number for anonymous
conditions...
; If all zeros (with or without international dialing + sign) then caller
is anonymous.
exten = s,n,GotoIf($[${REGEX("^[+]?0+$" ${CALLERID(num)})} = 1]?unknown)
; If Caller ID is not a number at least 4 digits long (with or without +
sign)
; then caller is assumed to be anonymous. Alphabetic Caller ID "numbers"
; will therefore be considered anonymous. Common numbers for anonymous
callers
; are: "asterisk, unknown, anonymous, private, unavailable" which may be
upper, lower
; or mixed case. The regular expression catches everything non-numeric.
; If you want to permit a specific non-numeric Caller ID "number" add it to
whitelist.
exten = s,n,GotoIf($[${REGEX("^[+]?[0-9]{4\,}$" ${CALLERID(num)})} !=
1]?unknown)
; Caller ID looks good. Return to continue with dialplan processing.
exten = s,n(return),Return()
; Anonymous caller. Set Caller ID name to "Privacy Manager"...
exten = s,n(unknown),Set(CALLERID(name)="Privacy Manager")
On Tue, Feb 7, 2012 at 9:05 AM, Michael Keuter <[email protected]>wrote:
> Hi list,
>
> slightly offtopic, but does someone of you know, how we can
> blacklist/block incoming callers by their callerid prefix:
> e.g. blacklist/block all callers whose CLID starts with 12345 (e.g
> 12345-10, 12345-11 and so on)
> Exact (complete) matches can be easily stored in our "Blacklist Tab" but
> it doesn't work with prefixes/ranges.
>
> The closest thing I found is something about regular expressions here:
> http://www.voip-info.org/wiki/view/Asterisk+Expressions#Regularexpressions
>
> Michael
>
> http://www.mksolutions.info
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
> _______________________________________________
> Astlinux-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/astlinux-users
>
> Donations to support AstLinux are graciously accepted via PayPal to
> [email protected].
>
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Astlinux-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/astlinux-users
Donations to support AstLinux are graciously accepted via PayPal to
[email protected].