Rodrigo P. Telles
2004-Nov-04 04:57 UTC
[Asterisk-Users] Howto correctly identify the telephone area code?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Folks, 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? Thanks in advance. - -- ===========================================Rodrigo P. Telles <telles@devel-it.com.br> Project Manager Devel-IT - http://www.devel-it.com.br TDKOM Group ===========================================-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQFBihkgiLK8unYgEMQRApuDAJsGg/ZNg2fX9FAyM7vRz9zcpkbbdACeNWeX L3T8VAVSKncG39TV7+Pka1A=POIh -----END PGP SIGNATURE-----
Christopher Vance
2004-Nov-04 05:12 UTC
[Asterisk-Users] Howto correctly identify the telephone area code?
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