<p>presentity: don't update terminated presentity entries in the database</p>

<ul>
<li><p>This fix is pull requested based on the stuff in pull request <a href="https://github.com/kamailio/kamailio/pull/724" class="issue-link js-issue-link" data-url="https://github.com/kamailio/kamailio/issues/724" data-id="167011346" data-error-text="Failed to load issue title" data-permission-text="Issue title is private">#724</a>. That is because the stuff done here builds on that earlier work. <a href="https://github.com/kamailio/kamailio/pull/724" class="issue-link js-issue-link" data-url="https://github.com/kamailio/kamailio/issues/724" data-id="167011346" data-error-text="Failed to load issue title" data-permission-text="Issue title is private">#724</a> probably wants to be merged before this one.</p></li>
<li><p>Fixes a race condition caused by, for example, the call being answered at almost exactly the same time as the caller cancels. This causes a terminated state to change back to completed. The dialog is then removed from the database and the presentity entry stays in place until it expires.</p></li>
<li>This fix explicitly prevents terminated entries being updated as the state machine in RFC 4235 prohibits this behaviour.</li>
</ul>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/kamailio/kamailio/pull/726'>https://github.com/kamailio/kamailio/pull/726</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>presence: Always check if a record exists for this dialog before inserting</li>
  <li>presence: fix memory leak introduced by last commit</li>
  <li>presence: log when presentity is deleted due to already existing</li>
  <li>presentity: don't update terminated presentity entries in the database</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/kamailio/kamailio/pull/726/files#diff-0">modules/presence/presentity.c</a>
    (297)
  </li>
</ul>

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

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/pull/726">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AF36ZeUJZ4E9Rs7Bubp3W-3X5KWONmSsks5qZ2YfgaJpZM4JWOfG">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AF36ZWqZRdRTaIFYHNU6OXLc09JC5YxIks5qZ2YfgaJpZM4JWOfG.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/kamailio/kamailio/pull/726"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>