I copy and paste the logic example generated from sipwise below.
I can see for first request, it marked the sender is behind nat with
record_route(";nat=yes")
In the loose route block, it tries to identify sender if they are behind nat
with search("^Route:.*;nat=yes").
In one sip proxy architecture, after you enter loose_route() function, the
Via with ;nat has gone, right? and the search("^Route:.*;nat=yes") test
would always return false.
Please correct me if i'm wrong. Thank you.
if(!is_method("REGISTER"))
{
if(nat_uac_test("19"))
{
record_route(";nat=yes");
}
else
{
record_route();
}
}
if(is_method("CANCEL") || is_method("BYE"))
{
end_media_session();
}
if(loose_route())
{
if(!has_totag())
{
xlog("L_INFO", "Initial loose-routing rejected -
M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
sl_send_reply("403", "Initial Loose-Routing
Rejected");
exit;
}
if(nat_uac_test("19") || search("^Route:.*;nat=yes"))
{
fix_nated_contact();
setbflag(6);
}
route(3);
}
On 9/12/07, Bogdan-Andrei Iancu <bogdan(a)voice-system.ro> wrote:
Hi Halomoan,
Mainly because the NAT detection on SIP replied is very poor - you can
check only if the contact address is a private one or not. The other nat
test are not applicable for replies (but only for requests).
Anthow, when you process the request, you learn that the calee is behind
NAT, so you can simple remember this (in RR) than detecting it each time
when receiving a reply.
regards,
bogdan
Halomoan Chow wrote:
Dear All
I don't understand why in the Openser+MediaProxy i need
record_route_preset("x.x.x.x:5060;nat=yes"); and
search("^Route:.*;nat=yes")
What is the purpose while I can do client_nat_test to see if the
request is come from a nat-ed client.
If I remove search("^Route:.*;nat=yes") from below statement, I can do
re-INVITE without any problem because it still have client_nat_test to
find out the nat in between.
if (client_nat_test("3") || search("^Route:.*;nat=yes")) {
setbflag(6);
use_media_proxy();
};
Hope someone can give me a clue.
Thank you.
Regards,
Halomoan
------------------------------------------------------------------------
_______________________________________________
Users mailing list
Users(a)openser.org
http://openser.org/cgi-bin/mailman/listinfo/users