0

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:bill@example.com" />
<entry uri="sip:joe@example.org" />
<entry uri="sip:ted@example.net" />
</list>
</resource-lists>

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

SUBSCRIBE  sip:rls@example.com SIP/2.0
Via: SIP/2.0/TCP terminal.example.com;branch=z9hG4bKwYb6QREiCL
Max-Forwards: 70
To: RLS <sip:rls@example.com>
From: <sip:adam@example.com>;tag=ie4hbb8t
Call-ID: cdB34qLToC@terminal.example.com
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:bill@example.com" />
<entry uri="sip:joe@example.org" />
<entry uri="sip:ted@example.net" />
</list>
</resource-lists>
Ken White
  • 123,280
  • 14
  • 225
  • 444
Salim R
  • 343
  • 7
  • 16
  • What do you mean by "tag"? I mean, you're XML body seems perfectly fine for me. – jcm Dec 20 '13 at 09:44
  • HI @jcm, I meant by TAG which Header. I'm using Jain-Sip Java API to build the SIP request. I create Headers (TO , from, via, content-Type,contact,etc) then add them to the request. My question was is which header should I put the XML?, because I don't have Body header. – Salim R Dec 22 '13 at 08:24
  • HI @jcm, as for my original question, do you have an idea how to recognize whether my SIP Server can handle the SUBSCRIPTION to a resource list. example what I should put in TO header to adress to the RLS (resource List server). pbx model: User-Agent: FortiVoice/7.31b00. thank you – Salim R Dec 23 '13 at 07:04

1 Answers1

1

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           |
jcm
  • 2,568
  • 14
  • 18
  • Hi @jcm, thank you it works, I used the setcontent and xml is added successfully to the SIP request: request.setContent(sipClientBO.getResourceXMLasString(), contentTypeHd); – Salim R Dec 22 '13 at 20:31
  • HI @jcm, as for my original question, do you have an idea how to recognize whether my SIP Server can handle the SUBSCRIPTION to a resource list. example what I should put in TO header to adress to the RLS (resource List server). pbx model: User-Agent: FortiVoice/7.31b00. thank you – Salim R Dec 23 '13 at 07:17
  • @Gladiator Please, check my last update for knowing if server supports subscriptions to request container resource list. – jcm Dec 23 '13 at 18:42
  • Hi @jcm, you said to send Options request in 200 Ok response, did you meant by this to keep the same callerId and other parameters(via:branch) in the dialog?and re-send them?. The case I created an Options request (with new callerId, branch), the server has responded without the "SUpported" header. I updated you answer with SIP messages, hope they will post it here. – Salim R Dec 24 '13 at 08:46
  • @Gladiator No no, I said to send a SIP OPTIONS request and, **on its 200 OK response**, check _Supported_ header. SIP OPTIONS is an independent transaction used to know other end's capabilities. Check my update to the answer. – jcm Dec 24 '13 at 09:53
  • Hi @jcm, Ok I got your point, I sent Options request, and the server respond with 200 Ok but it doesn't contain Support header, seems the server won't reveal its features!. Below the response: Received response: SIP/2.0 200 OK Via: SIP/2.0/UDP localIp:5060;branch=z9hG4bK1833057213 From: ;tag=1911372146 To: Call-ID: dd078462328d570193aee5d50938c3d6@192.168.5.110 CSeq: 1 OPTIONS User-Agent: FortiVoice/7.31b00 Content-Length: 0 – Salim R Dec 25 '13 at 21:50
  • @Gladiator It seems your server is using SIP OPTIONS as a ping mechanism and, as you stated, hiding some network information, this means, you would need to work blindly, this is, send SUBSCRIBE request with corresponding body and Content-type and, if it's not supported, server should answer you with an error response (intialy, 400 Bad Request) instead of 200 OK – jcm Dec 25 '13 at 22:07
  • Hi @jcm I have sent a Subscription that contains a target SIPID1 in TO header field, and also the resource-list xml described above. The server has responded with a NOTIFY that includes the state of SIPID1, and seems he didn't send the state of the extensions mentioned in the xml resource list. Seems the server manipulate this request as a subscriptions to One Extension instead to a list. Note that I have included all the header in the above subscription request (required, supported..). However I will loop thru the SIP_IDs and should got their states sequentially instead of using the res-lst – Salim R Dec 26 '13 at 18:43
  • @Gladiator Well, initially, seems the only possibility. On the other hand, you can check if [RFC 4662](https://tools.ietf.org/html/rfc4662) is supported by your server. This will require that you create a URI that contains all desired entities. A part of this, it seems that I couldn't help much :-(. Hope my answer helps some else. – jcm Dec 26 '13 at 19:54
  • Hi @jcm, you'r always welcome, you helped me a lot,The sip server/ IP-PBX I worked on don't support list subscription or group creation. I will proceed with the peer-to-peer mechanism. – Salim R Dec 27 '13 at 09:09