res_pjsip_registrar: Remove unavailable contacts if exceeds max_contacts

The behavior of max_contacts and remove_existing are connected.  If
remove_existing is enabled, the soonest expiring contacts are removed.
This may occur when there is an unavailable contact.  Similarly,
when remove_existing is not enabled, registrations from good
endpoints are rejected in favor of retaining unavailable contacts.

This commit adds a new AOR option remove_unavailable, and the effect
of this setting will depend on remove_existing.  If remove_existing
is set to no, we will still remove unavailable contacts when they
exceed max_contacts, if there are any. If remove_existing is set to
yes, we will prioritize the removal of unavailable contacts before
those that are expiring soonest.

ASTERISK-29525

Change-Id: Ia2711b08f2b4d1177411b1be23e970d7fdff5784
This commit is contained in:
Joseph Nadiv
2021-07-21 17:36:03 -04:00
committed by Friendly Automation
parent 35a94ec708
commit 6a04c43035
7 changed files with 187 additions and 9 deletions

View File

@@ -1109,6 +1109,16 @@
; contact created by rewrite_contact that the device is
; refreshing.
; (default: "no")
;remove_unavailable=no ; If remove_existing is disabled, will allow a registration
; to succeed by removing only unavailable contacts when
; max_contacts is exceeded. This will reject a registration
; that exceeds max_contacts if no unavailable contacts are
; present to remove. If remove_existing is enabled, will
; prioritize removal of unavailable contacts before removing
; expiring soonest. This tames the behavior of remove_existing
; to only remove an available contact if an unavailable one is
; not present.
; (default: "no")
;type= ; Must be of type aor (default: "")
;qualify_frequency=0 ; Interval at which to qualify an AoR via OPTIONS requests.
; (default: "0")