I discovered Twilio a couple years ago when beginning to build my app, Alertyoself. Twilio is a cloud communication platform that handles the difficulty for you. (This is not a paid advertisement, I just really like their service)
Recently, I played with their new verification service, and I admit it is pretty nice. To be honest, I built a much simpler version in my own API for Alertyoself! This is a really short post, and I guess the purpose of it is self justification to keep moving forward because I “came up” with my own process before a powerful online service did! ; )
UPDATE: Ok, so I decided to give a little more detail about what I did… I created a database with with a user table, that included a column for phone number, verification number, and a boolean for phone verified with default value of False.
In the app, the user would enter a phone number and it would be saved to the database. They would then receive a text with a randomly generated number that would also be saved. That random number would be put into a verification field in the app, and compared to the one that was saved. If they matched, the verification number would be deleted, and the boolean updated to True. The True value would allow the app to create alerts!