Hi
 I am struggling to figure out how to build and test an integrated presence server with Resource-List (rls.so) and XCAP (xcap_server.so).

I am confused about what is meant to happen and how to debug it.  Not sure if I am suffering from incompatibilities, configuration errors, or bugs…

I have not found an up to date guide on configuring an integrated presence, rls, xcap server so I have used old tutorials, module documentation and some course code review … but I’m pretty confused now!

I am using Snom phones and Jitsi (on Mac) to test.

I have a kamailio Registrar which proxies all presence messages to the separate kamailio 4.2 Presence server.

REQUIREMENT : Contact Presence
=============================
I would like to get a SUBSCRIBE from the Snom phone to subscribe to a contact-list resource list, and to receive a NOTIFY with all of the presence states for those contacts.  

Relevant snom settings?
Contact List URI:  this generates a SUBSCRIBE with event:presence 


I believe that:
==========
presence module should be managing the individual user presence and dialog states
xcap module should allow me to use HTTP / curl to edit the resource lists
rls module should be managing the mapping from a resource list subscription to the individual presence states and generating the aggregated NOTIFY messages.
each device should then be able to SUBSCRIBE to a resource list uri and then receive an aggregated NOTIFY for all of the watched entities.


Current status:
===========

SUBSCRIBE sip:org1a-contacts@*****.co.uk SIP/2.0
v: SIP/2.0/UDP 192.168.1.15:59594;branch=z9hG4bK-qllzlgs3xf43;rport
f: <sip:org1a@*****.co.uk>;tag=wwasqc6lmb
t: <sip:org1a-contacts@****.co.uk>
i: 313439303236383530323234313530-x3hlb3j6b5ef
CSeq: 1 SUBSCRIBE
Max-Forwards: 70
User-Agent: snomD375/8.9.3.46
m: <sip:org1a@192.168.1.15:59594>;reg-id=1
Event: presence
Accept: application/pidf+xml, application/rlmi+xml, multipart/related
Supported: eventlist
Expires: 3600
l: 0


… auth handshake

SIP/2.0 202 OK
Record-Route: <sip:10.210.160.13;r2=on;lr=on;ftag=wwasqc6lmb;nat=yes>
Record-Route: <sip:**pubip**;r2=on;lr=on;ftag=wwasqc6lmb;nat=yes>
v: SIP/2.0/UDP 192.168.1.15:59594;received=**recvip**;branch=z9hG4bK-8wufiv1ua3ne;rport=60554
f: <sip:org1a@****.co.uk>;tag=wwasqc6lmb
t: <sip:org1a-contacts@*****.co.uk>;tag=a6a1c5f60faecf035a1ae5b6e96e979a-d30e
i: 313439303236383530323234313530-x3hlb3j6b5ef
CSeq: 2 SUBSCRIBE
Expires: 3600
Contact: <sip:10.210.160.16:5060;transport=udp>
Server: kamailio (4.2.0 (x86_64/linux))
Content-Length: 0


… and then the snom receives an empty NOTIFY.

NOTIFY sip:org1a@192.168.1.15:58325 SIP/2.0
Via: SIP/2.0/UDP 109.104.108.18;branch=z9hG4bKc54a.20db45097fb44595ccd5a30827ca2a62.0
Via: SIP/2.0/UDP 10.210.160.16;rport=5060;branch=z9hG4bKc54a.40150886000000000000000000000000.0
To: <sip:org1a@****.co.uk>;tag=sx4ne9jpcl
From: <sip:org1a-contacts@*****.co.uk>;tag=a6a1c5f60faecf035a1ae5b6e96e979a-ed89
CSeq: 2 NOTIFY
Call-ID: 313439303237323938323235353133-2du221e6okvf
Content-Length: 0
User-Agent: kamailio (4.2.0 (x86_64/linux))
Max-Forwards: 69
Event: presence
Contact: <sip:10.210.160.16:5060;transport=udp;alias=10.210.160.16~5060~1>
Subscription-State: active;expires=3600


The Subscription is showing up in the watchers table, not the rls_watchers table, so I believe it is being rejected by the rls_handle_subscribe() and then parsed by the presence module.  Is that correct?

There is noting in rls_watchers or rls_presentity tables.  Should there be?

I have a rows in the XCAP table for the Resource-List
curl -d @/tmp/contacts-resource-list.xml -vvv -X PUT http://109.104.108.23:5060/xcap-root/resource-lists/users/sip:org1a-contacts@hpbx449vb531.sip.byphone.co.uk/index

relevant row in xcap table:

|  3 | org1a-contacts | *****.co.uk | <?xml version="1.0" encoding="UTF-8" standalone="no"?><resource-lists xmlns="urn:ietf:params:xml:ns:resource-lists"><list name="team"><entry uri="sip:1002@****.co.uk"/><entry uri="sip:1001@****.co.uk"><display-name>bob</display-name></entry><entry uri="sip:1003@****.co.uk"><display-name>test1</display-name></entry><entry uri="sip:1006@****co.uk"><display-name>test1006</display-name></entry><entry uri="sip:1007@****co.uk"><display-name>test1007</display-name></entry><entry uri="sip:1008@h****.co.uk"><display-name>test1008</display-name></entry><entry uri="sip:1009@****.co.uk"><display-name>test1009</display-name></entry>    <entry uri="sip:1005@****.co.uk"><display-name>testing1005</display-name></entry>    <entry uri=“sip:org1a@****.co.uk"><display-name>testingorg1a</display-name></entry>    <entry uri=“sip:org1c@****.co.uk"><display-name>testingorg1c</display-name></entry></list></resource-lists> |        4 | sr-1490270411-10965-2 |      0 | /xcap-root/resource-lists/users/sip:org1a-contacts@****co.uk/index |    0 |


I have rows in the presence table for the entities that I want to track e.g.
                               |        |
| 2889 | org1c    | ****.co.uk | presence        | a.1490270411.10942.42.1083 | 1490277099 |    1490273499 | <?xml version="1.0
" encoding="UTF-8"?>
<presence xmlns="urn:ietf:params:xml:ns:pidf"
xmlns:im="urn:ietf:params:xml:ns:pidf:im"
          entity=“pres:org1c@*****.co.uk">
<tuple id="snom370-000413260935">
<status><basic>open</basic>
<im:im>Available</im:im>
</status>
<contact priority="1.00">sip:org1c@****.co.uk</contact>
<note xml:lang="en">Available</note>
</tuple></presence>

I am running kamaiio 4.2



Question : Should I have an resource-services row too? Or does rls.so infer the relationship using the URI?  When I use jitsi to manipulate its contact list it only inserts 2 rows into the xcap table and  I cannot get a SIP Subscribe to connect to that resource list either.

Question : What should the curl PUT commands and XML docs look like to build a valid RLS service (is there a good example anywhere)?

Question : Is there an example config or doc anywhere showing how to build integrated presence, rls, xcap?

Question : Has anyone got this working with Snom and or other handsets… the standards and implementations seem vague / inconsistent?


Note: There is another Snom setting (Extension Monitoring Call Pickup List URI:) which produces a SUBSCRIBE with Event:dialog but which should allow a button/lamp/callpickup/BLF for the buddy contact.  I’d like to get that working too, but recognise that rls.so does not handle dialog messages by default, so I’m starting with Presence...


Paul