contacts: lookup on incoming call

Dale Maggee antisol at internode.on.net
Sun Aug 31 13:07:07 CEST 2008


Rui Miguel Silva Seabra wrote:
> On Sun, Aug 31, 2008 at 05:33:00PM +1000, roguemoko at roguewrt.org wrote:
>   
>> Rui Miguel Silva Seabra wrote:
>>     
>>> On Fri, Aug 29, 2008 at 01:46:48PM +0100, Tom Yates wrote:
>>>       
>>>> but when i'm in the UK, and a UK call comes in, it shows up as just having 
>>>> a local number (eg 07971 123456).
>>>>
>>>> these two numbers are functionally the same, but the contacts-lookup that 
>>>> happens won't identify the caller as fred friend unless i edit the 
>>>> contacts entry to say 07971... rather than +447971... .
>>>>         
>>> Simple matching algorithm: match from right to left to numbers on
>>> agenda.
>>>       
>> Prepend call notification with 'likely to be ...' in the case of 
>> anything but an exact match.
>>     

I did a bit of thinking about how numbers could be compared, what rules 
apply etc, and I've had a bit of an Idea:

(note: I have no Idea how any of this stuff works outside australia, so 
these thoughts may or may not apply internationally)

what if the software normalised all numbers to be international format 
when doing this lookup, so that when the phone is dealing with numbers 
internally "0414 123 456" and "+614123456" appear the same to it? this 
would eliminate the need for fuzzy matches where "0413 123 456" and 
"0414 123 456" might be interpreted as the same number

This could be done (for most numbers) by removing the leading zero and 
adding "+<country code>"
for example, the international equivalent of the Australian mobile 
number "0414 123 456" is "+61 414 123 456"
so, to convert from the "regular" format to the international format, 
all you need to do is remove the leading zero and prepend "+<country 
code>". also removing any spaces from the numbers would be necessary for 
when doing this type of stuff.

This assumes that the phone knows the country code of whatever country 
you're in. This may be a software setting, or perhaps there's some 
esoteric way of querying the network to find this out? I wonder how 
other phones determine this?

There are a couple of exceptions to this rule, and I'm not sure  of the 
best way to handle these:

For landlines, area codes are optional, i.e you can dial "03 9123 456" 
or just "9123 456" if you're in the same area code (again, I suspect 
that you can probably query the network for your current area code, 
otherwise how are all the other phones doing this [I don't have to dial 
"03" on my nokia]). so you would need some way of attaching the "03" to 
the "9123..." number, then internationalising it. A simple rule which 
would work here in AU is "if it doesn't start with 0, prepend '+<country 
code><area code minus first character>'", however there are exceptions 
to this as well - "13" numbers (i.e "13 23 33"), "1300", "1800", and 
"1900" numbers ("1300 123 456", "1800 123 456", "1900 696 969". I'm not 
sure how/if these are converted to an international format, I suspect 
you may not be able to dial them from overseas, probably the best way to 
check for them is by looking at the prefix, "13", "1800", or "1900". 
Then there's "000" (our emergency number).

It gets complicated pretty quickly, but it's not like it's hugely 
complex and difficult - you just need to understand the rules. Another 
potential issue is the differences between different countries - perhaps 
a different set of rules would need to apply for each country, meaning 
that this would be part of or derived from your localisation settings, 
along with timezone and number/date formats.

perhaps it would be possible to contact somebody at a phone network and 
find out exactly what the rules are? I know a couple of people at 
telstra, so it might be worth me sending an email or two.

does anybody know if / how it's possible to query the GSM network for 
your current country / area code?
any comments no whether these rules hold any weight at all internationally?






More information about the community mailing list