How to cannonicate numbers in international form

Tilman Baumann tilman at
Thu Jul 17 18:05:01 CEST 2008

Update: I summarized in the wiki.

Please comment everyone... ;)

Joachim Breitner wrote:
> Hi,
> Am Donnerstag, den 17.07.2008, 16:35 +0200 schrieb Tilman Baumann:
>> Number normalisation is really no big magic.
> Right, my question was rather asking how and where we want to implement
> it.

Oh, sorry. I did not want to make this look like a direct reply to you.
I just noticed that this topic popped up any times. And somehow never 
got solved.
It felt to me like it is time to put an end to this and fix it once and 
for all.
I remember argueing over different dial plans for Brazil and so one. But 
i'm sure that is all no issue. :)

>>          my $PAPrefix = publicAccessPrefix;  # No PBX. But usually 0
>>          my $IDPrefix = internationalPrefix; # 00
>>          my $LDPrefix = longDistancePrefix;  # 0
>>          my $Country = countryCode; # 49
>>          my $Area    = areaCode;    # 761
>>          my $PBX     = pbxCode;     # external number of your PBX
> Hmm, I didn’t think of the areaCode, because, as far as I know, everyone
> here always add the areaCode when using a cell phone. Is that different
> in other places?

Probably not. I just took the code we had here.
This code has a much broader approach than we might need for mobile numbers.

>> - GSM works with international numbers. If a call comes in it will be 
>> always formatted in international form.
>> - The user uses only one dial plan. (Anything else would be a usability 
>> disaster but doable)
> I’m not sure about the second part: What happens when I use my regular
> proprietary German phone in France, and dial 0172/12345? Will that get a
> +49 (for Germany) or a +33 (for France) prepended? 
For all i now he will dial a French number.
But i think i heard of some agreements between roaming providers to 
preserver the dial rules abroad. I'm not sure they exist. But certainly 
not universal.

Dialing local numbers abroad is definitely something the user has to 
exepect to fail.
> And is this done by
> the phone or or by the GSM provider?
Provider. (pretty sure)
> What do users expect?

I think the main problem is that they expect nothing. *g*

I would say it depends very much on what you do.
Dialing via Dialer should dial locally. That is maybe not what a user 
expects right away, but this is what he _has_ to expect. *g*

Where the real screwup starts is with numbers from the address book. You 
just do not expect them to fail abroad. And there is no sane reason why 
anyone wants them to do so.

>> Second usage:
>> Transform every number after user put it in his phone book. Only save 
>> internationalized numbers if possible.
>> This would condition the user to use international form and acknowledge 
>> its existence and significance.
>> This should be done in some user visible way. So he sees what happens 
>> with his number.
> I oppose the second way: The user should be free to type in good looking
> phone numbers such as 0172/123 456 in his address book, and no automatic
> mangling of these entries should happen.

Well i strongly oppose the idea of local numbers on mobile networks in 
Awareness is the first fix for that.

As long as we break no numbers no harm is done.

I would at least like this to be configurable. ;)

And for good looking. You can of course revert this dialplan. If you 
like i can provide you with the counter method we use for that.

If you really thing numbers look better this way... I don't think so.

> I’d also think that such
> mangling would cause problems with syncronization tools.
Maybe. Not sure.

But if so, as long as the change was correct. We just 'fix' the numers 
whereever they get synced. *duck and run*

>> If we find no location based or SIM based approach that works, we could 
>> ask the user on first entry of any number after his local dialing habits.
>> If a user is not capable of answering this question we just ignore 
>> number transformation. This would not screw usability too much. The user 
>> would just not be able to have the benefit of a seamless usage of phone 
>> numbers.
> Hmm, it would be good if we would not have to do that. Not everyone
> knows his own international prefix, and some users, who never use
> numbers outside their country, will not want to bother. And as long as
> we do not try to modify numbers, but only compare them smartly (ok,
> indeed not fuzzily), the code does not need to know the international
> prefix.

Well, at lest we should never try to screw numbers without knowing 
exactly what the dial rules are.

What about a two stage process?
We try smart matching even with guessed and unsure dial rules.
But we ask the user to provide a accurate dial rule if he likes so. And 
at this point we could present him a checkbox with says 'Force 
international form in Address book'.

Drucken Sie diese Mail bitte nur auf Recyclingpapier aus.
Please print this mail only on recycled paper.

More information about the devel mailing list