Hello,

 

I’m wring you again about the Presence = xcap Problem on Kamailio related with the deleting of a contact.

Here a detailed description we have observed:
User Case:
------------------
  - user A is a contact of B and viceversa.
  - then user A removes B from PC client


1) A sends SUBSCRIBE B to Kamail Presence Server (PS) with even type: presence and Expire:0 without body
    a) PS removes A as wacther of B from the active_watchers table
    b) PS sends NOTIFY to B (from B to B) with event type: presence.winfo and Subscription State:active,expire=570
    c) PS sends NOTIFY to A (from B to A) with event type: Presence and Subscription State: terminated,reason=timeout

2) A sends XCAP PUT to PS with updated pres-rules without B in presence_allow rule
    a) PS update xcap table the pres-rules record of A (without B)
  

3) A sends XCAP PUT to PS with updated resource-lists without B
    a) PS update xcap table the resource-lists record of A
(without B)
 
4)  the script kamailio.cfg calls pres_update_watchers
    a) PS updates watcher table by setting the status = 2(pending) for the record of B is watcher of A (presentity), while the status remains   active (1) for the record of A is watcher of B
    b) PS sends NOTIFY to B(from A to B) with event type: presence and subscription state: pending

5) the script kamailio.cfg calls pres_refresh_watchers
     a) PS sends NOTIFY to B(from A to B) with event type: presence and content type:application:pdif+xml (open, online, pdif entity:A,...)
     b) the PC client of B shows a popup by saying 5has authorized the B adds A as contact request


Test environments:
--------------------------
- server: kamailio 3.1.3 with presence, xcap and mysql in Redhat5.6_x64
- transport: tcp
- db: mysql
- client: jitsi (ex SIP communicator)
- kamailio.cfg: please see the attached file kamailio.zip

Questions:
-----------------
1) is it correct the first SUBSCRIBE from the PC client of A?
2) are the over all call flows correct (see the attached wireshark trace)
3) are the steps 2 and 3 correct?
4) the steps 4 and 5 are very strange, is it the bug of xcap module or/and presence module?


Please help!!!!!

Best Regards,
Laura