how subscribe to buddylist using resource list xml

847 views Asked by At

I need to implement a SIP subscription to a resource list, under which tag I should put the XML buddy list that contains the desired SIP ID (to monitor their states). Note that I'm using Jain-SIP API, and I implemented the single subscription and is working fine, but I'm facing difficulties in working with multiple resource to monitor. The XML that should be added as indicated in https://www.rfc-editor.org/rfc/rfc5367

<?xml version="1.0" encoding="UTF-8"?>
<resource-lists xmlns="urn:ietf:params:xml:ns:resource-lists"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<list>
<entry uri="sip:[email protected]" />
<entry uri="sip:[email protected]" />
<entry uri="sip:[email protected]" />
</list>
</resource-lists>

I wish to build the SIP request with the buddy list XML:

SUBSCRIBE  sip:[email protected] SIP/2.0
Via: SIP/2.0/TCP terminal.example.com;branch=z9hG4bKwYb6QREiCL
Max-Forwards: 70
To: RLS <sip:[email protected]>
From: <sip:[email protected]>;tag=ie4hbb8t
Call-ID: [email protected]
CSeq: 1 SUBSCRIBE
Contact: <sip:terminal.example.com>
Event: presence
Expires: 7200
Require: recipient-list-subscribe
Supported: eventlist
Accept: application/cpim-pidf+xml
Accept: application/rlmi+xml
Content-Type: application/resource-lists+xml
Content-Disposition: recipient-list
Content-Length: 337

<?xml version="1.0" encoding="UTF-8"?>
<resource-lists xmlns="urn:ietf:params:xml:ns:resource-lists"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<list>
<entry uri="sip:[email protected]" />
<entry uri="sip:[email protected]" />
<entry uri="sip:[email protected]" />
</list>
</resource-lists>
1

There are 1 answers

10
jcm On

I assume you're using javax.sip.message.Message interface or an instance to a javax.sip.message.SIPRequest object to create outgoing SUBSCRIBE request. In this case, you can use setContent method to specify request's body content.

On the other hand, the way to properly detect if your server supports multiple recipient subscription is by sending a OPTIONS request and, in corresponding 200 OK response, checking that Supported: header contains recipient-list-subscribe option tag. SIP message flow should be something like:

Client UA                        Server
 |                              |
 |----------------------------->|
 |            OPTIONS           |
 |<-----------------------------|
 |             200 OK           |
 |      (Contains Supported:    |
 |    recipient-list-subscribe  |
 |                              |
 |----------------------------->|
 |           SUBSCRIBE          |
 |<-----------------------------|
 |             200 OK           |