[asterisk-users] Asterisk 1.6.0.17 PBX with two interfaces does notroutes RTP packets - SIP Conf Problem likely
LATEEF, IRFAN (ATTSI)
il110w at att.com
Fri Feb 26 11:01:48 CST 2010
Hi Folks,
I did not get any responses from the list, but I debugged and fixed it
myself.
Just in case anybody runs into this again here is the problem and the
solution.
When there are two interfaces as in shown in my setup below. Most
examples on the internet talk about peers behind firewalls and using
NAT.
This is a case where asterisk has a static IP on the external side and a
multiple local subnets on the internal side with peers and asterisks on
different local subnets. The key to the solution is to use the right
mask in sip_nat.h . If this your problem read on ...
The local interface IP as 130.Y.47.149 and the softphone was at
135.X.141.32 and the setting in the sip_nat.conf was as follows:
localnet=130.X.47.0/255.255.255.0
externhost=Z.Z.247.106
When the SDP was being prepared for the local peer (softphone) the local
peer's IP addr did not match local net address because the
Mask was 255.255.255.0 and the first bytes were different. Hence
asterisk thought that the peer was on the external side and therefore
chose
the external IP to send to the local peer in the SDP. In order to get
the asterisk to recognize that 130 and 135 and in fact both on the
local net
the subnet mask had to chosen in such a way that only the bits common to
both number were compared hence 130.0.0.0 mask and address resolves it
correctly.
Therefore I change the sip_nat.conf as below and it works.
localnet=130.0.0.0/130.0.0.0
externhost=Z.Z.247.106
The following link was very helpful in understand the SIP NAT
configuration and settings.
http://www.linuxjournal.com/article/9399
This excerpt from the above link explains it.
The simplest situation is when a SIP client is behind a NAT gateway
connecting to a server on the Internet. The client creates the
translation entry for the SIP traffic when it first registers. As long
as there is frequent communication between the two hosts, such as one
packet per minute, the channel will stay open. The only configuration
needed is to have the client use its external address in all SDP
packets. On clients that support it, enable STUN (Simple Traversal of
UDP through NAT), so the client can determine the external address
dynamically, or enter it manually. Asterisk doesn't support STUN at this
time, so all NAT configuration must be done manually. The following
commands in /etc/asterisk/sip.conf set up the NAT properly:
[general]
localnet=192.168.0.0/255.255.0.0 ; or your subnet
externip=x.x.x.x ; use your address
[YOURREMOTEPEER] ; your peer's name
nat=yes
qualify=yes ; Force keepalives
And another article at the following link.
http://www.voip-info.org/wiki/view/Asterisk@Home+Handbook+Wiki+Chapter+2
And this section from the above link really clarifies the use of
localnet IP and mask usage.
Here is our example:
The DNS Name (or you can enter the IP Address) of the VOIP SIP provider
is sip.voipcompany.com.
The static LAN/Private IP address of your Asterisk at Home server is
192.168.1.2.
The static WAN/Public IP address of your router is 1.2.3.4 (if you use
DynamicDNS, we'll use your domain name)
Enter your router/firewall configuration and add:
Forward UDP Port 5060-5082 to 192.168.1.2
Forward UDP Port 10000 to 20000 to 192.168.1.2
You also need to edit the sip_nat.conf file.
Inside of AMP, click Maintenance ----> Config Edit ----> sip_nat.conf.
Inside of sip_nat.conf add the following and click "Update":
externip = 1.2.3.4 (enter your permanent WAN/Public internet address
here. Or you if you have one, you can use a DynamicDNS domain name.
Obviously it's easier to get a static IP address and avoid using
DynamicDNS altogether.)
If you are using a dynamic dns domain name, you should rather use:
externhost = home.mydomain.com
externrefresh = 5 (which means lookup hostname every 5 minutes to
refresh ip adress)
localnet = internal.network.address.0/255.255.255.0 (put your
LAN/Private NETWORK address of your Asterisk at Home server, this is NOT
the IP address of the server!!!!)
To determine your local NETWORK address (NOT the IP address!!) you have
to know a little about your subnet mask (255.255.255.0 numbers).
If the IP address of the Asterisk at Home server is 192.168.1.5
255.255.255.0, then the NETWORK address is 192.168.1.0
If the IP address of the Asterisk at Home server is 192.168.7.2
255.255.255.0, then the NETWORK address is 192.168.7.0
If the IP address of the Asterisk at Home server is 192.168.100.84
255.255.255.0, then the NETWORK address is 192.168.100.0
Hope this helps !!!
Regards,
Irfan Lateef
-----Original Message-----
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of LATEEF,
IRFAN (ATTSI)
Sent: Thursday, February 25, 2010 5:40 PM
To: asterisk-users at lists.digium.com
Subject: [asterisk-users] Asterisk 1.6.0.17 PBX with two interfaces does
notroutes RTP packets - SIP Conf Problem likely
Importance: High
Hi,
I am try to configure Asterisk as PBX system with two interfaces as
shown below. One interface pointing to the local subnet with a SIP phone
and another interface pointing to the external ISP SIP Sever.
SJPhone(X.X.141.32)<--------->(Y.Y.47.149)local-intf-|Asterisk|external-
intf(Z.Z.247.106)<-------->(w.w.158.26)ISP-SIP-Server----OutsideWorld
I am able to setup a call from the Phone to the outside world and I have
the audio (RTP packets) coming from the outside world being routed to my
phone
but the audio from my Phone IP(X.X) is not going out to the SIP-Server.
In fact I think it is not even reaching the Asterisk server because the
SDP in the 183 going to the phone has the IP address of the
external-inf(Z.Z.247.106) of the Asterisk PBX when it should actually
(Y.Y.47.149)
<--- Transmitting (NAT) to X.X.141.32:5060 --->
SIP/2.0 183 Session Progress^M
Via: SIP/2.0/UDP
X.X.141.32;branch=z9hG4bK87468d20000002f44b86a00400006f2b00000166;receiv
ed=X.X.141.32;rport=5060^M
From: "Irfan Lateef"
<sip:2005 at Y.Y.47.149>;tag=327f290e2e7^M
To: <sip:99084611234 at Y.Y.47.149>;tag=as24228e21^M
Call-ID: 876BAA6B36F644F7B4EF7BE5D4B7E8BD0x87468d20^M
CSeq: 2 INVITE^M
User-Agent: Asterisk PBX 1.6.0.17^M
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER,
SUBSCRIBE, NOTIFY, INFO^M
Supported: replaces, timer^M
Require: timer^M
Session-Expires: -1;refresher=uas^M
Contact: <sip:99084611234 at Z.Z.247.106>^M
Content-Type: application/sdp^M
Content-Length: 315^M
^M
v=0^M
o=root 1021147583 1021147583 IN IP4 Z.Z.247.106^M
s=Asterisk PBX 1.6.0.17^M
c=IN IP4 Z.Z.247.106^M
t=0 0^M
m=audio 18702 RTP/AVP 0 8 3 101^M
I have the following in the sip_nat.conf
localnet=Y.Y.47.149/255.255.0.0
externhost=Z.Z.247.106
externrefresh=10
fromdomain=att.com
nat=yes
qualify=yes
canreinvite=no
I think the SDP should have give the Y.Y.47.149 IP on the local net side
to the phone. But I am unable to figure how make it do that.
The Asterisk log shows this.
[Feb 25 11:06:30] VERBOSE[1449] logger.c: --
Executing [s at macro-dialout-trunk:19]
^[[1;36;40mDial^[[0;37;40m("^[[1;35;40mSIP/2005-19dc0db8^[[0;37;40m",
"^[[1;35;40mSIP/ATT-alpi016-IPFlex1/19084611234,300,^[[0;37;40m") in new
stack
[Feb 25 11:06:30] VERBOSE[1449] logger.c: == Using SIP
RTP TOS bits 184
[Feb 25 11:06:30] VERBOSE[1449] logger.c: == Using SIP
RTP CoS mark 5
[Feb 25 11:06:30] VERBOSE[1449] logger.c: -- Called
ATT-alpi016-IPFlex1/19084611234
[Feb 25 11:06:32] VERBOSE[1449] logger.c: --
SIP/ATT-alpi016-IPFlex1-19dda0f8 is making progress passing it to
SIP/2005-19dc0db8
[Feb 25 11:06:32] VERBOSE[1449] logger.c: Audio is at
Z.Z.247.106 port 18702
[Feb 25 11:06:32] VERBOSE[1449] logger.c: Adding codec
0x4 (ulaw) to SDP
[Feb 25 11:06:32] VERBOSE[1449] logger.c: Adding codec
0x8 (alaw) to SDP
[Feb 25 11:06:32] VERBOSE[1449] logger.c: Adding codec
0x2 (gsm) to SDP
[Feb 25 11:06:32] VERBOSE[1449] logger.c: Adding
non-codec 0x1 (telephone-event) to SDP
[Feb 25 11:06:32] VERBOSE[1449] logger.c:
Any help is greatly appreciated.
Thanks and Regards,
Irfan Lateef
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
More information about the asterisk-users
mailing list