[sr-dev] git:master: modules_k/xcap_server: Updated example event_route[] in README

Peter Dunkley peter.dunkley at crocodile-rcs.com
Thu Oct 25 18:36:22 CEST 2012


Module: sip-router
Branch: master
Commit: aebeeee1993e4cce0d3288f1ccd8d17f3efee925
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=aebeeee1993e4cce0d3288f1ccd8d17f3efee925

Author: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Date:   Thu Oct 25 17:34:39 2012 +0100

modules_k/xcap_server: Updated example event_route[] in README

- Now includes:
  - updating of RLS subscriptions when RLS documents change
  - pidf-manipulation
  - clean handling of org.openmobilealliance.search
  - org.openmobilealliance.xcap-directory support

---

 modules_k/xcap_server/README                    |   63 +++++++++++++++++++-
 modules_k/xcap_server/doc/xcap_server_admin.xml |   69 ++++++++++++++++++++---
 2 files changed, 119 insertions(+), 13 deletions(-)

diff --git a/modules_k/xcap_server/README b/modules_k/xcap_server/README
index 81f931f..662d3e5 100644
--- a/modules_k/xcap_server/README
+++ b/modules_k/xcap_server/README
@@ -310,9 +310,11 @@ event_route[xhttp:request] {
             $var(uri) = "sip:"+ $xcapuri(u=>xuid) + "@" + $Ri;
 
         # handle XCAP capability request
-        if($rm=="GET" && $xcapuri(u=>auid)=="xcap-caps")
+        if($xcapuri(u=>auid)=="xcap-caps")
         {
-            $var(xbody) =
+            if ($rm == "GET")
+            {
+                $var(xbody) =
 "<?xml version='1.0' encoding='UTF-8'?>
 <xcap-caps xmlns='urn:ietf:params:xml:ns:xcap-caps'>
   <auids>
@@ -322,6 +324,10 @@ event_route[xhttp:request] {
     <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>
+    <auid>org.openmobilealliance.search</auid>
+    <auid>org.openmobilealliance.xcap-directory</auid>
   </auids>
   <extensions>
   </extensions>
@@ -331,10 +337,20 @@ event_route[xhttp:request] {
     <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>
+    <namespace>urn:oma:xml:xdm:search</namespace>
+    <namespace>urn:oma:xml:xdm:xcap-directory</namespace>
   </namespaces>
 </xcap-caps>";
-            xhttp_reply("200", "ok", "application/xcap-caps+xml",
-                    "$var(xbody)");
+                xhttp_reply("200", "ok", "application/xcap-caps+xml",
+                            "$var(xbody)");
+            }
+            else
+            {
+                append_to_reply("Allow: GET\r\n");
+                xhttp_reply("405", "Method Not Allowed", "", "");
+            }
             exit;
         }
         # be sure auth user access only its documents
@@ -353,6 +369,16 @@ event_route[xhttp:request] {
                     pres_update_watchers("$var(uri)", "presence");
                     pres_refresh_watchers("$var(uri)", "presence", 1);
                 }
+                else if($xcapuri(u=>auid)=~"rls-services" || $xcapuri(u=>auid)=~
+"resource-lists")
+                {
+                    rls_update_subs("$var(uri)", "presence");
+                }
+                else if($xcapuri(u=>auid)=~"pidf-manipulation")
+                {
+                    pres_refresh_watchers("$var(uri)", "presence", 2, "$xcapuri(
+u=>uri_adoc)", "$xcapuri(u=>file)");
+                }
                 exit;
             break;
             case "GET":
@@ -366,6 +392,35 @@ event_route[xhttp:request] {
                     pres_update_watchers("$var(uri)", "presence");
                     pres_refresh_watchers("$var(uri)", "presence", 1);
                 }
+                else if($xcapuri(u=>auid)=~"rls-services" || $xcapuri(u=>auid)=~
+"resource-lists")
+                {
+                    rls_update_subs("$var(uri)", "presence");
+                }
+                else if($xcapuri(u=>auid)=~"pidf-manipulation")
+                {
+                    pres_refresh_watchers("$var(uri)", "presence", 2, "$xcapuri(
+u=>uri_adoc)", "$xcapuri(u=>file)");
+                }
+                exit;
+            break;
+            case "POST":
+                if($xcapuri(u=>auid)=~"search")
+                {
+                    xhttp_reply("501", "Not Implemented", "", "");
+                }
+                else
+                {
+                    if($xcapuri(u=>auid)=~"xcap-directory")
+                    {
+                        append_to_reply("Allow: GET\r\n");
+                    }
+                    else
+                    {
+                        append_to_reply("Allow: DELETE, GET, PUT\r\n");
+                    }
+                    xhttp_reply("405", "Method Not Allowed", "", "");
+                }
                 exit;
             break;
         }
diff --git a/modules_k/xcap_server/doc/xcap_server_admin.xml b/modules_k/xcap_server/doc/xcap_server_admin.xml
index b0b4e8b..3196972 100644
--- a/modules_k/xcap_server/doc/xcap_server_admin.xml
+++ b/modules_k/xcap_server/doc/xcap_server_admin.xml
@@ -361,9 +361,11 @@ event_route[xhttp:request] {
             $var(uri) = "sip:"+ $xcapuri(u=>xuid) + "@" + $Ri;
 
         # handle XCAP capability request
-        if($rm=="GET" &amp;&amp; $xcapuri(u=>auid)=="xcap-caps")
+        if($xcapuri(u=>auid)=="xcap-caps")
         {
-            $var(xbody) =
+            if ($rm == "GET")
+            {
+                $var(xbody) =
 "&lt;?xml version='1.0' encoding='UTF-8'?&gt;
 &lt;xcap-caps xmlns='urn:ietf:params:xml:ns:xcap-caps'&gt;
   &lt;auids&gt;
@@ -373,19 +375,33 @@ event_route[xhttp:request] {
     &lt;auid&gt;resource-lists&lt;/auid&gt;
     &lt;auid&gt;pres-rules&lt;/auid&gt;
     &lt;auid&gt;org.openmobilealliance.pres-rules&lt;/auid&gt;
+    &lt;auid&gt;org.openmobilealliance.user-profile&lt;/auid&gt;
+    &lt;auid&gt;org.openmobilealliance.pres-content&lt;/auid&gt;
+    &lt;auid&gt;org.openmobilealliance.search&lt;/auid&gt;
+    &lt;auid&gt;org.openmobilealliance.xcap-directory&lt;/auid&gt;
   &lt;/auids&gt;
   &lt;extensions&gt;
   &lt;/extensions&gt;
   &lt;namespaces&gt;
-    &lt;namespace>urn:ietf:params:xml:ns:rls-services&lt;/namespace&gt;
-    &lt;namespace>urn:ietf:params:xml:ns:pidf&lt;/namespace&gt;
-    &lt;namespace>urn:ietf:params:xml:ns:xcap-caps&lt;/namespace&gt;
-    &lt;namespace>urn:ietf:params:xml:ns:resource-lists&lt;/namespace&gt;
-    &lt;namespace>urn:ietf:params:xml:ns:pres-rules&lt;/namespace&gt;
+    &lt;namespace&gt;urn:ietf:params:xml:ns:rls-services&lt;/namespace&gt;
+    &lt;namespace&gt;urn:ietf:params:xml:ns:pidf&lt;/namespace&gt;
+    &lt;namespace&gt;urn:ietf:params:xml:ns:xcap-caps&lt;/namespace&gt;
+    &lt;namespace&gt;urn:ietf:params:xml:ns:resource-lists&lt;/namespace&gt;
+    &lt;namespace&gt;urn:ietf:params:xml:ns:pres-rules&lt;/namespace&gt;
+    &lt;namespace&gt;urn:oma:xml:xdm:user-profile&lt;/namespace&gt;
+    &lt;namespace&gt;urn:oma:xml:prs:pres-content&lt;/namespace&gt;
+    &lt;namespace&gt;urn:oma:xml:xdm:search&lt;/namespace&gt;
+    &lt;namespace&gt;urn:oma:xml:xdm:xcap-directory&lt;/namespace&gt;
   &lt;/namespaces&gt;
 &lt;/xcap-caps&gt;";
-            xhttp_reply("200", "ok", "application/xcap-caps+xml",
-                    "$var(xbody)");
+                xhttp_reply("200", "ok", "application/xcap-caps+xml",
+                            "$var(xbody)");
+            }
+            else
+            {
+                append_to_reply("Allow: GET\r\n");
+                xhttp_reply("405", "Method Not Allowed", "", "");
+            }
             exit;
         }
         # be sure auth user access only its documents
@@ -404,6 +420,14 @@ event_route[xhttp:request] {
                     pres_update_watchers("$var(uri)", "presence");
                     pres_refresh_watchers("$var(uri)", "presence", 1);
                 }
+                else if($xcapuri(u=>auid)=~"rls-services" || $xcapuri(u=>auid)=~"resource-lists")
+                {
+                    rls_update_subs("$var(uri)", "presence");
+                }
+                else if($xcapuri(u=>auid)=~"pidf-manipulation")
+                {
+                    pres_refresh_watchers("$var(uri)", "presence", 2, "$xcapuri(u=>uri_adoc)", "$xcapuri(u=>file)");
+                }
                 exit;
             break;
             case "GET":
@@ -417,6 +441,33 @@ event_route[xhttp:request] {
                     pres_update_watchers("$var(uri)", "presence");
                     pres_refresh_watchers("$var(uri)", "presence", 1);
                 }
+                else if($xcapuri(u=>auid)=~"rls-services" || $xcapuri(u=>auid)=~"resource-lists")
+                {
+                    rls_update_subs("$var(uri)", "presence");
+                }
+                else if($xcapuri(u=>auid)=~"pidf-manipulation")
+                {
+                    pres_refresh_watchers("$var(uri)", "presence", 2, "$xcapuri(u=>uri_adoc)", "$xcapuri(u=>file)");
+                }
+                exit;
+            break;
+            case "POST":
+                if($xcapuri(u=>auid)=~"search")
+                {
+                    xhttp_reply("501", "Not Implemented", "", "");
+                }
+                else
+                {
+                    if($xcapuri(u=>auid)=~"xcap-directory")
+                    {
+                        append_to_reply("Allow: GET\r\n");
+                    }
+                    else
+                    {
+                        append_to_reply("Allow: DELETE, GET, PUT\r\n");
+                    }
+                    xhttp_reply("405", "Method Not Allowed", "", "");
+                }
                 exit;
             break;
         }




More information about the sr-dev mailing list