Call Flow setup - Asterisk ACK processing issue

Hello,
I have one setup of Kamailio and Asterisk. Kamailio handling SIP registration and authentication, Asterisk handles media service. So when I register webphones in JSSIP I can receive incoming calls on it and call working fine with voice flow both sides, call flow is getting setup perfect. But same case in not working in aone another web SIP client which is also based on JSSIP library. I figured out ACK messeage is not getting processed properly and premature call happens with voice, but don’t know why it is happening like this. I have attached logs for both cases. Please look into it and please guide me what is wrong or missing inside. Thanks. Kindly please help on this call flow setup, one is working fine but another is not working for same server configuration. Below are logs.

WORKING:

NOT WORKING:

The problem doesn’t appear to with Asterisk; the ACK isn’t reaching, and there are no significant differences in the way it is handling the call.

I’d investigate the proxies at 54.172.60.1 and 54.172.60.0 as the former seems to be in the path when it goes wrong. It and 20.219.4.216 are staying itn the path, for the ACK, by using Record-Route, but, what I assume is your Kamailio, 10.2.1.9, is dropping out.

I taken logs again and found below differences only. Not sure what is wrong and what need to change. It is working on https://tryit.jssip.net/ BUT same thing is not working on another webphone client which is also based on JSSIP. In case of that online jssip link it generates some uniqueid “bhk8a2hm@723gsodbcesr.invalid” not sure that is something useful. Please guide what is wrong or need to change.

200 OK RESPONSE DIFFERENCES:

WORKING:
Contact: sip:bhk8a2hm@723gsodbcesr.invalid;alias=103.81.92.39~21610~6;transport=ws
c=IN IP4 103.81.92.39

NOT WORKING:
Contact: sip:129@20.219.4.216:8089;alias=103.81.92.39~21676~6
c=IN IP4 192.168.0.104

ACK RESONSE DIFFERENCES:

WORKING:
ACK sip:bhk8a2hm@723gsodbcesr.invalid;transport=ws;alias=103.81.92.39~21610~6 SIP/2.0

NOT WORKING:
ACK sip:129@20.219.4.216:8089;alias=103.81.92.39~21676~6 SIP/2.0

This is web sockets, so is forced to use the original TCP connection and Contact information is basically bogus, just to satisfy the syntax.

Ok, But the ACK below is not working for me.
ACK sip:129@20.219.4.216:8089;alias=103.81.92.39~21676~6 SIP/2.0

Sending multiple times. As I shared logs before in pastebin.

This ACK is sent continuously and call hangup after some seconds. Though voice is working till the call connected. Not sure what is wrong with another webphone client. The ACK message is not getting reached. Can you suggest something to look into ?

Record-Route: <sip:20.219.4.216:8089;transport=ws;r2=on;lr=on;ftag=921e342e-7151-4c8f-89ff-fcef5aec93f8>

Asterisk is being asked to use a web sockets connection to which it is not party, for the remainder of the session. The only way of achieving that is for the machine that is party to the web sockets connection to stay in circuit, which means that your outbound proxy needs to add its own Record-Route headers. Obviously it also has to be stateful enough to retain the web sockets connection, and must remember to close it after it sees a BYE.

Ok,
I set contact_uri as random string (sip:bhk8a2hm@723gsodbcesr.invalid) in the REGISTER request. And call is working fine now in another webphone also, stay connected.

Thanks for this hint, this worked for me. It looks like some syntax satisfying only, not sure why this solution works, But yes it works for me now.