0

我需要实现对资源列表的 SIP 订阅,我应该将包含所需 SIP ID 的 xml 好友列表放在该标签下(以监视其状态)。请注意,我使用的是 Jain-SIP API,并且我实现了单个订阅并且工作正常,但是在使用多个资源进行监控时我遇到了困难。应添加的 XML,如http://tools.ietf.org/search/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>

我用好友列表 xml 构建 sip 请求:

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>

最好的,

4

1 回答 1

1

我假设您正在使用对象javax.sip.message.Message的接口或实例javax.sip.message.SIPRequest来创建传出 SUBSCRIBE 请求。在这种情况下,您可以使用setContent方法来指定请求的正文内容。

另一方面,正确检测您的服务器是否支持多个收件人订阅的方法是发送一个 OPTIONS 请求,并在相应的 200 OK 响应中检查Supported:标头是否包含recipient-list-subscribe选项标记。SIP 消息流应该类似于:

Client UA                        Server
 |                              |
 |----------------------------->|
 |            OPTIONS           |
 |<-----------------------------|
 |             200 OK           |
 |      (Contains Supported:    |
 |    recipient-list-subscribe  |
 |                              |
 |----------------------------->|
 |           SUBSCRIBE          |
 |<-----------------------------|
 |             200 OK           |
于 2013-12-22T11:27:14.880 回答