System information
perspective, the definition of a trunk is not as clear as it used to be (PBX trunks used
totally different technology from station circuits), but as a concept, trunks are still very
important. For example, with VoIP, everything is actually peer-to-peer (so from a tech-
nology perspective there isn’t really such a thing as a trunk anymore), but it is still useful
to be able to differentiate between VoIP resources that connect to the outside world
and VoIP resources that connect to user endpoints (such as SIP telephones).
It’s probably easiest to think of a trunk as a collection of circuits that service a route.
So, in an Asterisk PBX, you might have trunks that go to your VoIP provider for long-
distance calls, trunks for your PSTN circuits, and trunks that connect your various
offices together. These trunks might actually run across the same network connection,
but in your dialplan you could treat them quite differently.
While we believe that VoIP will eventually completely replace the PSTN, many of the
concepts that are in use on VoIP circuits (such as a “phone number”) owe their existence
more to history than any technical requirement, and thus we feel it will be helpful to
discuss using traditional PSTN circuits with Asterisk before we get into VoIP.
If the system you are installing will use VoIP circuits only, that is not a problem. Go
straight to the VoIP section of this chapter,
*
and we’ll take you through what you need
to do. We do recommend reading the PSTN sections at your convenience, since there
may be general knowledge in them that could be of use to you, but it is not strictly
required in order to understand and use Asterisk.
Fundamental Dialplan for Outside Connectivity
In a traditional PBX, external lines are generally accessed by way of an access code that
must be dialed before the number.
†
It is common to use the digit 9 for this purpose.
In Asterisk, it is similarly possible to assign 9 for routing of external calls, but since the
Asterisk dialplan is so much more intelligent, it is not really necessary to force your
users to dial 9 before placing a call. Typically, you will have an extension range for your
system (say, 100–199), and a feature code range (*00 to *99). Anything outside those
ranges that matches the dialing pattern for your country or region can be treated as an
external call.
If you have one carrier providing all of your external routing, you can handle your
external dialing through a few simple pattern matches. The example in this section is
valid for the North American Numbering Plan (NANP). If your country is not within
the NANP (which serves Canada, the US, and several Caribbean countries), you will
need a different pattern match.
* But do not collect $200.
† In a key system, each line has a corresponding button on each telephone, and lines are accessed by pressing
the desired line key.
132 | Chapter 7: Outside Connectivity