Asterisk sending qualify packets to expired contacts

Asterisk 16.17 PJSIP endpoints with max_contacts > 1:

There are 3 registered endpoints for this extension. Asterisk is sending outbound OPTIONS (qualify is set on the AOR for 60 seconds) to both those 3 contacts, as well as expired contacts on a different IP address that no longer exist.

I believe this problem started because I have remove_existing set to no, and due to an IP address change, the devices could not reregister as they hit the max_contacts limit. I used a database deltree to remove the contacts to force a registration which worked, but somewhere along the line the old IP is still cached somewhere and an asterisk restart is not removing it.

Removing the contacts manually through manipulation of the AstDB does not alter the state of the OPTIONS functionality, I can’t think of an immediate way to remove them from the OPTIONS as well. Restarting Asterisk, if using strictly AstDB, should remove them. We don’t store them anywhere else. What does “pjsip show contacts” show?

It’s been 4 days so it doesn’t seem like this will eventually expire either… So now what?

‘pjsip show contacts’ only shows the correct info

Then I’d suggest a SIP trace from Asterisk, including enabling Asterisk core debug[1] to show what is going on. This is not something anyone else has reported.

[1] Collecting Debug Information - Asterisk Project - Asterisk Project Wiki

[ASTERISK-29504] PJSIP deltree contact still sending qualify packets - Digium/Asterisk JIRA