iOS 10 added "call blocking" as an app-type, which lets you choose apps which can filter phone calls for you. They can flag calls as possible-spam, or completely block them. (See [1] for Hiya's options screen, as an example.)
An "only ring for my friends" feature is sort of possible. You can keep your phone in "do not disturb" mode, and add people who you want to be able to call you to your "VIPs" list to let them through. That's a fair bit of manual management, though, which is a pain.
I don't think it's possible to make a call-blocker app which functions as a whitelist, sadly, because I think this is like their browser content blockers and operates as the app providing a list of blocked numbers for privacy reasons.