<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF">
After removing the 'CONSTRAINT presentity_idx UNIQUE<span class="moz-txt-citetags">
</span>(username, domain, event, etag)' from the presentity table I get these errors:<br>
<br>
"Oct  9 11:04:11 tuna /usr/sbin/kamailio[5513]: ERROR: presence [presentity.c:1229]: mark_presentity_for_delete(): Found 2 presentities - expected 1"<br>
<br>
which is consistent with the constraint which insists unique username-domain-event-etag combinations. This constraint would have been fine for the case when multiple clients use the same credentials and each publishes its statuses, if the clearing process didn't
 change the etag of expired presentity entries to the same *#-OFFLINE-#*. <br>
<br>
Maybe it would be good to include the original etag for the expired entries, e.g. '*#-OFFLINE-#*-orig_etag' rather than just '*#-OFFLINE-#*', in which case these errors won't occur, since the original etags (orig_etag) are unique.<br>
<pre>Yufei
</pre>
<br>
<div class="moz-cite-prefix">On 08/10/13 13:54, Yufei Tao wrote:<br>
</div>
<blockquote type="cite">Thank you Juha for your replies!<br>
<br>
>From RFC3856: <br>
<pre>A Presence Event Package for the Session Initiation Protocol (SIP)</pre>
<br>
<pre>6.11.  State Agents

   RFC 3265 [2] requires each package to consider the role of state
   agents in the package, and if they are used, to specify how
   authentication and authorization are done.

   State agents are core to this package.  Whenever the PA is not
   co-located with the PUA for the presentity, the PA is acting as a
   state agent.  It collects presence state from the PUA, and aggregates
   it into a presence document.  Because there can be multiple PUA, a
   centralized state agent is needed to perform this aggregation.  That
   is why state agents are fundamental to presence.  Indeed, they have a
   specific term that describes them - a presence server.</pre>
<br>
Seems the presence server needs to aggregate statuses from different PUAs for the same presentity into a single presence document, if I understand it correctly? Anyway it is not what happens currently with Kamailio 4.0.3 unless I'm missing anything.<br>
<br>
Cheers,<br>
Yufei<br>
<br>
<div class="moz-cite-prefix">On 08/10/13 11:00, <a class="moz-txt-link-abbreviated" href="mailto:sr-users-request@lists.sip-router.org">
sr-users-request@lists.sip-router.org</a> wrote:<br>
</div>
<blockquote type="cite">
<pre>Message: 2
Date: Mon, 7 Oct 2013 13:31:17 +0300
From: Juha Heinanen <a class="moz-txt-link-rfc2396E" href="mailto:jh@tutpro.com"><jh@tutpro.com></a>
To: "Kamailio \(SER\) - Users Mailing List"
        <a class="moz-txt-link-rfc2396E" href="mailto:sr-users@lists.sip-router.org"><sr-users@lists.sip-router.org></a>
Subject: Re: [SR-Users] Presence: Duplicate entry
        'username-domain-presence-*#-OFFLINE-#*' for key 'presentity_idx' when
        multiple clients register using the same credentials
Message-ID: <a class="moz-txt-link-rfc2396E" href="mailto:21074.36213.575240.614265@siika.tutpro.com"><21074.36213.575240.614265@siika.tutpro.com></a>
Content-Type: text/plain; charset=us-ascii

Yufei Tao writes:

</pre>
<blockquote type="cite" style="font-size:large; color:#000000">
<pre><span class="moz-txt-citetags">> </span>When a client (S) subscribes to this contact (username@domain) whose
<span class="moz-txt-citetags">> </span>credentials are used by two clients, (S) gets NOTIFYs containing
<span class="moz-txt-citetags">> </span>statuses from either of the username@domain contacts in alternation. But
<span class="moz-txt-citetags">> </span>all these NOTIFYs have the same call-id.
<span class="moz-txt-citetags">> </span>
<span class="moz-txt-citetags">> </span>I've tried remove the constraint 'CONSTRAINT presentity_idx UNIQUE
<span class="moz-txt-citetags">> </span>(username, domain, event, etag)' from the presentity table and the
<span class="moz-txt-citetags">> </span>errors have gone away. Just wondering if this is something that <b class="moz-txt-star"><span class="moz-txt-tag">*</span>should<span class="moz-txt-tag">*</span></b>
<span class="moz-txt-citetags">> </span>be done to cope with the situation where multiple presentities use the
<span class="moz-txt-citetags">> </span>same credentials.
</pre>
</blockquote>
<pre>before knowing how to answer to that, i would like to know what presence
rfcs say about this situation, i.e., is current kamailio presence
implementation somehow broken when an aor (= presentity) has several
active contacts.

should notify give status of both contacts separately or should presence
server try somehow to combine status of the contacts into a single
notify?  what does it mean if one contact tells that it is offline and
another online?  should presence server send only one notify telling
that the presentity is online (since it is if one contact tells so)?

-- juha</pre>
</blockquote>
<pre>On 05/10/13 11:00, <a class="moz-txt-link-abbreviated" href="mailto:sr-users-request@lists.sip-router.org">sr-users-request@lists.sip-router.org</a> wrote:
</pre>
<blockquote type="cite" style="font-size:large; color:#000000">
<pre>Hi

I use kamailio 4.0.3 with presence. I sometimes get these errors:

Oct  4 09:26:24 server /usr/sbin/kamailio[1292]: ERROR: presence
[publish.c:171]: msg_presentity_clean(): Marking presentity
Oct  4 09:26:34 server /usr/sbin/kamailio[1292]: ERROR: db_mysql
[km_dbase.c:122]: db_mysql_submit_query(): driver error on query:
Duplicate entry 'username-domain-presence-*#-OFFLINE-#*' for key
'presentity_idx'
Oct  4 09:26:34 server /usr/sbin/kamailio[1292]: ERROR: <core>
[db_query.c:337]: db_do_update(): error while submitting query
Oct  4 09:26:34 server /usr/sbin/kamailio[1292]: ERROR: presence
[presentity.c:1281]: mark_presentity_for_delete(): unsuccessful sql
update operation

This is when multiple SIP clients are registered using the same
credentials, they each have a presentity entry, with the same username
and domain but different etags, which is fine. But when they expire, the
presentity.etag will be filled with '*#-OFFLINE-#*', and when both
expire at about the same time, kamailio tries to fill both with the same
'*#-OFFLINE-#*' etag. Because presentity table has a 'CONSTRAINT
presentity_idx UNIQUE (username, domain, event, etag)', this gives the
errors.

Should the constraint be removed to cope with this situation?

Thank you!
Yufei</pre>
</blockquote>
<br>
</blockquote>
<br>
--<br>
<b>Yufei Tao</b><br>
<font size="small">Red Embedded <br>
</font>
<h5><font color="gray">
<p>This E-mail and any attachments hereto are strictly confidential and intended solely for the addressee. If you are not the intended addressee please notify the sender by return and delete the message.</p>
<p>You must not disclose, forward or copy this E-mail or attachments to any third party without the prior consent of the sender.</p>
<p>Red Embedded Design, Company Number 06688253 Registered in England: The Waterfront, Salts Mill Rd, Saltaire, BD17 7EZ</p>
</h5>
</font>
</body>
</html>