[Serusers] NAT, ACK and BYEs

Giovanni Balasso giaso at yahoo.it
Wed May 11 16:31:50 CEST 2005


Hi serusers, another NAT issue from mine...
when I have two parts calling each other inside the same NAT (behind a router 
with public IP different from ser's) I directly relay the call between the 
two, without use of rtpproxy. The good thing is that audio works perfectly 
both ways, the bad one is that SIP messages from caller reach ser but aren't 
relayed to the callee. So ACKs and BYEs reach too many hops and if the caller 
hangs up, the callee remains connected until he hangs up too.

On the other side (BYE from callee to caller) everything works fine.

By "ngrepping" on ser port I noticed this difference on the header of SIP BYE, 
which from callee to caller is
BYE sip:caller at CALLER_PUBLIC_IP        (=CALLEE_PUBLIC_IP)

and from caller to callee is
BYE sip:callee at SER_PUBLIC_IP
and ser keeps relaying to himself...


INVITE routing logic is something like this

if (loose_route()) {
   if (has_totag() && method=="INVITE") {
       if (nat_uac_test("19")) {
               setflag(6);
               force_rport();
               fix_nated_contact();
       };
       force_rtp_proxy("l");
       t_on_reply("1");
   };
   t_relay();
   break;
}


if (method=="INVITE") {
   record_route();

   if (nat_uac_test(19)) {
      fix_nated_contact();
      force_rport();
      setflag(6);
   }

   if ( !isflagset(6) || SAME_NAT) {
      t_relay();
   } else {
      force_rtp_proxy();
      t_on_reply("1");
      t_relay();
   }
}


If I ignore same NAT test and force the call thru rtpproxy, all works as it 
should. I thought the problem was in fix_nated_contact and force_rport, but 
removing the two lines does nothing.

any ideas? thanks in advance

-- 
Giovanni Balasso
giaso at yahoo.it




More information about the sr-users mailing list