I am using the default Asterisk database blacklist to keep a record of unwanted callers. I am using the command line prompt, "database put blacklist 3035551212 “John Smith” to add numbers.
My question is: Is there a way to add a “wildcard” character to block out an entire area code or exchange???
I.E. I have a telemarketing company that calls me all the time and they call from a different telephone number every time. They are always calling from 303-238-xxxx (the area code and prefix are always the same). How would I enter a phone number to block out the entire 303-238 area?
I’m pretty sure that pattern matching doesn’t work.
Why not set up another list called ‘blackarea’ or similar and then try matching the first 6 digits of the caller’s number? Perhaps something like this:
[code]exten => s,n,Set(NUM=${CALLERID(num)})
exten => s,n,GotoIf($[${LEN(${NUM})} < 6]?shortid) ; jump if we have a short caller ID
; lookup full number
exten => s,n,Set(TRY=${DB(blacklist/${NUM})})
exten => s,n,GotoIf($[${LEN(${TRY})} > 0]?blacklisted) ; jump if code blacklisted
; lookup area code
exten => s,n,Set(NUM=${NUM:0:6})
exten => s,n,Set(TRY=${DB(blackarea/${NUM})})
exten => s,n,GotoIf($[${LEN(${TRY})} > 0]?blacklisted) ; jump if area blacklisted
[/code]