This is a great thread, really full of answers and concepts for me atleast.<div>:)<br><br><div class="gmail_quote">On Mon, Jun 25, 2012 at 5:57 PM, Richard Brady <span dir="ltr"><<a href="mailto:rnbrady@gmail.com" target="_blank">rnbrady@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Klaus / Daniel<br>
<br>
Thanks again for assistance with this.<br>
<br>
I've tried the solution based on add_contact_alias() and<br>
handle_ruri_alias() and it works perfectly.<br>
<span class="HOEnZb"><font color="#888888"><br>
Richard<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On 22 June 2012 13:47, Klaus Darilion <<a href="mailto:klaus.mailinglists@pernau.at">klaus.mailinglists@pernau.at</a>> wrote:<br>
><br>
><br>
> On 22.06.2012 13:50, Richard Brady wrote:<br>
>><br>
>> Thanks guys, fantastic answers.<br>
>><br>
>> You mention that NAT detection happens before save() and the flag is set<br>
>> by lookup() which makes much more sense. However, if Kamailio is not the<br>
>> registrar, as is the case with my current project, those functions are<br>
>> not called, so an alternative is needed. There are clearly several<br>
>> options.<br>
>><br>
>> The solution I have gone for is to replace fix_nated_register() with<br>
>> fix_nated_contact() so that the REGISTER request is relayed with a<br>
>> modified Contact header containing the external ip:port of the client.<br>
><br>
><br>
> The cleanest solution would be to use add_contact_alias() and<br>
> handle_ruri_alias(). The do not change the contact but put the public<br>
> address into a uri parameter. Thus, the URI seen by the client is always the<br>
> one it sends:<br>
> <a href="http://www.kamailio.org/docs/modules/3.2.x/modules_k/nathelper.html#id2550431" target="_blank">http://www.kamailio.org/docs/modules/3.2.x/modules_k/nathelper.html#id2550431</a><br>
><br>
><br>
>> That is then stored by the registrar (FreeSWITCH in my case) and used<br>
>> later to originate calls for that user. The FreeSWITCH know to send<br>
>> those calls to Kamailio through either use of the Path header and module<br>
>> in Kamailio, or through static configuration of fs_path or proxy<br>
>> parameters in FreeSWITCH.<br>
><br>
><br>
> This is fine.<br>
><br>
><br>
>> The works for the first INVITE to the registered client behind NAT. But<br>
>> that client sends back a 200 OK with a Contact header containing its<br>
>> private IP address, and so fix_nated_contact() needs to be invoked on<br>
>> that response, and normally it would be due to FLB_NATB being set, but<br>
>> if Kamailio was not the registrar then that flag is not set. So I need<br>
>> to detect NAT on the client at the time of receiving the reply, or<br>
>> alternatively by having the registrar store a cookie and setting it<br>
>> based on that.<br>
><br>
><br>
> You are correct. For in-dialog messages received from SIP clients I would<br>
> always use add_contact_alias() and remove the NAT flags completely.<br>
><br>
>><br>
>> I suppose then my next question then is can I call nat_uac_test() on a<br>
>> UAS?<br>
><br>
><br>
> Today, almost any SIP clients are SIP symmetric. This means, that they<br>
> receive SIP from the some port/connection where they send. Thus, skip the<br>
> NAT tests completely and always use add_contact_alias() for messages receive<br>
> from SIP clients and handle_ruri_alias() for messages sent to SIP clients.<br>
><br>
> Depending on if you use Freeswitch also as media relay you can also remove<br>
> the media proxy stuff from the Kamailio config.<br>
><br>
> On important thing is NAT-keep-alive. This is usually done by nathelper<br>
> module by querying the location table for contact with NAT-flag set. Thus,<br>
> either you do NAT keep-alive by freeswitch (e.g sending OPTIONS requests) or<br>
> do it in your Kamailio proxy (e.g. set the nat_bflag<br>
> <a href="http://www.kamailio.org/docs/modules/3.2.x/modules_k/usrloc.html#id2541477" target="_blank">http://www.kamailio.org/docs/modules/3.2.x/modules_k/usrloc.html#id2541477</a><br>
> and call save("location","0x02") before relaying REGISTER to freeswitch.<br>
> Then Kamailio will do NAT-pinging. Note, if you want to keep-alive only for<br>
> successfully registered clients, you man want to call save() in the<br>
> reply-route of the REGISTER request).<br>
><br>
> regards<br>
> Klaus<br>
<br>
_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</div></div></blockquote></div><br></div>