Block all calls from area code unless in Contacts I need a way to block all calls from an area code, unless the number is in my contact list. Anyone know of a way to do that? 

I found plenty of apps that can block by area code, but they'll also block any of my contacts if they have that area code. I could add each of my contacts to a whitelist, but then I have to remember to do that each time I add a contact.
beeshyams' solution did not work for me, but i was able to modify it and get it working. The issue that i encountered was that the "call incoming" trigger only happens once when you first receive the call. this means if you check for a boolean triggered by the incoming call, it won't be set yet.

first thing i did was find out what format i needed for the phone number by creating a very simple macro:

trigger: call incoming -&gt; contacts -&gt; any number
action: logging -&gt; log event -&gt; call number


i checked the logs and saw that the number was +12345678900. (im in the us)

next i deleted that macro and made the following:



T: call incoming (+1234*)
A: set variable (areacode: True)




T: call incoming (non contact)
A: set variable (noncon: True)




we are going to use the variables being set as our trigger to reject the call. these variables seemed to be set in a random/inconsistent order, so i just made two triggers, that way it didn't matter which was set first. this is a very janky solution, but it works.

T: macrodroid variable change (areacode = True)
A: call reject, set variable (areacode: False), set variable (noncon: False)
C: macrodroid variable (noncon = True)




T: macrodroid variable change (noncon = True)
A: call reject, set variable (areacode: False), set variable (noncon: False)
C: macrodroid variable (areacode = True)




finally, we need a way to reset the variables if our call blocking macros haven't been triggered. the best solution i found was to clear them after a call was completed or missed. 

T: call missed (any number), call ended (any number),
A: call set variable (areacode: False), set variable (noncon: False)




i'm sure there is probably a more elegant solution, but this is at least working for me. (hooray, no more scam calls at 6am!) luckily there are exactly 5 free macros in the app, and 5 in my solution. if you have multiple area codes you need to block, you can put them all into the one macro with a separate trigger for each i think. (didn't test this)

all of this pain could be solved if you could have a trigger be caused by two conditions being met. that would mean we would only need a single macro, but from what i can tell, this isn't possible. unfortunately the constraints don't let you access the incoming call information so that doesn't work either. maybe there is a better app.