<ul>
<li>The presence implementation is a little dubious, to say the least.
It probably wants re-writing at some stage. However, this fixes a
race condition that could have a number of causes in which the PUA
is unaware of the eTag at the point it sends the PUBLISH.</li>
</ul>

<p>The mechanism is such that the PUA passes the eTag that should be updated in the database into a main Kamailio process via a header in the PUBLISH. It is made aware of the new eTag by the main Kamailio process in the 200 OK.</p>

<p>In the scenario when the PUA has not received the 200 OK for the <code>Trying</code> <code>PUBLISH</code> before it sends the <code>early</code> <code>PUBLISH</code>, it will send the <code>early</code> PUBLISH with no eTag. This results in both <code>Trying</code> and <code>early</code> being inserted into the database. Only the <code>early</code> is updated, as it is the most recent, meaning the <code>Trying</code> will stick around in the table until it expires.</p>

<hr>

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

<h4>Commit Summary</h4>
<ul>
  <li>presence: Always check if a record exists for this dialog before inserting</li>
</ul>

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

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/kamailio/kamailio/pull/724.patch'>https://github.com/kamailio/kamailio/pull/724.patch</a></li>
  <li><a href='https://github.com/kamailio/kamailio/pull/724.diff'>https://github.com/kamailio/kamailio/pull/724.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/724">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AF36ZYhLxOS9X_YHOA-fIzQlL4dUwXaoks5qYJP_gaJpZM4JSnOj">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AF36ZaU_eFeiJA43v8KGg8bi3QxBc9ufks5qYJP_gaJpZM4JSnOj.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/724"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>