<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/4.2.3">
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#ffffff">
Hi Anca,<BR>
<BR>
Did you get any time to look at this?<BR>
<BR>
If you didn't I might have a chance over the next couple of days.<BR>
<BR>
Regards,<BR>
<BR>
Peter<BR>
<BR>
On Wed, 2012-04-11 at 17:30 +0300, Anca Vamanu wrote:<BR>
<BLOCKQUOTE TYPE=CITE>
    Hi Peter,<BR>
    <BR>
    <BR>
    Thanks for the feedback. <BR>
    <BR>
    I agree with extra parameters for pres_refresh_watchers(), so if type is 2 it can receive two optional parameters: file URL and file name.<BR>
    And also get_rules_doc function in presence_xml module has to be changed to be able to do include int the query file URL is given.<BR>
    <BR>
    I also have a busy schedule in the next period (with Easter and some holidays :) ), but I will try to implement this change in the next period. I don't think we need to worry about the freeze, as this is actually a fix, not a new feature. <BR>
    <BR>
    Regards,<BR>
    Anca<BR>
    <BR>
    <BR>
    On 04/11/2012 05:13 PM, Peter Dunkley wrote: <BR>
    <BLOCKQUOTE TYPE=CITE>
        Hi Anca,<BR>
        <BR>
        I hadn't realised this was already in presence_xml.&nbsp; I have added some comments below.<BR>
        <BR>
        I would like to make these changes, but it could be a couple of weeks before I have time.&nbsp; Given that there is a freeze coming up in two weeks what do you think should be done in the short-term?<BR>
        <BR>
        On Wed, 2012-04-11 at 16:55 +0300, Anca Vamanu wrote:<BR>
        <BLOCKQUOTE TYPE=CITE>
            The good think about my solution was that I left the XCAP document fetch part in <B>presence_xml</B> module. I think it is better like this because the <B>presence</B> module remains independent of the XCAP part. And more than this, it works for both integrated and not integrated XCAP server ( because it uses the generic API of fetching XCAP documents) and even for any event (not only presence). <BR>
            <BR>
        </BLOCKQUOTE>
        I can see that presence_xml is a more logical place to put some of this implementation.<BR>
        <BR>
        <BLOCKQUOTE TYPE=CITE>
            Here I like better that you have fetched the document and stored it in presentity table with expires -1.<BR>
            <BR>
            As for the fact that you added a new function to be called from the script when to fetch and store this document (pres_update_presentity), I think it would have been better to use the existing <B>pres_refresh_watchers</B> function. If you look in the documentation, actually when type!= 0 , a pidf manipulation document change might be expected:<BR>
            <BR>
            <A HREF="http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sip-router;a=blob;f=modules_k/presence/README;h=25de125997927321c63938e5a013f93c10b86379;hb=refs/heads/master">http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sip-router;a=blob;f=modules_k/presence/README;h=25de125997927321c63938e5a013f93c10b86379;hb=refs/heads/master</A><BR>
            <BR>
            The reason why it is better to use this function is that it is actually called by the refereshWatchers MI command and we will maintain the compatibility with other external XCAP servers that use this MI command. We can also put a specific type, let's say type=2 for pidf manipulation document change and type=1 for presentity table change.<BR>
        </BLOCKQUOTE>
        I do agree with this.<BR>
        <BR>
        <BLOCKQUOTE TYPE=CITE>
            When <B>pres_refresh_watchers</B> is called with<B> </B>type=<B>2</B> , try to fetch the pidf manipulation document from xcap server and if found, store it in presentity table with expires=-1 (as you have done). The only thing that I would change is to use a wrapper over <B>get_rules_doc</B> function from presence_xml module. We can do this adding a new field in the pres_ev_t structure (exactly as get_rules_doc field).<BR>
            <BR>
            Then continue with the query_db_notify(pres,&nbsp;ev,&nbsp;NULL) function which will also be called if type=1.<BR>
            <BR>
            And to maintain compatibility for refereshWatchers function we can call from here pres_referesh_watchers with type=2, considering that also a pidf manipulation document <BR>
        </BLOCKQUOTE>
        This makes sense to me.<BR>
        <BR>
        <BLOCKQUOTE TYPE=CITE>
            The only thing that I don't know is how to keep from your implementation is the possibility for a user to have multiple pidf documents. I saw that you use the URL to fetch from xcap table and the file name as ETAG to offer the possibility of storing multiple pidf documents. However my question is actually whether this use case is actually possible? Why would a user have more permanent state documents at the same time?<BR>
        </BLOCKQUOTE>
        I did this because I know (from experience) that many different clients use slightly different file names for the documents they store in XCAP.&nbsp; This doesn't matter so much for pres-rules, avatars, user-profiles, and resource-lists because the XML content of the documents is still the same regardless of name.&nbsp; With presentities it is a bit different.&nbsp; This is because different clients can (and do) use different XML nodes for things like &lt;busy/&gt;, &lt;available/&gt;, &lt;vacation/&gt;, as well as supporting and displaying different fields like emoticons, notes, URLs.&nbsp; This means that although different clients that support hard-state will both generate PIDF XML the fields within those XML documents could vary widely.<BR>
        <BR>
        Supporting multiple documents for a subscriber at least leaves open the possibility that someone who uses different clients (one on Windows at work, one on Linux at home, perhaps) wouldn't be in the situation of having one client simply dropping stuff the other had PUBLISHed.<BR>
        <BR>
        For example, the presence client I tested this development with (which doesn't support hard-state anyway - I had to use curl to upload the document) didn't support the &lt;vacation/&gt; status from RFC 4827, and therefore didn't display it (I had to confirm the NOTIFYs were correct with a Wireshark trace).<BR>
        <BR>
        Could this ETag stuff be supported by giving an extra (optional) parameter to pres_refresh_watchers() called ETag?<BR>
        <BR>
        Peter<BR>
        <BR>
        <TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<PRE>
-- 
Peter Dunkley
Technical Director
Crocodile RCS Ltd
</PRE>
</TD>
</TR>
</TABLE>
    </BLOCKQUOTE>
    <BR>
</BLOCKQUOTE>
<BR>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<PRE>
-- 
Peter Dunkley
Technical Director
Crocodile RCS Ltd
</PRE>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>