Zum Hauptinhalt springen

Handling of Area Codes

Area codes are another telecom relic that we are not getting rid of anytime soon. Originally designed to save users from entering the first few digits over and over again for local calls, they are rarely used today for dialing purposes. Most users enter the area code anyway, even if they are in the same area.

NANPA

In the United States and Canada, they still play an important role because of their geographic character. The North American Numbering Plan Administrator (NANPA) maintains the area codes for those countries that are using the 1 country code, mostly USA and Canada but also some other countries and territories.

There are roughly 340 area codes for continental USA and roughly 50 area codes for continental Canada. These are the areas where phone calls are typically covered with the domestic flat rate. However there are still other area codes for Hawaii or Alaska that are not considered continental and may cause additional costs or are simply not allowed on a dial plan. Then there are non-geographic area codes, for example for toll free and others for premium numbers that are expensive to call.

In any case, a good dial plan for USA and Canada will take the area code into account before sending the call out on a SIP trunk. In older versions, the dial plan would have to list those area codes in the dial plan in the form 212|617|781, which could get quite extensive considering there are more than 300 of them.

In order to address the problem, the dial plan can contain a special pattern that will match any of the area codes. The area codes that are currently available are:

  • [usa] for Domestic USA
  • [fre] for Toll Free USA
  • [pre] for Premium USA
  • [ala] for Alaska
  • [can] for Canada
  • [dom] for Dominican Republic
  • [haw] for Hawaii
  • [pue] for Puerto Rico
  • [vir] for United States Virgin Islands

The codes are actually stored in a file named areacodes.xml that Vodia maintains when there are changes in the area codes. The file is available in the template section for customizing the area codes. In the dial plan, the pattern would typically look like [usa]xxxxxxx, so that all area codes for USA followed by 7 digits would match the entry.

Which Number?

It has become a common practice to present a local number when calling customers. That means out of a list of numbers, the system needs to pick the number that is in the area. In previous versions of the PBX, this could be done by filtering the ANI for the trunk, and then use the dial plan to filter for the right area codes. As you can guess from the description, that was not straightforward.

In order to simplify this process, the PBX now (69.5.1 or later) has an additional field for the trunk numbers on the system that lists the area codes associated with that number. For example, when there is a number (617) 123-1234, it might have the area codes 617 and 857 associated with it. To reference the area codes, the ANI rule for the trunk needs to include dom-trunk-area, which will check for an area code match. Then, in this example, when dialing (857) 123-4567, the PBX would use the (617) 123-1234 ANI for the call. The list of area codes can contain many area codes, for example 339, 351, 508, 617, 774, 781, 857, and 978 for Western Massachusetts.

The numbers have to be assigned to a specific trunk that is determined by the dial plan. That means you could use something like xxxxxxxxxx or [usa]xxxxxxx to match the dial plan entry. If there is no area code match, it would use the regular rules for figuring out what number to use, like before.

Other countries

But also in other countries, area codes are still relevant. Some countries have fixed size area codes, while others have variable sized area codes. The rules are not hard coded to the NANPA regions, and they would work also in other countries. It is important that the country code is available so that the matching of numbers can work properly.

For example, in Germany one could use 30 to match the Berlin area. Note that there is no leading zero for the area code, so that the system can put the +49 in front of the area code for the matching of the number in the global format.