text
stringlengths
0
152
A relatively simple solution to this problem11 involves setting the registration timer
on the remote phone to a low enough value that it will stimulate the connection every
minute or so, and thus convince the firewall that this connection can be allowed to
exist for a little while longer. It’s a bit of a hack, but it has proven successful. The chal‐
lenge with proposing a universal solution is that there are many different models of
firewalls, from inexpensive consumer-grade units to complex session border control‐
lers, and this is one of the few solutions that seems to address the problem reliably in
almost all cases.
11 Whether it is the best solution is still up for debate.
116
|
Chapter 7: Outside Connectivity
This approach is best on smaller systems (fewer than 100 telephones). A larger system
with hundreds or thousands of phones will not be well served by this solution, as
there will be an increased load on the system due to a near-constant flood of registra‐
tions from remote phones. In such a case, some more careful thought will need to be
given to the overall design (for example, a dedicated registrar server could be used in
place of Asterisk to handle the registration traffic).
In a perfect world, you would be able to specify a particular model of firewall, and
devise a configuration for those firewalls that would ensure your SIP traffic was prop‐
erly handled. In reality, you will come up against not just different models of firewall,
but even different firmware versions for the same model firewall.
Asterisk behind NAT
First up, we need to tell you that putting your PBX behind a NAT is not recom‐
mended. It’s far better to ensure it is firewalled without a NAT layer (especially if you
have endpoints that are not on the same network as the PBX).
If you are stuck working with a PBX behind a NAT, you will need to work with your
network team to ensure that the NAT components of the network are being correctly
handled by your NAT device (typically your firewall). If they do not have sufficient
skill in this regard, you may require the services of an outside consultant who is skil‐
led in NAT traversal for SIP/RTP traffic. As we said, having your PBX behind NAT is
not recommended.
Typically, the endpoints will also be behind NAT, and thus you will have a double-
NAT scenario, which is likely to require a few hours of wrangling with various set‐
tings, not only in Asterisk but also in the firewall, in order to achieve success.
Remember that it is vital that you test audio in both directions; it’s not enough to sim‐
ply verify that calls can be dialed and answered.
In a scenario where there is no choice but to use a double-NAT, we would recom‐
mend finding out whether a VPN can be used between the PBX and the remote end‐
points. In many cases this will end up being easier to configure.
We wish we could say there’s a simple, reliable way to ensure NAT works in all cases,
but unfortunately there is not.
You could also look into using NAT assisting technologies such as STUN, TURN, and
ICE. The details of these are beyond the scope of this book, since they require exter‐
nal servers, but many folks have had success with those protocols where other meth‐
ods failed.
VoIP
|
117
PSTN Termination and Origination
Passing calls between a VoIP environment and the PSTN requires some sort of gate‐
way to convert the VoIP (typically SIP) signaling into something compatible with
PSTN protocols. These processes are referred to as origination and termination
(Figure 7-3).
Figure 7-3. PSTN origination and termination
People often confuse the terms origination and termination as to which is which. For
us, it’s useful to remember that since the PSTN was already there when VoIP came
along, the terms evolved in relation to it. Ideally, the processes should probably be
called PSTN origination, and PSTN termination, and we encourage you to remember
them that way.12
PSTN termination
Until VoIP totally replaces the PSTN, there will be a need to connect calls from VoIP
networks to the public telephone network. This process is referred to as termination
(Figure 7-4).
12 And perhaps even use them that way in conversation, since many people are confused by these terms, and few
will admit it when you’re talking to them.
118
|
Chapter 7: Outside Connectivity
Figure 7-4. PSTN termination
Although you can engineer an Asterisk system to act as a termination gateway (using