Re: [OpenSIPS-Users] RURI domain on NAT'd endpoints

2009-09-08 Thread Jeff Pyle
All very good points.  I've largely been able to avoid NAT up until now, so
I'm afraid I'm a bit too green to offer any clarification.


- Jeff



On 9/8/09 1:08 AM, "Thomas Gelf"  wrote:

> Thomas Gelf wrote:
>> Jeff Pyle wrote:
>>> if (client_nat_test("3")) {
>>>   force_rport();
>>>   $avp(s:received_uri) = $source_uri;
>>>   if (!is_method("REGISTER")) fix_contact();
>>>   setbflag(7);
>>> }# nat_keepalive() further down after some pref checks
> 
> One more thing: I'm doing client_nat_test("1) in reply routes (should
> make sense), client_nat_test("7") for REGISTERs and client_nat_test("3")
> for other requests. While I'm pretty sure regarding the reply_route part
> (you cannot use test 2 and 4 as Via headers are nothing but copies from
> Request), I'm wondering whether the latter distinction between REGISTER
> and other request is making sense.
> 
> Googling and having a look to Flavios book shows that also others are
> doing so - why?? If test 4 matches, the request would for sure also
> trigger test 2 wouldn't it? So, may I completely skip test 4?
> 
> There is one special case that comes to my mind: does test 2 somehow
> respect the rport parameter? I mean, if topmost Via has a private IP
> and rport set - is test 2 then still triggered?
> 
> Best regards,
> Thomas Gelf


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] RURI domain on NAT'd endpoints

2009-09-07 Thread Thomas Gelf
Thomas Gelf wrote:
> Jeff Pyle wrote:
>> if (client_nat_test("3")) {
>>   force_rport();
>>   $avp(s:received_uri) = $source_uri;
>>   if (!is_method("REGISTER")) fix_contact();
>>   setbflag(7);
>> }# nat_keepalive() further down after some pref checks

One more thing: I'm doing client_nat_test("1) in reply routes (should
make sense), client_nat_test("7") for REGISTERs and client_nat_test("3")
for other requests. While I'm pretty sure regarding the reply_route part
(you cannot use test 2 and 4 as Via headers are nothing but copies from
Request), I'm wondering whether the latter distinction between REGISTER
and other request is making sense.

Googling and having a look to Flavios book shows that also others are
doing so - why?? If test 4 matches, the request would for sure also
trigger test 2 wouldn't it? So, may I completely skip test 4?

There is one special case that comes to my mind: does test 2 somehow
respect the rport parameter? I mean, if topmost Via has a private IP
and rport set - is test 2 then still triggered?

Best regards,
Thomas Gelf

-- 
 mail: tho...@gelf.net
  web: http://thomas.gelf.net/


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] RURI domain on NAT'd endpoints

2009-09-07 Thread Thomas Gelf
Jeff Pyle wrote:
> I didn't have the usrloc portion configured before, and I was running
> fix_contact() on everything detected as NAT.  I've modified the top of
> route[0] to look like this:
> 
> if (client_nat_test("3")) {
>   force_rport();
>   $avp(s:received_uri) = $source_uri;
>   if (!is_method("REGISTER")) fix_contact();
>   setbflag(7);
> }# nat_keepalive() further down after some pref checks
> 
> Is this wise?

Looks good. I usually prefer handling REGISTER requests in a dedicated
route. That will avoid running into trouble with future enhancements /
changes to your config (e.g. forgetting to prefix a new function call
with !is_method("REGISTER")).

Best regards,
Thomas Gelf

-- 
 mail: tho...@gelf.net
  web: http://thomas.gelf.net/


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] RURI domain on NAT'd endpoints

2009-09-07 Thread Jeff Pyle
Right.

I didn't have the usrloc portion configured before, and I was running
fix_contact() on everything detected as NAT.  I've modified the top of
route[0] to look like this:

if (client_nat_test("3")) {
  force_rport();
  $avp(s:received_uri) = $source_uri;
  if (!is_method("REGISTER")) fix_contact();
  setbflag(7);
}# nat_keepalive() further down after some pref checks

Is this wise?

Thanks,
Jeff



On 9/6/09 11:20 AM, "Thomas Gelf"  wrote:

> Thomas Gelf wrote:
>> The following should help you:
>> 
>> modparam("registrar", "received_avp", "$avp(i:123)")
>> modparam("usrloc","nat_bflag",6)
>> 
>> setbflag(6);
>> $avp(i:123) = $source_uri;
>> nat_keepalive();
>> save("location");
> 
> Forgot to mention that those lines shall obviously only be
> called once client_nat_test discovered a problem ;-)
> 
> Cheers,
> Thomas


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] RURI domain on NAT'd endpoints

2009-09-06 Thread Thomas Gelf
Thomas Gelf wrote:
> The following should help you:
> 
> modparam("registrar", "received_avp", "$avp(i:123)")
> modparam("usrloc","nat_bflag",6)
> 
> setbflag(6);
> $avp(i:123) = $source_uri;
> nat_keepalive();
> save("location");

Forgot to mention that those lines shall obviously only be
called once client_nat_test discovered a problem ;-)

Cheers,
Thomas

-- 
 mail: tho...@gelf.net
  web: http://thomas.gelf.net/


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] RURI domain on NAT'd endpoints

2009-09-06 Thread Thomas Gelf
Jeff Pyle wrote:
> It seems to me when I first started playing with the nat_traversal style
> commands one difference was the way the contact field was stored in the
> location table.  The new commands stored the public IP (post-fix_contact)
> while the old commands stored the private IP (pre-fix_contact).  At the
> moment I don't see the private IP at all in the location record.  Before I
> can get it into the RURI I'm going to need it here somewhere.
> 
> Are there any comments on the 'proper' way to do all this?  Order of
> commands, for example?  The documentation was a little thin on big-picture,
> practical implementation.

The following should help you:

modparam("registrar", "received_avp", "$avp(i:123)")
modparam("usrloc","nat_bflag",6)

setbflag(6);
$avp(i:123) = $source_uri;
nat_keepalive();
save("location");

Best regards,
Thomas Gelf


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


[OpenSIPS-Users] RURI domain on NAT'd endpoints

2009-09-05 Thread Jeff Pyle
Hello,

I have a UAC registered from behind a NAT router.  I'm using all the
nat_traversal commands to handle that, along with Mediaproxy.  So far, so
good.  Outbound calls from the UAC work just fine.

The UAC doesn't like the inbound calls, however, because the domain of the
RURI is the public IP, not the private IP of the UAC itself.  It sees them
as non-local and responds with a 404.  I'd like to construct the RURI such
that the domain is the private IP from registration, not the public one.

It seems to me when I first started playing with the nat_traversal style
commands one difference was the way the contact field was stored in the
location table.  The new commands stored the public IP (post-fix_contact)
while the old commands stored the private IP (pre-fix_contact).  At the
moment I don't see the private IP at all in the location record.  Before I
can get it into the RURI I'm going to need it here somewhere.

Are there any comments on the 'proper' way to do all this?  Order of
commands, for example?  The documentation was a little thin on big-picture,
practical implementation.


Thanks,
Jeff


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users