OpenSIPS/opensips — pull request #366 by dsanders11 (2014-10-20 11:12:22+00:00)
Title: Changes to stop keepalives on unregisters

Observed cases where keepalives from `nat_traversal` continued after unregister were traced back to a few lines of code which prevented stopping keepalives on unregister events.

There are three main changes here:
1. Allow `SIP_Registration_update` to decrease a keepalive time
2. If a successful register reply has no contact field assume no remaining contacts exist and stop keepalives
3. If a successful register reply has no contacts which match the request then it was an unregister and stop keepalives

These changes have been in use in a high traffic production environment for two years now with no known ill effect. Logic should still be double checked to ensure the changes are general enough to incorporate back into OpenSIPS.