View Single Post
Posts: 21 | Thanked: 42 times | Joined on Jan 2010
#1
I've just uploaded to extras-devel my package called "callerid", which can automatically look phone numbers up on the web to find who they belong to. It primarily uses XML configuration files to find out which web server to use for any particular country code and area code. Once the name has been looked up, it's displayed as a Hildon banner. (Yes, you need a working Internet connection for this to work. Also note that in many cases, 2G doesn't allow you to use voice and data simultaneously, so if you're using 2G and don't have WiFi, you may be in trouble...)

Added Mar 13: As a fallback, it can show an approximate geographical location based on the phone number itself. For that to work, the program must have information about your country's numbering plan (in the form of a text file, described below).

Currently, you can use it in immediate mode (callerid <number> from a shell) or in daemon mode (callerid --daemon). In daemon mode, it sits and waits for incoming calls, and then looks up the number of the caller. I haven't yet researched a way to make the daemon start on boot. And there's not yet any GUI.

I'd like people to 1) test it and let me know whether it works, 2) create XML files that I can put into future versions so that the program will be able to look up phone numbers in your country.

Configuration instructions: The program looks in /opt/callerid for a regions.xml to find the country, and then in <country>.xml for details. (I have files for two countries there already.) If you need to use different services for different area codes (which probably at least North America will), you can add area codes like this:

<config>
<area code="555" id="west"/>
<area code="666" id="east"/>
<directory id="west">...</directory>
<directory id="east">...</directory>
</config>

Otherwise you can keep it simple:
<config>
<directory>...</directory>
</config>

Tags which can be used inside <directory> are:
<prefix> = remove prefix before lookup (optional)
<query> = HTTP query to make; the phone number, without prefixes, is appended to the end of the URL
<name> = how to find the name in the returned HTML
<address> = how to find the address in the returned HTML
Sub-tags of name and address are:
<find> = find a tag, further processing only works on what's inside this tag. You can use tag="" to find a particular type of tag, and/or you can search on particular attributes, such as class. You can have more than one <find> in sequence if you need to descend into a hierarchy (though maybe there's still work to be done here).
<delete> = once you're inside the tag that has the name in it, you can use this to delete tags for ads etc. Otherwise works same way as <find>

Added Mar 13: Numbering plan file: If the phone numbers in your country is related to where you live, you can create a <country>.txt file (or if your country is very big, <country>_<firstdigit>.txt file) with details about the numbering plan. The file format is a simple tab-delimited file, with the first field being the number prefix (e.g., area code and exchange), and the second field being the location. If several entries match (e.g. both 4578 and 457 would match the number 4578313), then the first match is used.

Once you've created working config files for your country, you could post them so it can be included in future versions. (Perhaps I'll also add new features later, like address display, offline directories, call blocking, and whatnot...)

There are probably bugs (for example, the area code feature has never been tested). If possible, give me the terminal output when things don't work...

Updated Mar 13: Added address tag and numbering plan information

Last edited by ovekaaven; 2011-03-13 at 22:35.
 

The Following 29 Users Say Thank You to ovekaaven For This Useful Post: