For what it is worth, here is my xhttp event_route (works with Bria,
Jitsi, and some OMA clients):

event_route[xhttp:request] {
        xlog("L_INFO", "$rm: event_route[xhttp:request]\n");
        xdbg("===== xhttp: request [$rv] $rm => $hu\n");

        if($hu=~"^/xcap-root/") {
                set_reply_close();
                set_reply_no_connect();

                # Jitsi...
                if ($hu=~"^/xcap-root/resource-lists/users/.*/index$")
                        $var(doc_uri) = 
$(hu{re.subst,/(^\/xcap-root\/resource-lists\/users
\/.*\/).*$/\1generallist.xml/});
                else if ($hu=~"^/xcap-root/pres-rules/users/.*/presrules$")
                        $var(doc_uri) = 
$(hu{re.subst,/(^\/xcap-root\/)pres-rules(\/users\/.*
\/)presrules/\1org.openmobilealliance.pres-rules\2pres-rules/});
                else if ($hu=~"^/xcap-root/oma_status-icon/users/.*/.*$")
                        $var(doc_uri) = $(hu{re.subst,/(^\/xcap-root
\/)oma_status-icon(\/users\/.*\/).*
$/\1org.openmobilealliance.pres-content\2oma_status-icon\/preseImage/});
                # Bria...
                else if
($hu=~"^/xcap-root/resource-lists/users/.*/contacts-resource-list.xml$")
                        $var(doc_uri) = 
$(hu{re.subst,/(^\/xcap-root\/resource-lists\/users
\/.*\/).*$/\1generallist.xml/});
                else if 
($hu=~"^/xcap-root/resource-lists/users/.*/resource-list.xml
$")
                        $var(doc_uri) = 
$(hu{re.subst,/(^\/xcap-root\/resource-lists\/users
\/.*\/).*$/\1generallist.xml/});
                # No modification required...
                else
                        $var(doc_uri) = $hu;

                # xcap ops
                $xcapuri(u=>data) = $var(doc_uri);
                if($xcapuri(u=>xuid)=~"^sip:.+@.+")
                        $var(uri) = $xcapuri(u=>xuid);
                else if($xcapuri(u=>xuid)=~".+@.+")
                        $var(uri) = "sip:" + $xcapuri(u=>xuid);
                else
                        $var(uri) = "sip:"+ $xcapuri(u=>xuid) + "@" + $Ri;

                xlog("L_INFO", "  $var(doc_uri) requested by $var(uri)\n");

                if($xcapuri(u=>auid)=="xcap-caps") {
                        $var(xbody) =
"<?xml version='1.0' encoding='UTF-8'?>
<xcap-caps xmlns='urn:ietf:params:xml:ns:xcap-caps'>
  <auids>
    <auid>rls-services</auid>
    <auid>pidf-manipulation</auid>
    <auid>xcap-caps</auid>
    <auid>resource-lists</auid>
    <auid>pres-rules</auid>
    <auid>org.openmobilealliance.pres-rules</auid>
    <auid>org.openmobilealliance.user-profile</auid>
    <auid>org.openmobilealliance.pres-content</auid>
  </auids>
  <extensions>
  </extensions>
  <namespaces>
    <namespace>urn:ietf:params:xml:ns:rls-services</namespace>
    <namespace>urn:ietf:params:xml:ns:pidf</namespace>
    <namespace>urn:ietf:params:xml:ns:xcap-caps</namespace>
    <namespace>urn:ietf:params:xml:ns:resource-lists</namespace>
    <namespace>urn:ietf:params:xml:ns:pres-rules</namespace>
    <namespace>urn:oma:xml:xdm:user-profile</namespace>
    <namespace>urn:oma:xml:prs:pres-content</namespace>
  </namespaces>
</xcap-caps>";
                        xhttp_reply("200", "OK", "application/xcap-caps+xml",
                                        "$var(xbody)");
                        exit;
                }

#!ifdef WITH_XHTTPAUTH
        if (!www_authenticate("$(xcapuri(u=>xuid){uri.host})", "subscriber")) {
                www_challenge("$(xcapuri(u=>xuid){uri.host})", "0");
                exit;
        }
        if ($retcode == 2) {
                xhttp_reply("403", "Forbidden", "", "");
                exit;
        }
#!endif

                switch($rm) {
                        case "PUT":
#!ifdef WITH_XHTTPAUTH
                                # be sure only auth user updates its documents
                                if ($au!=$(var(uri){uri.user})) {
                                        xhttp_reply("403", "Forbidden", "", "");
                                        exit;
                                }
#!endif 
                                xcaps_put("$var(uri)", "$var(doc_uri)", "$rb");
                                if($xcapuri(u=>auid)=~"pres-rules") {
                                        pres_update_watchers("$var(uri)", 
"presence");
                                        pres_refresh_watchers("$var(uri)", 
"presence", 1);
                                } else if ($xcapuri(u=>auid)=~"resource-lists") 
{
                                        rls_update_subs("$var(uri)", 
"presence");
                                }
                                exit;
                        break;
                        case "GET":
#!ifdef WITH_XHTTPAUTH
                                $var(furi) = "sip:" + $au + "@" + $ar;
                                if ($au!=$(var(uri){uri.user})) {
                                        # be sure only auth user gets its 
non-profile documents
                                        if (!($xcapuri(u=>auid)=~"user-profile" 
||
$xcapuri(u=>auid)=~"pres-content")) {
                                                xhttp_reply("403", "Forbidden", 
"", "");
                                                exit;
                                        } else {
                                        # be sure only permitted user gets 
others profile documents
                                                pres_auth_status("$var(furi)", 
"$var(uri)");
#!ifdef WITH_PROFILEAUTHONLY
                                                if ($retcode != 1) {
#!else
                                                if ($retcode == 3) {
#!endif
                                                        xhttp_reply("403", 
"Forbidden", "", "");
                                                        exit;
                                                }
        
                                        }
                                
                                }
#!endif 
                                xcaps_get("$var(uri)", "$var(doc_uri)");
                                exit;
                        break;
                        case "DELETE":
#!ifdef WITH_XHTTPAUTH
                                # be sure only auth user deletes its documents
                                if ($au!=$(var(uri){uri.user})) {
                                        xhttp_reply("403", "Forbidden", "", "");
                                        exit;
                                }
#!endif 
                                xcaps_del("$var(uri)", "$var(doc_uri)");
                                if($xcapuri(u=>auid)=~"pres-rules") {
                                        pres_update_watchers("$var(uri)", 
"presence");
                                        pres_refresh_watchers("$var(uri)", 
"presence", 1);
                                } else if ($xcapuri(u=>auid)=~"resource-lists") 
{
                                        rls_update_subs("$var(uri)", 
"presence");
                                }
                                exit;
                        break;
                }
        }

        # http ops
        xhttp_reply("404", "Not Found", "", "");
        exit;
}

On Tue, 2011-10-04 at 14:58 +0100, Peter Dunkley wrote:

> There is a limit of 64kb on documents in the DB.
> 
> Andy Miller recently added a new configuration file option
> (sql_buffer_size) that lets you change that.
> 
> Increasing the SQL buffer size and using the reg-ex's that I put in my
> last email should enable you to have avatars/icons with Jitsi.
> 
> Regards,
> 
> Peter
> 
> On Tue, 2011-10-04 at 14:54 +0300, Juha Heinanen wrote: 
> 
> > Daniel-Constantin Mierla writes:
> > 
> > > are the operations related to this only about storing/updating/fetching 
> > > and removing some xml file/parts per user? If yes, then just the XCAP 
> > > URL parser should be extended to support the auid, so it should not be 
> > > complex at all.
> > 
> > i started to work on it.  when i try to put an icon to xcap server, i
> > get errors
> > 
> > Oct  4 14:45:07 sip /usr/sbin/pres-serv[15261]: ERROR: <core> 
> > [tcp_read.c:321]: ERROR: tcp_read: buffer overrun, dropping
> > Oct  4 14:45:07 sip /usr/sbin/pres-serv[15261]: ERROR: <core> 
> > [tcp_read.c:882]: ERROR: tcp_read_req: error reading 
> > Oct  4 14:45:07 sip /usr/sbin/pres-serv[15262]: ERROR: <core> 
> > [tcp_read.c:321]: ERROR: tcp_read: buffer overrun, dropping
> > Oct  4 14:45:07 sip /usr/sbin/pres-serv[15262]: ERROR: <core>
> > [tcp_read.c:882]: ERROR: tcp_read_req: error reading
> > 
> > size of the icon is 61572 bytes and content length containing base64
> > encoded icon is 83285 bytes.  is that too much for sip router or
> > what could the problem be?
> > 
> > during put operation, wireshark shows lots of red, which means
> > tcp.flags.reset eq 1.
> > 
> > -- juha
> > 
> > _______________________________________________
> > sr-dev mailing list
> > [email protected]
> > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
> 
> 
> _______________________________________________
> sr-dev mailing list
> [email protected]
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
> 

-- 
Peter Dunkley
Technical Director
Crocodile RCS Ltd
_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to