Re: [asterisk-users] Asterisk behind NAT and Kamailio -- Internal IP in SDP and not externip

2013-07-02 Thread Johan Wilfer

2013-07-01 15:04, Daniel-Constantin Mierla skrev:

Hello,

On 6/28/13 4:29 PM, Johan Wilfer wrote:

Hi,

We have some Asterisk servers that we are moving behind a NAT to
preserve public addresses and make room for growth. This is Asterisk 1.4

NAT works very good with the externip/localnet-setting when we are
connected directly to our teleco. But when I try to use NAT and put
them behind our Kamailio something interesting happens: The
media-address in the SDP is the internal ip and not the external.


This is the setup:

Teleco - Kamailio - Asterisk
  SIP --  1.2.3.4
   10.0.0.1 -- 10.0.0.2

externip=1.2.3.5
localnet=10.0.0.0/255.255.255.0


  RTP  1.2.3.5 (NAT:ed to 10.0.0.2)


On an incomming call from the teleco - to kamailio (public addr) -
to asterisk in the private net. Asterisk responds with the following SDP:

v=0
o=root 1889 1889 IN IP4 10.0.0.2
s=session
c=IN IP4 10.0.0.2
t=0 0
m=audio 23344 RTP/AVP 8 0 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

Asterisk seems to think that because the proxy is on the localnet, the
media is too, so it doesn't use the externip as the RTP-ip.

This is a incomming call and the RTP ip of the other leg is another
public address. So the RTP-ip should the public address (externip).

If I connect to the teleco directly from the pbx (bypassing kamailio)
Asterisk correctly uses the externip as the rtp-ip in the SDP.


I know this is an old and unsupported version of Asterisk, but any
input on the topic is welcome. If this is supported in later versions
we can maybe work around until we migrate later.



what I did when I had similar scenario was to let asterisk completely
behind NAT, using only the local IP. I used rtpproxy running on the same
host as kamailio to bridge the rtp between external and internal networks.

Cheers,
Daniel



I think that you are right that this should be done with Kamailio.
Maybe the nathelper-module in Kamilio would do the trick in modifying 
the SDP/Contact to the NAT:ed address instead of using rtpproxy.


Thanks for the feedback!

/Johan



--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
  http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Asterisk behind NAT and Kamailio -- Internal IP in SDP and not externip

2013-07-01 Thread Daniel-Constantin Mierla

Hello,

On 6/28/13 4:29 PM, Johan Wilfer wrote:

Hi,

We have some Asterisk servers that we are moving behind a NAT to 
preserve public addresses and make room for growth. This is Asterisk 1.4


NAT works very good with the externip/localnet-setting when we are 
connected directly to our teleco. But when I try to use NAT and put 
them behind our Kamailio something interesting happens: The 
media-address in the SDP is the internal ip and not the external.



This is the setup:

Teleco - Kamailio - Asterisk
  SIP --  1.2.3.4
   10.0.0.1 -- 10.0.0.2

externip=1.2.3.5
localnet=10.0.0.0/255.255.255.0


  RTP  1.2.3.5 (NAT:ed to 10.0.0.2)


On an incomming call from the teleco - to kamailio (public addr) - 
to asterisk in the private net. Asterisk responds with the following SDP:


v=0
o=root 1889 1889 IN IP4 10.0.0.2
s=session
c=IN IP4 10.0.0.2
t=0 0
m=audio 23344 RTP/AVP 8 0 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

Asterisk seems to think that because the proxy is on the localnet, the 
media is too, so it doesn't use the externip as the RTP-ip.


This is a incomming call and the RTP ip of the other leg is another 
public address. So the RTP-ip should the public address (externip).


If I connect to the teleco directly from the pbx (bypassing kamailio) 
Asterisk correctly uses the externip as the rtp-ip in the SDP.



I know this is an old and unsupported version of Asterisk, but any 
input on the topic is welcome. If this is supported in later versions 
we can maybe work around until we migrate later.
what I did when I had similar scenario was to let asterisk completely 
behind NAT, using only the local IP. I used rtpproxy running on the same 
host as kamailio to bridge the rtp between external and internal networks.


Cheers,
Daniel

--
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda


--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
  http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


[asterisk-users] Asterisk behind NAT and Kamailio -- Internal IP in SDP and not externip

2013-06-28 Thread Johan Wilfer

Hi,

We have some Asterisk servers that we are moving behind a NAT to 
preserve public addresses and make room for growth. This is Asterisk 1.4


NAT works very good with the externip/localnet-setting when we are 
connected directly to our teleco. But when I try to use NAT and put them 
behind our Kamailio something interesting happens: The media-address in 
the SDP is the internal ip and not the external.



This is the setup:

Teleco - Kamailio - Asterisk
  SIP --  1.2.3.4
   10.0.0.1 -- 10.0.0.2

externip=1.2.3.5
localnet=10.0.0.0/255.255.255.0


  RTP  1.2.3.5 (NAT:ed to 10.0.0.2)


On an incomming call from the teleco - to kamailio (public addr) - to 
asterisk in the private net. Asterisk responds with the following SDP:


v=0
o=root 1889 1889 IN IP4 10.0.0.2
s=session
c=IN IP4 10.0.0.2
t=0 0
m=audio 23344 RTP/AVP 8 0 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

Asterisk seems to think that because the proxy is on the localnet, the 
media is too, so it doesn't use the externip as the RTP-ip.


This is a incomming call and the RTP ip of the other leg is another 
public address. So the RTP-ip should the public address (externip).


If I connect to the teleco directly from the pbx (bypassing kamailio) 
Asterisk correctly uses the externip as the rtp-ip in the SDP.



I know this is an old and unsupported version of Asterisk, but any input 
on the topic is welcome. If this is supported in later versions we can 
maybe work around until we migrate later.


Thanks!

--
Johan Wilfer

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
  http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users