Re: [SR-Users] fix_nated_sdp issue

2012-02-23 Thread Daniel-Constantin Mierla
 
[parser/sdp/sdp_helpr_funcs.c:479]: located IP address [10.0.10.11] in 
`c=' field


Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: rtpproxy 
[rtpproxy_funcs.c:148]: type application/sdp found valid


Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: rtpproxy 
[rtpproxy.c:2237]: proxy reply: 38946 10.0.10.10#012


Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: siputils 
[checks.c:104]: no totag


Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: core 
[msg_translator.c:457]: clen_builder: content-length: 347 (347)


Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: core 
[msg_translator.c:204]: check_via_address(10.0.10.11, 10.0.10.11, 0)


Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: tm 
[t_funcs.c:388]: SER: new transaction fwd'ed


Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: ERROR: script: 
-- exiting relaying 
---


Feb 22 10:14:32 demo /usr/local/sbin/kamailio[3602]: DEBUG: core 
[usr_avp.c:644]: DEBUG:destroy_avp_list: destroying list (nil)


Walking through the log makes me think that because I'm using rtpproxy 
and nathelper, when the t_relay fires it errantly appends the address 
for rtpproxy to the c= line...


Am I going about this all wrong - is there a better approach?



you cannot use manage_rtpproxy (or other functions from rtpproxy module 
updating the sdp) with fix_nated_sdp() because of the way changes are 
applied to the sip message. When using both, it results in concatenation 
of the two IP -- it is why I asked about the log, expecting you used 
such two functions.


You may try using msg_apply_changes() in between such two functions, but 
I recommend making the config file decision in a way that you execute 
only one such function. For example, you can set a flag after using such 
functions and before using another one test that flag.


Cheers,
Daniel


Ric

*From:*Daniel-Constantin Mierla [mailto:mico...@gmail.com]
*Sent:* Wednesday, February 22, 2012 12:52 AM
*To:* SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) - 
Users Mailing List

*Cc:* Ric Marques
*Subject:* Re: [SR-Users] fix_nated_sdp issue

Hello,

can you set debug=3 in the config file and send the output (syslog 
messages) of processing such invite?


Cheers,
Daniel

On 2/22/12 4:31 AM, Ric Marques wrote:

Greetings,

I'm not sure if I found a bug, or if I just have something completely 
misconfigured... I'm a total newb with Kamailio, working on a proof of 
concept design.


Here's my configuration:

provider - nat firewall - kamailio/rtpproxy - asterisk

For outbound calls from a phone registered to asterisk via kamailio, 
I'm trying to use fix_nated_sdp(2, 10.50.50.8) to rewrite the 
media ip address to resolve my audio issues, where 10.50.50.8 is the 
address outside my firewall.  What I'm running into is the 'c=' line 
doesn't get re-written properly... it inserts the specified address in 
front of the existing address, and I end up with the following line in 
my INVITE:


c=IN IP4 10.50.50.810.0.10.10

I have the fix_nated_sdp command under route[sipout], because I only 
want to use it on calls being sent outside the nat firewall.


Here's the sip invite without the 'fix_nated_sdp' command:

--

INVITE sip:19165551...@xxx.xxx.xxx.xxx SIP/2.0

Record-Route: sip:10.0.10.10;lr=on;ftag=as5498b77e;nat=yes

Via: SIP/2.0/UDP 10.50.50.8.;branch=z9hG4bK4b3a.960f6466.0

Via: SIP/2.0/UDP 10.0.10.11:5060;branch=z9hG4bK145db73e;rport=5060

Max-Forwards: 69

From: 1009 sip:1009@10.0.10.11;tag=as5498b77e

To: sip:19165551...@xxx.xxx.xxx.xxx

Contact: sip:1009@10.0.10.11:5060

Call-ID: 06b8bb1b7dd7801d7b3b9c917fcb9b12@10.0.10.11:5060 
mailto:06b8bb1b7dd7801d7b3b9c917fcb9b12@10.0.10.11:5060


CSeq: 102 INVITE

User-Agent: Asterisk PBX SVN-branch-1.8-r356107

Date: Wed, 22 Feb 2012 03:06:06 GMT

Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, 
INFO, PUBLISH


Supported: replaces, timer

Content-Type: application/sdp

Content-Length: 309

P-hint: outbound

v=0

o=root 604360056 604360056 IN IP4 10.0.10.10

s=Asterisk PBX SVN-branch-1.8-r356107

c=IN IP4 10.0.10.10

t=0 0

m=audio 9702 RTP/AVP 0 3 8 101

a=rtpmap:0 PCMU/8000

a=rtpmap:3 GSM/8000

a=rtpmap:8 PCMA/8000

a=rtpmap:101 telephone-event/8000

a=fmtp:101 0-16

a=ptime:20

a=sendrecv

a=nortpproxy:yes

--

Here's the sip invite with the 'fix_nated_sdp' command:

--

INVITE sip:19167828...@xxx.xxx.xxx.xxx SIP/2.0

Record-Route: sip:10.0.10.10;lr=on;ftag=as49e00c81;nat=yes

Via: SIP/2.0/UDP 10.50.50.8.;branch=z9hG4bK1eab.800c4724.0

Via: SIP/2.0/UDP 10.0.10.11:5060;branch

[SR-Users] fix_nated_sdp issue

2012-02-21 Thread Ric Marques
Greetings,

I'm not sure if I found a bug, or if I just have something completely 
misconfigured... I'm a total newb with Kamailio, working on a proof of concept 
design.

Here's my configuration:

provider - nat firewall - kamailio/rtpproxy - asterisk

For outbound calls from a phone registered to asterisk via kamailio, I'm trying 
to use fix_nated_sdp(2, 10.50.50.8) to rewrite the media ip address to 
resolve my audio issues, where 10.50.50.8 is the address outside my firewall.  
What I'm running into is the 'c=' line doesn't get re-written properly... it 
inserts the specified address in front of the existing address, and I end up 
with the following line in my INVITE:
c=IN IP4 10.50.50.810.0.10.10

I have the fix_nated_sdp command under route[sipout], because I only want to 
use it on calls being sent outside the nat firewall.


Here's the sip invite without the 'fix_nated_sdp' command:
--
INVITE sip:19165551...@xxx.xxx.xxx.xxx SIP/2.0
Record-Route: sip:10.0.10.10;lr=on;ftag=as5498b77e;nat=yes
Via: SIP/2.0/UDP 10.50.50.8.;branch=z9hG4bK4b3a.960f6466.0
Via: SIP/2.0/UDP 10.0.10.11:5060;branch=z9hG4bK145db73e;rport=5060
Max-Forwards: 69
From: 1009 sip:1009@10.0.10.11;tag=as5498b77e
To: sip:19165551...@xxx.xxx.xxx.xxx
Contact: sip:1009@10.0.10.11:5060
Call-ID: 06b8bb1b7dd7801d7b3b9c917fcb9b12@10.0.10.11:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX SVN-branch-1.8-r356107
Date: Wed, 22 Feb 2012 03:06:06 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, 
PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 309
P-hint: outbound

v=0
o=root 604360056 604360056 IN IP4 10.0.10.10
s=Asterisk PBX SVN-branch-1.8-r356107
c=IN IP4 10.0.10.10
t=0 0
m=audio 9702 RTP/AVP 0 3 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv
a=nortpproxy:yes
--


Here's the sip invite with the 'fix_nated_sdp' command:
--
INVITE sip:19167828...@xxx.xxx.xxx.xxx SIP/2.0
Record-Route: sip:10.0.10.10;lr=on;ftag=as49e00c81;nat=yes
Via: SIP/2.0/UDP 10.50.50.8.;branch=z9hG4bK1eab.800c4724.0
Via: SIP/2.0/UDP 10.0.10.11:5060;branch=z9hG4bK20d28324;rport=5060
Max-Forwards: 69
From: 1009 sip:1009@10.0.10.11;tag=as49e00c81
To: sip:19167828...@xxx.xxx.xxx.xxx
Contact: sip:1009@10.0.10.11:5060
Call-ID: 4def5539675b6f644b99bb300e8ec8d6@10.0.10.11:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX SVN-branch-1.8-r356107
Date: Wed, 22 Feb 2012 03:18:19 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, 
PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 347
P-hint: outbound

v=0
o=root 1009117068 1009117068 IN IP4 10.0.10.10
s=Asterisk PBX SVN-branch-1.8-r356107
c=IN IP4 10.50.50.8.10.0.10.10
t=0 0
m=audio 13540 RTP/AVP 0 3 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv
a=oldmediaip:10.0.10.11
a=nortpproxy:yes
--

Is this a bug, or is it likely I have something else screwed up?

Thank you in advance for your assistance - this list is an incredible resource!

-Ric

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] fix_nated_sdp()

2011-01-25 Thread Carsten Bock
Hi Bernhard,

have you checked the SDP which is going to and from the
Freeswitch-Server? Is it modified?

If yes: You may want to check your NAT-Firewall. A working (but not
nice) solution might be to relay the RTP through an proxy in this
case...
If No: Verify the result of nat_uac_test: Why is it returning false?

Carsten

2011/1/25 Bernhard Suttner bernhard.sutt...@winet.ch:
 Hi,

 someone has an idea?

 Thanks in advance!

 Best regards,
 Bernhard

 -Ursprüngliche Nachricht-
 Von: sr-users-boun...@lists.sip-router.org 
 [mailto:sr-users-boun...@lists.sip-router.org] Im Auftrag von Bernhard Suttner
 Gesendet: Montag, 24. Januar 2011 20:38
 An: sr-users@lists.sip-router.org
 Betreff: [SR-Users] fix_nated_sdp()

 Hi,

 I have a question about the fix_nated_sdp() function. Different devices 
 (phones, pbxes, gateways) are using Kamailio as SBC. The SBC does t_relay() 
 the message to a pool of FreeSWITCH Servers.

 The scenario does work quite well but:

 if a call is initiated from one of the freeswitch server, pass it through 
 kamailio to the PBX and the PBX does have a forwarding back to kamailio and 
 in the end to freeswitch I have no audio because the PBX is behind a NAT and 
 uses private ip addresses in all the SDP of 200 OK and 183 Session Progress. 
 Therefore FreeSWITCH could not do the (very cool) RTP Auto-Adjustment (check 
 if IP in incoming packet is different to the IP in the SDP) to detect the 
 real IP address.

 Therefore I have to use fix_nated_sdp(). I am not sure, what this function 
 could break therefore I want to be very sure and use it only, if really 
 necessary. Test which User-Agent or Server the peer (in this example the PBX) 
 has, is not really possible because some devices does not send this header.

 What do you think about the follwoing pseudo code:

 if (method==INVITE  has_sdp()  nat_uac_test(8)) fix_nated_sdp(3)

 and within the onreply route:

 if (status=~(180|183|200)  has_sdp()  nat_uac_test(8)) fix_nated_sdp(3)

 Somebody has a better idea to handle this? What could go wrong?

 Thanks in advance.

 Best regards,
 Bernhard Suttner

 ___
 SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
 sr-users@lists.sip-router.org
 http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


 ___
 SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
 sr-users@lists.sip-router.org
 http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users




-- 
Carsten Bock
Schomburgstr. 80
22767 Hamburg
Germany

Mobile +49 179 2021244
Home +49 40 34927217
Büro (Verl) +49 5246 801427
Fax +49 40 34927218
mailto:cars...@bock.info

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] fix_nated_sdp()

2011-01-25 Thread Bernhard Suttner
Hi,

thanks for your answer. 

The question was about, if the fix_nated_sdp() (in the example below) could 
maybe break something. I am sure, that the fix_nated_sdp() would work in some 
cases but I am not sure, if the function could break something:


 if (method==INVITE  has_sdp()  nat_uac_test(8)) fix_nated_sdp(3)

 and within the onreply route:

 if (status=~(180|183|200)  has_sdp()  nat_uac_test(8)) fix_nated_sdp(3)


Or is there a better solution to fix these damend NAT scenarios?

Best regards,
Bernhard


-Ursprüngliche Nachricht-
Von: kaiserbo...@googlemail.com [mailto:kaiserbo...@googlemail.com] Im Auftrag 
von Carsten Bock
Gesendet: Dienstag, 25. Januar 2011 18:56
An: Bernhard Suttner
Cc: sr-users@lists.sip-router.org
Betreff: Re: [SR-Users] fix_nated_sdp()

Hi Bernhard,

have you checked the SDP which is going to and from the
Freeswitch-Server? Is it modified?

If yes: You may want to check your NAT-Firewall. A working (but not
nice) solution might be to relay the RTP through an proxy in this
case...
If No: Verify the result of nat_uac_test: Why is it returning false?

Carsten

2011/1/25 Bernhard Suttner bernhard.sutt...@winet.ch:
 Hi,

 someone has an idea?

 Thanks in advance!

 Best regards,
 Bernhard

 -Ursprüngliche Nachricht-
 Von: sr-users-boun...@lists.sip-router.org 
 [mailto:sr-users-boun...@lists.sip-router.org] Im Auftrag von Bernhard Suttner
 Gesendet: Montag, 24. Januar 2011 20:38
 An: sr-users@lists.sip-router.org
 Betreff: [SR-Users] fix_nated_sdp()

 Hi,

 I have a question about the fix_nated_sdp() function. Different devices 
 (phones, pbxes, gateways) are using Kamailio as SBC. The SBC does t_relay() 
 the message to a pool of FreeSWITCH Servers.

 The scenario does work quite well but:

 if a call is initiated from one of the freeswitch server, pass it through 
 kamailio to the PBX and the PBX does have a forwarding back to kamailio and 
 in the end to freeswitch I have no audio because the PBX is behind a NAT and 
 uses private ip addresses in all the SDP of 200 OK and 183 Session Progress. 
 Therefore FreeSWITCH could not do the (very cool) RTP Auto-Adjustment (check 
 if IP in incoming packet is different to the IP in the SDP) to detect the 
 real IP address.

 Therefore I have to use fix_nated_sdp(). I am not sure, what this function 
 could break therefore I want to be very sure and use it only, if really 
 necessary. Test which User-Agent or Server the peer (in this example the PBX) 
 has, is not really possible because some devices does not send this header.

 What do you think about the follwoing pseudo code:

 if (method==INVITE  has_sdp()  nat_uac_test(8)) fix_nated_sdp(3)

 and within the onreply route:

 if (status=~(180|183|200)  has_sdp()  nat_uac_test(8)) fix_nated_sdp(3)

 Somebody has a better idea to handle this? What could go wrong?

 Thanks in advance.

 Best regards,
 Bernhard Suttner

 ___
 SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
 sr-users@lists.sip-router.org
 http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


 ___
 SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
 sr-users@lists.sip-router.org
 http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users




-- 
Carsten Bock
Schomburgstr. 80
22767 Hamburg
Germany

Mobile +49 179 2021244
Home +49 40 34927217
Büro (Verl) +49 5246 801427
Fax +49 40 34927218
mailto:cars...@bock.info


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] fix_nated_sdp()

2011-01-25 Thread Bernhard Suttner
Hi,

thanks for your response. I think I understand the scenario very good - but im 
not so familiar with the fix_nated_sdp() functionality. 

Currently the SDP will be modified with the source IP of the message. This does 
work good but currently I only do that for some special devices (matching the 
User-Agent / Server string). I want to do that fix_nated_sdp() in all cases and 
not only for some special devices. 

The FreeSWITCH RTP-Auto Adjustment does work in nearly every case but in one 
(currently known) scenario it does not. 

Maybe I should just give it a try to do fix_nated_sdp() in combination with 
nat_uac_test (RFC1918 private address in SDP).

Thanks a lot for this discussion. 

Best Regards,
Bernhard

- Original Message -
From: Ovidiu Sas [mailto:o...@voipembedded.com]
To: Bernhard Suttner [mailto:bernhard.sutt...@winet.ch]
Cc: Carsten Bock [mailto:li...@bock.info], sr-users@lists.sip-router.org
Sent: Tue, 25 Jan 2011 20:38:14 +0100
Subject: Re: [SR-Users] fix_nated_sdp()


 You need to experiment with nathelper module and while doing that, you
 need to inspect the SIP messages in order to understand how it works.
 Only when you fully understand your scenarios, you will be able to
 properly configure, debg and setup kamailio.
 
 Best thing to do here is to use rtpproxy and relay media if needed.
 
 Another option would be to let the SDP untouched and let freeswitch do
 it's magic (if it can).  Not sure if this will work in all scenarios.
 
 Calling fix_nated_sdp() on the SBC will definitely not work (you are
 just messing with the IP on the SDP and you don't know if the real RTP
 port on the NATed side will match the advertised port in your fixed
 SDP).
 
 
 Regards,
 Ovidiu Sas
 
 On Tue, Jan 25, 2011 at 1:23 PM, Bernhard Suttner
 bernhard.sutt...@winet.ch wrote:
  Hi,
 
  thanks for your answer.
 
  The question was about, if the fix_nated_sdp() (in the example below)
 could maybe break something. I am sure, that the fix_nated_sdp() would work
 in some cases but I am not sure, if the function could break something:
 
 
   if (method==INVITE  has_sdp()  nat_uac_test(8)) fix_nated_sdp(3)
 
   and within the onreply route:
 
   if (status=~(180|183|200)  has_sdp()  nat_uac_test(8))
 fix_nated_sdp(3)
 
 
  Or is there a better solution to fix these damend NAT scenarios?
 
  Best regards,
  Bernhard
 
 
  -Ursprüngliche Nachricht-
  Von: kaiserbo...@googlemail.com [mailto:kaiserbo...@googlemail.com] Im
 Auftrag von Carsten Bock
  Gesendet: Dienstag, 25. Januar 2011 18:56
  An: Bernhard Suttner
  Cc: sr-users@lists.sip-router.org
  Betreff: Re: [SR-Users] fix_nated_sdp()
 
  Hi Bernhard,
 
  have you checked the SDP which is going to and from the
  Freeswitch-Server? Is it modified?
 
  If yes: You may want to check your NAT-Firewall. A working (but not
  nice) solution might be to relay the RTP through an proxy in this
  case...
  If No: Verify the result of nat_uac_test: Why is it returning false?
 
  Carsten
 
  2011/1/25 Bernhard Suttner bernhard.sutt...@winet.ch:
  Hi,
 
  someone has an idea?
 
  Thanks in advance!
 
  Best regards,
  Bernhard
 
  -Ursprüngliche Nachricht-
  Von: sr-users-boun...@lists.sip-router.org
 [mailto:sr-users-boun...@lists.sip-router.org] Im Auftrag von Bernhard
 Suttner
  Gesendet: Montag, 24. Januar 2011 20:38
  An: sr-users@lists.sip-router.org
  Betreff: [SR-Users] fix_nated_sdp()
 
  Hi,
 
  I have a question about the fix_nated_sdp() function. Different devices
 (phones, pbxes, gateways) are using Kamailio as SBC. The SBC does t_relay()
 the message to a pool of FreeSWITCH Servers.
 
  The scenario does work quite well but:
 
  if a call is initiated from one of the freeswitch server, pass it through
 kamailio to the PBX and the PBX does have a forwarding back to kamailio and
 in the end to freeswitch I have no audio because the PBX is behind a NAT and
 uses private ip addresses in all the SDP of 200 OK and 183 Session Progress.
 Therefore FreeSWITCH could not do the (very cool) RTP Auto-Adjustment (check
 if IP in incoming packet is different to the IP in the SDP) to detect the
 real IP address.
 
  Therefore I have to use fix_nated_sdp(). I am not sure, what this
 function could break therefore I want to be very sure and use it only, if
 really necessary. Test which User-Agent or Server the peer (in this example
 the PBX) has, is not really possible because some devices does not send this
 header.
 
  What do you think about the follwoing pseudo code:
 
  if (method==INVITE  has_sdp()  nat_uac_test(8)) fix_nated_sdp(3)
 
  and within the onreply route:
 
  if (status=~(180|183|200)  has_sdp()  nat_uac_test(8))
 fix_nated_sdp(3)
 
  Somebody has a better idea to handle this? What could go wrong?
 
  Thanks in advance.
 
  Best regards,
  Bernhard Suttner
 
  ___
  SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
  sr-users@lists.sip-router.org
  http://lists.sip

[SR-Users] fix_nated_sdp()

2011-01-24 Thread Bernhard Suttner
Hi,

I have a question about the fix_nated_sdp() function. Different devices 
(phones, pbxes, gateways) are using Kamailio as SBC. The SBC does t_relay() the 
message to a pool of FreeSWITCH Servers.

The scenario does work quite well but:

if a call is initiated from one of the freeswitch server, pass it through 
kamailio to the PBX and the PBX does have a forwarding back to kamailio and in 
the end to freeswitch I have no audio because the PBX is behind a NAT and uses 
private ip addresses in all the SDP of 200 OK and 183 Session Progress. 
Therefore FreeSWITCH could not do the (very cool) RTP Auto-Adjustment (check if 
IP in incoming packet is different to the IP in the SDP) to detect the real IP 
address.

Therefore I have to use fix_nated_sdp(). I am not sure, what this function 
could break therefore I want to be very sure and use it only, if really 
necessary. Test which User-Agent or Server the peer (in this example the PBX) 
has, is not really possible because some devices does not send this header.

What do you think about the follwoing pseudo code:

if (method==INVITE  has_sdp()  nat_uac_test(8)) fix_nated_sdp(3)

and within the onreply route:

if (status=~(180|183|200)  has_sdp()  nat_uac_test(8)) fix_nated_sdp(3)

Somebody has a better idea to handle this? What could go wrong?

Thanks in advance.

Best regards,
Bernhard Suttner

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users