Module: sip-router
Branch: master
Commit: aebeeee1993e4cce0d3288f1ccd8d17f3efee925
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=aebeeeeā¦
Author: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley(a)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" &&
$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>
@@ -373,19 +375,33 @@ 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>
<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: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>
+ <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
@@ -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;
}