I use this script also to send notofication to "Message Send Protocol" Unix server and then to Windows clients. E-mail me if you want more info. This part utilizes "netnotify" project, which is working for me, but not yet released under GPL.
Please mail any additions or updates to allcodes.txt to firstname.lastname@example.org
It is possible to use this script to lookup number in white pages, however it's quite complicated (whitepage databases are usually very very big). Various databases are circulating as torrents, I am aware of these: Das Telefonbuch (Germany, SQL), Australian phonebook 2005 (CSV), Czech phones 2002 (CSV).