text
stringlengths
0
152
6 We would again like to note that we’ve written extensively about digital circuits and DAHDI in previous edi‐
tions, and that body of work has been released under Creative Commons licensing, and is freely available.
Also, Sangoma/Digium provide detailed instructions on how to install and configure their PSTN cards. If you
are looking to deploy this technology, please enlist the services of a professional technical resource. This stuff
is complex and nuanced, and is not something you’re going to enjoy playing with if you haven’t had some sort
of previous experience. It is not necessary to learning or understanding Asterisk.
7 When we say “lengthy” we mean that in relation to other electronic technologies.
8 Just try to imagine if your telephone number could be spammed the way your email address is. The fact that
the PSTN is regulated, costs money to use, and controls the telephone numbers has served to limit the plague
of spam that email has suffered.
9 The Wikipedia page on network address translation is comprehensive and useful. For more information
about different types of NAT, and how NAT operates in general, start there.
10 SIP is not the only protocol to use RTP to carry media streams.
114
|
Chapter 7: Outside Connectivity
Figure 7-1. SIP and RTP
The use of separate protocols to carry the audio is what can make NAT traversal trou‐
blesome for VoIP connections, especially if the remote phones are behind one NAT,
and the PBX is behind a different NAT. The problem is caused by the fact that while
the SIP signaling will typically be allowed to pass through the firewalls at both ends,
the RTP streams may not be recognized as part of the SIP session taking place, and
thus will be ignored or blocked, as shown in Figure 7-2. The effect of one or both of
the RTP streams being blocked is that users will complain that they are seeing their
calls happen, and can answer them, but cannot hear (or cannot be heard).
Figure 7-2. RTP blocked by firewall
In this section we will discuss some of the methods you may employ to alleviate issues
caused by NAT. There are two different scenarios that need to be considered, each
requiring you to define parameters within the pjsip.conf file. NAT issues can be
annoying to troubleshoot, as there are many different types of firewalls in production,
and many different ways to configure them.
In general, you’re going to want to add the following to the transport sections of
your /etc/asterisk/pjsip.conf file:
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0
local_net=x.x.x.x/xx ; IP/CIDR of your internal network
external_media_address=x.x.x.x ; External IP address to use in RTP handling
external_signaling_address=x.x.x.x ; External address for SIP signalling
VoIP
|
115
If you want to find the external address of your PBX, run the fol‐
lowing from the shell:
$ dig +short myip.opendns.com @resolver1.opendns.com
It is probably safe to set these parameters for all scenarios, but be prepared to experi‐
ment by commenting out settings and reloading PJSIP to test different scenarios.
Endpoints behind NAT
If your telephone sets are behind a remote NAT, there may be options in the ps_end
points table of your database that should be adjusted from the default settings. You
will need to experiment with changing the following values between 'yes' and 'no'.
There may be many different combinations possible.
MySQL> update ps_endpoints set rtp_symmetric='yes',force_rport='yes',rewrite_contact='yes'
Other parameters you may wish
direct_media.
to
look at
include media_address and
Keep in mind the defaults when you are making changes. If in doubt, set the value of
a field you’ve changed to NULL, as that will effectively set it back to the default.
Keeping a Remote Firewall Open
Sometimes a problem with a SIP telephone will surface wherein the phone will regis‐
ter and function when it is first booted, but then it will suddenly become unreachable.
What is often happening here is that the remote firewall, seeing no activity coming
from the set, will close the external connection to the telephone, and thus the PBX
will lose the ability to signal to the set. The effect is that if the PBX tries to send a call
to the phone, it will fail to connect (the remote firewall will reject the connection). If,
on the other hand, the user makes a call out, for a few minutes the set will again be
able to accept incoming calls. Naturally this can cause a lot of confusion for the users.