I’ve got Asterisk 16.11.1 configured with PJSIP like this:
Relevant lines from pjsip.conf:
[transport-udp] type=transport bind=@LOCAL_ADDRESS:5060 protocol=udp allow_reload=yes [registrar] type=aor contact=kamailio.domain.tld
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:
- Asterisk sends a SIP INVITE out to kamailio
- Asterisk sends a SIP CANCEL, to cancel that invite.
- 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.