PJSIP realtime - Call hangup after 30 seconds

Hi,
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.
Error Call:

Working Call:

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.

You need to show actual SIP trace from Asterisk itself using “pjsip set logger on”. In general though it means the ACK did not arrive, or it was invalid in some way.

Ok,
I am sharing pjsip log in details as below.

The 200 OK is coming from 64.227.161.123 via UDP. The Contact header in it is 49.14.164.154 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.

Ok,
Now I am using UDP in Kamailio and Asterisk both side. Also I kept like below in Kamailio for INVITE request.

if(method==“INVITE”){
record_route();
setflag(FLT_ACC);
setflag(FLT_ACCFAILED);
setflag(FLT_ACCMISSED)
}

Now, I am testing and checking with multiple calls to reproduce the issue. Thanks for your reply!! I will share more testing results if needed.

Hi jcolp,
The changes above worked for me and call working fine. Thanks for the help. I have one more setup in that Asterisk and Kamailio both are on same server. Below is call flow.

Call Setup: 102 → INVITE → KAMAILIO → ASTERISK → Play hello world → Dial(PJSIP/kamtrunk/sip:101@10.131.31.16:5090) → Rings 101 → Answer call

Asterisk is at : 45.118.163.244:5080 (10.131.31.16:5080)
Kamailio is at : 45.118.163.244:5090 (10.131.31.16:5090)

I have given link for PJSIP call log in detail as below:

Here I am facing issue of no voice from either end of softphone and also call auto hangup after 30 seconds.

Please check the logs above and help me what I am doing wrong. Thanks.

I would suggest looking at the logs yourself, the IP addresses, where traffic is going, seeing if that’s correct or not. These are skills you need if you are using Asterisk and Kamailio.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.