Google has lib for this:
Google's common Java, C++ and JavaScript library for parsing, formatting, and validating international phone numbers.
https://github.com/googlei18n/libphonenumber
It does best effort, I do think there must be cases that are not handled as this is by no means an easy task. Let users input numbers and letters, remove letters later with code.