automation is the preferred option. Many apps are available. I prefer using MacroDroid , since it is free (upto 5 macros) and easy to learn.
You would need two macros for this
First macro would be to set a flag when the call is from an area code
Macro : Area code (name of macro as example)
Trigger:
Call incoming → Select number → abc* ( where abc is numeric area code you are interested in and * is wildcard to represent any number . You need to know / experiment here - in my case I needed to type +<2digit country code><2 digit state code>< * wild card >
to test with land line telephone
You would need another similar trigger for identifying mobile numbers from that area if / as applicable
Action: Set Macrodroid Variable → New variable → from area code ( name of flag, it can be anything ) of type Boolean to true
Constraints: Leave blank
In the next macro we reject the call when the twin conditions of calling number is a non contact and from that area code are met
Macro : Reject call (name of macro as example)
Trigger: Call incoming → Select Contact → Non contact
Action:
Call reject
add constraint to this action by long pressing action
Macrodroid Variable →from area code =
True (Macro only runs in this case, satisfying twin criteria conditions)
- Set Macrodroid Variable → from area code to false ( initialisation of flag )
Constraints: leave blank
I have only tested with landline available to me and it worked. Logic has been explained and you would need to configure with special attention to area codes of landline / mobile