It would be relevant to see the 200ok as received by each hop in the call path. Also, be sure you don't use fix_nated_contact() on the proxy if it is not the first node next to endpoint -- anyhow it is recommended to use set_contact_alias().

As a clafication, do you use tcp/tls between Kamailio2 and Asterisk?

Cheers,
Daniel

On 12/04/16 22:12, Yasin CANER wrote:
Hello;
    before sending this email i searched on google and doesnt solve this issue. all call flows are correct but one call that this isnt working right. it sends to wrong port to ACK for 200 OK. i tried to fix contact header or remove contact header but it wasnt work. i looked at ietf for ACK and couldnt figure out why it happens.
Does it need add a record route or remove Contact Header for every ack ?


Thanks for help.

i figure out  Kamailio-2 adds a Route header to ACK packet for sending Kamailio-1:5060, even if it doesnt add any command for it  in cfg.

Here is call flow

Asterisk and Kamailio is on the same ip and machine and public ip. different are ports. Kamailio-1 is another machine


INVITE : UAC1-----> Kamailio-1:5060----->Kamailio-2:5061--->Asterisk:5060

200 OK:  UAC1<----- Kamailio-1:5060<-----Kamailio-2:5061<---Asterisk:5060

ACK    : UAC1-----> Kamailio-1:5060----->Kamailio-2:5061--->Asterisk:10432

200 OK:  UAC1<----- Kamailio-1:5060<-----Kamailio-2:5061<---Asterisk:5060

ACK    : UAC1-----> Kamailio-1:5060----->Kamailio-2:5061--->Asterisk:10432

Retransmission.......


Here is ACK packet, is it about port on RU?


Asteriskip:5060----------->Kamailio2-ip:5061

SIP/2.0 200 OK
Via: SIP/2.0/UDP kamailio2-ip:5061;branch=z9hG4bK4d2f.837f45483db59574c4dd70f70f8d0099.0;received=kamailio2-ip;rport=5061
Via: SIP/2.0/UDP kamailio1-ip-main;branch=z9hG4bK4d2f.fb781e8caa5f96426c82530a23c0cc97.0
Via: SIP/2.0/UDP uacip:5060;received=uacip;branch=z9hG4bK143c7384;rport=10432
Record-Route: <sip:kamailio2-ip:5061;lr;ftag=as1c529e28;did=304.35c1;vsf=AAAAAAoBAQMLBQ4GAQN2A3kDFgQYABYeGRoyMDM->
Record-Route: <sip:kamailio1-ip-main;lr;ftag=as1c529e28>
From: 903122977162 <sip:903122977162@kamailio2-ip>;tag=as1c529e28
To: <sip:03129110911@tstxyz.netgsm.com.tr>;tag=as39358508
Call-ID: 169f342556f4e956445dfe0e2ee8ecf2@uacip:5060
CSeq: 103 INVITE
Server: sipgw2
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Session-Expires: 1800;refresher=uas
Contact: <sip:10213129110911@kamailio2-ip:5060>
Content-Type: application/sdp
Require: timer
Content-Length: 305

v=0
o=root 455426546 455426546 IN IP4 kamailio2-ip
s=Asterisk PBX 11.21.2
c=IN IP4 kamailio2-ip
t=0 0
m=audio 15926 RTP/AVP 18 8 0 101
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20

Kamailio2-ip:5061----> Asterisk:10432
ACK sip:10213129110911@kamailio2-ip:10432 SIP/2.0
Via: SIP/2.0/UDP kamailio2-ip:5061;branch=z9hG4bK4d2f.deb7bd96617c7067212dbc1673a216d2.0
Via: SIP/2.0/UDP kamailio1-ip-main;branch=z9hG4bK4d2f.acd6ee83df5babb9e8f53268a4b1b948.0
Via: SIP/2.0/UDP uacip:5060;received=uacip;branch=z9hG4bK59e2e846;rport=10432
Max-Forwards: 68
From: <sip:903122977162@kamailio2-ip>;tag=as1c529e28
To: <sip:03129110911@tstxyz.netgsm.com.tr>;tag=as39358508
Call-ID: 169f342556f4e956445dfe0e2ee8ecf2@uacip:5060
CSeq: 103 ACK
User-Agent: Asterisk PBX 11.21.2
Content-Length: 0



ietf :

If the INVITE request whose response is being acknowledged had Route
   header fields, those header fields MUST appear in the ACK.  This is
   to ensure that the ACK can be routed properly through any downstream
   stateless proxies.


_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio World Conference, Berlin, May 18-20, 2016 - http://www.kamailioworld.com