System information

The [globals] section contains two variables, named LOCAL and TOLL.
The purpose of
these variables is to simplify management of your dialplan should you ever need to
change carriers. They allow you to make one change to the dialplan that will affect all
places where the specified channel is referred to:
[globals]
LOCAL=DAHDI/G0 ; assuming you have a PSTN card in your system
TOLL=SIP/YourVoipCarrier ; as defined in sip.conf
The [external] section contains the actual dialplan code that will recognize the num-
bers dialed and pass them to the Dial() application
§
:
[external]
exten => _NXXNXXXXXX,1,Dial(${LOCAL}/$EXTEN}) ; 10-digit pattern match for NANP
exten => _NXXXXXX,1,Dial(${LOCAL}/${EXTEN}) ; 7-digit pattern match for NANP
exten => _1NXXNXXXXXX,1,Dial(${TOLL}/${EXTEN}) ; Long-distance pattern match for NANP
exten => _011.,1,Dial(${TOLL}/${EXTEN}) ; International pattern match for
; calls made from NANP
; This section is functionally the same as the above section.
; It is for people who like to dial '9' before their calls
exten => _9NXXNXXXXXX,1,Dial(${LOCAL}/${EXTEN:1})
exten => _9NXXXXXX,1,Dial(${LOCAL}/${EXTEN:1})
exten => _91NXXNXXXXXX,1,Dial(${TOLL}/${EXTEN:1})
exten => _9011.,1,Dial(${TOLL}/${EXTEN:1})
In any context that would be used by sets or user devices, you would use an
include=> directive to allow access to the external context:
[LocalSets]
include => external
It is critically important that you do not include access to the external
lines in any context that might process an incoming call. The risk here
is that a phishing bot could eventually gain access to your outgoing
trunks (you’d be surprised at how common these phishing bots are).
We cannot stress enough how important it is that you ensure that no
external resource can access your toll lines.
PSTN Circuits
The Public Switched Telephone Network (PSTN) has existed for over a century. It is
the precursor to many of the technologies that shape our world today, from the Internet
to MP3 players.
‡ You can name these anything you wish. The words “local” and “toll” do not have any built-in meaning to
the Asterisk dialplan.
§ For more information on pattern matches, see Chapter 6.
PSTN Circuits | 133