Doing that for an open-ended phone number anywhere in the world seems like somebody's full time job to maintain. You'd probably need some database that ties together disparate data sources. Confidence in accuracy probably varies. The best source to use probably also changes.
I feel like somebody googling for a quick code snippet to do that in a single POST request should be aware of how challenging the problem space is. That would be a hint for joe random developer that they've come up with a bad idea and should work on something else. But I probably expect too much.