PJSIP: Failover conditions when using DNSSRV

Hi there,

I’ve got Asterisk 16.11.1 configured with PJSIP like this:

Relevant lines from pjsip.conf:



The kamailio.domain.tld SRV records return two IP addresses, specifying UDP transport.

This works great. Asterisk load balances between them, fails over to to the next one in case of timeout. However there are are also other cases where it fails over, such on certain 400-499 range responses like 408 Request Timeout.

Is there any way to control these conditions? I don’t want asterisk to attempt a failover on any 400-range response. Only on connection timeouts and possibly certain 500-range errors.

Another related issue, that seems like a bug to me, and I only found it because I had a kamailio server with a messed up configuration in my development environment:

  1. Asterisk sends a SIP INVITE out to kamailio
  2. Asterisk sends a SIP CANCEL, to cancel that invite.
  3. Kamailio at this point then responds with first 200 cancelling, then 408 Request Timeout (which is obviously wrong), but Asterisk in this case still failed over and tried the next server in the SRV Records with the same INVITE - even though the call had been cancelled by asterisk previously, essentially creating a ghost call.

There is no configuration for the conditions under which failover occurs. If failover occurs after CANCEL is sent, then that would be a bug that should be reported.

Hi jcolp,

Is there a list somewhere of response codes that cause a failover - perhaps in the source code?

I’ll file a bug report when I’ve verified that the bug is present in the most recent version of Asterisk 16.

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