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

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

<p>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.</p>

<hr>

<h4>You can merge this Pull Request by running</h4>
<pre>  git pull https://github.com/dsanders11/opensips patch-2</pre>
<p>Or view, comment on, or merge it at:</p>
<p>&nbsp;&nbsp;<a href='https://github.com/OpenSIPS/opensips/pull/366'>https://github.com/OpenSIPS/opensips/pull/366</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>Changes to stop keepalives on unregisters</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/OpenSIPS/opensips/pull/366/files#diff-0">modules/nat_traversal/nat_traversal.c</a>
    (20)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/OpenSIPS/opensips/pull/366.patch'>https://github.com/OpenSIPS/opensips/pull/366.patch</a></li>
  <li><a href='https://github.com/OpenSIPS/opensips/pull/366.diff'>https://github.com/OpenSIPS/opensips/pull/366.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/OpenSIPS/opensips/pull/366">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/5479561__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcyOTQyMjc0NCwiZGF0YSI6eyJpZCI6NDYzMDA3MTh9fQ==--96bfae839330feb5f5485715425390128ef98227.gif" width="1" /></p>
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"View this Pull Request on GitHub","action":{"@type":"ViewAction","url":"https://github.com/OpenSIPS/opensips/pull/366","name":"View Pull Request"}}</script>