E164 is an ITU recommendation for passing number information. This is especially helpfull when dealing with VoiceOverIP and distinguishing between national and international calling.
Basically what the E164 recommendation says is that a telephone number should be passed in the format of <country code prefix><normal local number with the national access code removed> to a maximum length of 15 digits.
So for example a New Zealand 0800 number such as 0800 000 000 would be displayed as 64800000000. (the first 0 is the New Zealand national access code). This numbering format is commonly prefixed by a + in emails and on websites to indicate the local users international access code should be used to dial that number. ie. +64800000000, which would be dialled in NZ with 0064800000000.
In the ISDN world a national or international call can be identified by the TON (Type of Number) identifier (which should be set by the TelCo).
Due to the SIP protocol not providing a standard means of identifying if an incoming call is from a national source or an international source there needs to be a way of identifying this from the Caller-ID of the callee.
If we received a Caller-ID for the callee as 99740000 for example at a first glance we would recognize that as a Auckland NZ number. However, if we get a Caller-ID for example of 8001234567, you'd expect that to be a NZ 0800 number, however 8001234567 also matches the UIFN range of International Free Phone numbers. There's no way to distinguish between the two in that format, and what we have here is a number space clash between the International country calling code prefixes and a national number prefix.
Q: How about if we prefix it with a 0?
A: This would work for local calls only, since you'd only get one 0 for International numbers as well. Sure you could use the length of the numbers afterwards to try and match it, but see below for problems with that approach.
Q: How about if we use the length of a number to distinguish between number space clashes
A: Again this works in most cases, for example in the 800 range described earlier the UIFN number is 800 with 8 additional digits, whilst the NZ 800 numbers have an additional 5-7 digits (there is a clash here between the Number Administration Deed document which states exactly 6 digits, and the NZ Dialplan provided to the ITU by the NZ Goverment which provides a range of 5-7 digits). A case where it does not work for example is the 230 number range, which is defined in NZ as part of the 23 number range with 6-7 additional digits, and Mauritius which has a country code prefix of 230 with an additional 6 digits to indicate the local number. And yes, the 023 number range in NZ has been allocated to a TelCo, it is not quite yet in use.
NB: As for number length, I don't think you'd want to program the dialplan for your local region into your PBX especially not if your developing a commercial product with International customers.
By using the E164 recommendation you avoid any number space clashes between National and International numbers.
Q: How about if we prefix the number with the local access code of 0 for local numbers, and the international access code 00 for international number.
A: This would work perfectly, however if you're going through the problem of doing all of that then going that little step sideways to E164 won't be much of an issue and may make things simpler for you when dealing with Internationalization of the system you're working with. Using a single defined pattern for numbers will also simplify the functionality of any further tools you need to deal with.