[Asterisk-Users] Howto correctly identify the telephone area code?
Christopher Vance
christopher at nu.org
Thu Nov 4 05:12:31 MST 2004
On Thu, Nov 04, 2004 at 09:57:20AM -0200, Rodrigo P. Telles wrote:
>I've been troubles to find a rule/method to correctly identify the telephone
>area code of an international number for billing purposes.
>I tried to follow RFC specifications (E.164) but I realised that there are a lot
>of exceptions to complete an international phone number.
>Does anyone have an idea/rule to correctly identify it?
Last time I looked at E.164 (I can't remember if the Blue, Red, or
Yellow one was the latest at the time), it only defined country codes,
and multi-country zones like 1. Codes within countries is entirely up
to local arrangement within the country or zone. Some countries have
no area codes within them, while others have gazillions with varyings
lengths and other painful bits.
If you mean that you only want to know the country or zone, then it's
not too hard. You still need to know which 2-digit prefixes need 3
digits to determine country, though. (Like East Germany's code was
divided between a bunch of other places in Europe.) I'm sure there
are lists around, but your easiest algorithm is likely to be a lookup
table.
If you actually want to know area code (as in, within country), you'll
be pushing uphill for a long time...
--
Christopher Vance
More information about the asterisk-users
mailing list