I have done one setup below:
I have installed one Kamailio server and two Asterisk servers. Asterisks are configured with PJSIP realtime and PJSIP realtime users are getting registered with Kamailio IP Fine. Calls are coming fine to the both Asterisk servers with dispatcher module and working good with audio both sides. SIP users are registered with Kamailio IP and media service is working on Asterisk.
The issue I am facing randomly is some calls are getting auto hangup after 30 seconds.
My Call Pattern: 102 → INVITE → KAMAILIO → ASTERISK → Play hello world → Dial(PJSIP/kamtrunk/sip:101@KAMAILIO_IP:5060) → Rings 101 → Answer call
I have given sngrep trace images for both error call and working call below.
I assume problem happens during dialing endpoint back to Kamailio from Asterisk dialplan as per mentioned above Dial string. In that case I am not sure WHY it sends multiple 200 OK even it acknowledges it already. Call is established and both side audio working but after 30 seconds call hangup. This happens randomly. I am using Zoiper as softphone.
The 200 OK is coming from 188.8.131.52 via UDP. The Contact header in it is 184.108.40.206 port 47114 using TCP. Asterisk is sending the ACK to the location specified in the Contact header. It’s presumably not able to connect / send. If that traffic is supposed to go through the proxy then you need to use record routing.