PNR – The black magic behind phone number recognition
You might have noticed that the Skype Web Toolbars are getting better at recognizing phone numbers in web pages. We have done a lot of work in this area and now we are (almost) ready to share it with the world!
Do you need to recognize or clean up phone numbers to make Skype phone calls? PNR is your friend!
The PNR is a standard COM-component that can be called from any programming language that supports such components. If you are in this devzone I am sure you know what I am talking about. A free re-usable component!
What can it do
So far we have seen these major uses for the PNR:
1. Finding phone numbers in text or html. If you supply it with a (long or short) body of text or html it will return a collection of all the phone numbers found in the text.
2. Cleaning up existing phone numbers, making them into proper international dialling numbers.
3. List of countries in 7 languages. If you need to have a list of country names localized (and maybe even grouped by part of the world) the PNR has all that built in.
4. Country Selector dialog – if you want to let the user specify which country he/she is in – the PNR has a nice Skype-blue world map to select the country from.
5. You could actually place it on a web server also – to help you make phone numbers into the proper international dialling format before storing them into a database. The component doesn’t have any dependencies so you can basically install it on any machine running Windows. (Yes, we plan to port it also)
Let’s say our favorite devzone blogger, Lester has a customer database with phone numbers in it:
1. Customers are mainly in the UK and don’t have the country code filled out.
2. Some customers are in other countries and they do have the country field filled out.
3. Phone numbers can be either in local format or in international dialling format (starting with + or 00)
In this scenario Lester can use the PNR to clean up the phone numbers and let his users call via SkypeOut. He would supply the current number for example 0151 5311777 and GB for United Kingdom.
The PNR component would then return +441515311777. This might not look so impressive but consider that the PNR has (correctly) removed the 0. The PNR knows the full list of such city codes prefixes for every country in the world. Also it knows when to remove them and when to leave them in (in Italy for example).
Now all that Lester needs to do, is to add a nice looking Skype icon next to each phone number and make it a nice user-friendly skype:+441515311777 link.
![Nice Skype Button](http://blogs.skype.com/templates/skype_buttons/i/buttons/call_blue_transparent_34x34.png)
Call to action!
Do you have any kind of application development going on that has phone numbers in it? I am sure this will make adding Skype dialling much easier and more reliable for you. Let us know your progress, or add your tools to the Extras gallery!!
The current PNR version is still in BETA – along with the Skype Web Toolbars, so there are still some issues and of course, you use it at your own peril. However, it is quite stable and useful, in my opinion.
If you install one of the Web Toolbars you can find the SPhoneParser.dll under the Skype program files directory.