Blacklisting wildcard?

Is it possible to blacklist a whole exchange via blacklisting, or is this something I would have to do in the dialplan?

Say I want to block everything from 214-555-xxxx to send to the blacklist? I’ve noticed a lot of spammers are using my local exchange to spoof their CallerID with, and I don’t know of anyone else on my own exchange that wants to call me so I may as well block it.

exten=>_x./_214555xxxx,1,Execif( application for block) or exten=>_x./_214555xxxx,1,Goto(blocking-context)

So would something like this work and still use my blacklist?

exten => _214555xxxx,1,Goto(blacklisted)
exten => s,2,GotoIf(${DB_EXISTS(blacklist/${CALLERID(num)})}?blacklisted,s,1)
exten => s,3,Dial(SIP/301,12)
exten => s,4,VoiceMail(301@internal,u)
exten => s,5,Hangup()

Or do I have to put the _x./ in front?

Like this

exten => s/_214555xxxx,1,Goto(blacklisted,s,1)
exten => s,1,NoOP()
exten => s,n,GotoIf(${DB_EXISTS(blacklist/${CALLERID(num)})}?blacklisted,s,1)
exten => s,n,Dial(SIP/301,12)
exten => s,n,VoiceMail(301@internal,u)
exten => s,n,Hangup

On an inbound context this will match any number recived and then it will evaluate the caller pattern match 214555xxxx