From wang@basis-audionet.com Tue Mar 2 20:37:37 2010 From: Min Wang To: sr-dev@lists.kamailio.org Subject: [sr-dev] How to contruct ACK/BYE correctly in dialog with NATed client Date: Tue, 02 Mar 2010 20:36:42 +0100 Message-ID: <04A856F26940EE42A7D6129D5073F24A022BDAE2@BASIS001152003.basis-audionet.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2053345370==" --===============2053345370== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Hi My issue is how to construct ACK correctly in the dialog in case of NATed client. ( please see http://lists.sip-router.org/pipermail/sr-dev/2010-February/006145.html for the scenario detail ) nated-u1(bob)---> P1 --> nated-u2 (alice) e.g: bob calls alcie, (A) In the normal case, U1 ---> P1 ---> U2 Invite-> <--200 OK ACK --> The good ACK msg capted from P1 to U2 is: # U 67.154.255.47:4060 (P1) -> 67.154.250.3:2051 ( public ip/port for U2) ACK sip:alice(a)172.16.8.42:2051;line=e96ci3a9 SIP/2.0. (B) In the abormal case, U1 ---> P1 ---> U2 Invite-> ACK --> BYE --> <--488 P1 check something and need to send ACK/BYE to u2 The pseudo code try to use dialog module function: dialog.request_inside(&method_ACK,&reqbuf,NULL, d,cb,cbp) >From the log file: DEBUG:tm:t_uac: next_hop= The captured ACK msg: U 67.154.255.47:4060 (P1) -> 67.154.255.44:5060 (i-cscf) ACK sip:alice(a)centercall.net SIP/2.0. The two ACK msg is different. Questions: (1) How can I generate the correct ACK msg in this case? (2) The issue with second ACK need more explaination ( from openims point of view): i-cscf ---- s-cscf | U1 --> P1 --> U2 (i/s-cscf is sip proxy) With this kind of ACK, the ACK first goes to i-cscf, which choose s-cscf, then goes back to P1, P1 will try to relay the ACK route[Term_Subsequent]{ ... if (!P_security_relay()) P_NAT_relay(); t_relay() ... } The log shows: 22106 Mar 2 11:06:25 im1 /usr/sbin/ser[27551]: DEBUG: tm [t_funcs.c:184]: tm: put_on_wait: transaction 0xb59834b4 already on wait It seems the tm module put this new ACK (the P1-generated ACK loop back to P1 now ) on hold, NOT relaying to U2. >From sniffed packets, the ACK never reaches the U2. Any good way to resolve the issue? Just FYI the BYE can reach U2 as it is a new tm transaction. # U 67.154.255.47:4060 -> 67.154.255.44:5060 BYE sip:alice(a)centercall.net SIP/2.0. 22512 Mar 2 11:06:25 im1 /usr/sbin/ser[27551]: DEBUG: tm [t_lookup.c:711]: DEBUG: t_lookup_request: no transaction found 22558 Mar 2 11:06:25 im1 /usr/sbin/ser[27551]: DEBUG: tm [t_funcs.c:388]: SER: new transaction fwd'ed /////////detailed log for ACK in Term_Subsequent /////////////// 21997 Mar 2 11:06:25 im1 /usr/sbin/ser[27551]: DEBUG: [parser/msg_parser.c:627]: SIP Request: 21998 Mar 2 11:06:25 im1 /usr/sbin/ser[27551]: DEBUG: [parser/msg_parser.c:629]: method: 21999 Mar 2 11:06:25 im1 /usr/sbin/ser[27551]: DEBUG: [parser/msg_parser.c:631]: uri: 22000 Mar 2 11:06:25 im1 /usr/sbin/ser[27551]: DEBUG: [parser/msg_parser.c:633]: version: 22091 Mar 2 11:06:25 im1 /usr/sbin/ser[27551]: NOTICE: