More phones should just come with whitelist support. Where calls will automatically go to voice mail if it isn't on your list. I have this on my phone due to lots of wrong numbers and it works great.
Android I'm fairly sure has some relevant things built in. On my Motorola I can set a do not disturb time overnight where only alarms and calls from selected people will come through (and some other options and combinations). This is android 7 settings > sound > do not disturb.
There seem to be a lot of apps for whitelisting generally.
I'm late to the party, sorry. But I use an Android app called Extreme Call Blocker. Nothing gets through that I don't explicitly allow to get through. And in the case of unknown/anonymous callers, they don't even get my voicemail: There's a setting to pick up the phone and immediately hang up for whichever callers you want. It's basically the equivalent of just not feeding the trolls. It only costs a couple of bucks, but it's easily the best five bucks (or whatever) I've ever spent for an app.
iOS 10 doesn't seem offer a built-in Contacts whitelist feature, but iOS does expose an API allowing third-party applications to filter-out incoming calls and messages: https://support.apple.com/en-us/HT207099 - someone could easily write an app that would use your Contacts as a whitelist, assuming one doesn't already exist.
For iOS, i leave DND mode on full time. Contacts that are Favorited are serve as the whitelist, are not screened by DND. Any second call in 3 minutes will override DND instead of being directed to voicemail.
I have a contact on my phone named "Spam" which currently has about 25 numbers associated with it. I have it set to "Route to Voicemail" (option in the Google Contacts app).