Mobicents Presence 服务:发布时获取 415 不受支持的媒体类型

Mobicents Presence Service: Getting 415 unsupported media type while PUBLISH

我在 mobicents-jainslee-2.7.0.FINAL-jboss-5.1.0.GA windows 上安装了来自 here 的 Mobicents Presence 服务8 和 ubuntu.

现在,当我尝试测试软电话(使用 xlite、Microsip、zoiper、linphone)时,我在 PUBLISH 消息中看到 415 Unsupported Media Type 错误。

我不明白这个错误的来源。以下是日志:

16:00:30,337 INFO  [SipResourceAdaptor] (SipRA-UDPMessageChannelThread-1) 

Received Request:
PUBLISH sip:xliteold@localhost SIP/2.0
Via: SIP/2.0/UDP 127.0.0.1:17244;branch=z9hG4bK-d87543-d04b36288c3d050c-1--d87543-;rport=17244;received=127.0.0.1
Max-Forwards: 70
Contact: <sip:xliteold@127.0.0.1:17244>
To: "xliteold" <sip:xliteold@localhost>
From: "xliteold" <sip:xliteold@localhost>;tag=3f34fd3e
Call-ID: 752d47571d600a56ZWE3YmI1YTQwYzg3NGQ3ZTJkN2RmNTNlNjU3M2JiNjY.
CSeq: 1 PUBLISH
Expires: 3600
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,NOTIFY,MESSAGE,SUBSCRIBE,INFO
Content-Type: application/pidf+xml
User-Agent: X-Lite release 1002tx stamp 29712
Event: presence
Content-Length: 736

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<pr:presence xmlns:pr="urn:ietf:params:xml:ns:pidf" entity="sip:xliteold@localhost" xmlns:caps="urn:ietf:params:xml:ns:pidf:caps"
 xmlns:cipid="urn:ietf:params:xml:ns:pidf:cipid" xmlns:counterpath="www.counterpath.com/presence/ext" xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model"
xmlns:rpid="urn:ietf:params:xml:ns:pidf:rpid"> 
<pr:tuple id="s03543357">
<pr:status>
<pr:basic>open</pr:basic>
</pr:status>
<pr:note>Busy</pr:note>
<rpid:user-input last-input="2015-07-09T15:47:23Z">active</rpid:user-input>
<pr:timestamp>2015-07-09T15:47:23Z</pr:timestamp>
</pr:tuple>
<dm:person id="p5447f306">
<rpid:activities>
<rpid:busy/></rpid:activities>
<dm:note>Busy</dm:note>
</dm:person>
</pr:presence>
16:00:30,347 INFO  [PublicationControlSbb] (pool-26-thread-1) publication for resource sip:xliteold@localhost on event package presence has unsupported media type
16:00:30,352 INFO  [ServerTransactionWrapper] (pool-26-thread-1) ServerTransaction[z9hG4bK-d87543-d04b36288c3d050c-1--d87543-] sending response:
SIP/2.0 415 Unsupported media type
CSeq: 1 PUBLISH
Call-ID: 752d47571d600a56ZWE3YmI1YTQwYzg3NGQ3ZTJkN2RmNTNlNjU3M2JiNjY.
From: "xliteold" <sip:xliteold@localhost>;tag=3f34fd3e
To: "xliteold" <sip:xliteold@localhost>
Via: SIP/2.0/UDP 127.0.0.1:17244;branch=z9hG4bK-d87543-d04b36288c3d050c-1--d87543-;rport=17244;received=127.0.0.1
Accept: application/pidf+xml
Content-Length: 0

我在 google 组的 Mobicents 论坛上发现了类似的问题,但没有解决。 有没有人遇到过类似的错误。请帮忙。 编辑

Message from Different UA:
16:00:00,763 INFO  [SipResourceAdaptor] (SipRA-UDPMessageChannelThread-7) Received Request:
PUBLISH sip:microsip@127.0.0.1 SIP/2.0
Via: SIP/2.0/UDP 127.0.0.1:54604;rport=54604;branch=z9hG4bKPjeddbddf5ee4445d5b856bbd51810aa47;received=127.0.0.1
Max-Forwards: 70
From: "microsip" <sip:microsip@127.0.0.1>;tag=bdce197285a740809b1a9b2184184e47
To: "microsip" <sip:microsip@127.0.0.1>
Call-ID: e6e7d585ffdb4cd9a70788e79f6a7d92
CSeq: 52515 PUBLISH
Event: presence
User-Agent: MicroSIP/3.10.1
Content-Type: application/pidf+xml
Content-Length: 555

<?xml version="1.0" encoding="UTF-8"?>
<presence entity="sip:microsip@127.0.0.1" xmlns="urn:ietf:params:xml:ns:pidf" xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model" xmlns:rpid="urn:ietf:params:xml:ns:pidf:
rpid">
 <tuple id="pjd3fc3ef4084b47e294d822dae166ced9">
  <status>
   <basic>open</basic>
  </status>
  <timestamp>2015-07-09T16:00:00.762Z</timestamp>
  <note>Idle</note>
 </tuple>
 <dm:person id="pj079a796fbff64ffb9561d5529d2b0f2d">
  <rpid:activities>
   <rpid:unknown />
  </rpid:activities>
  <dm:note>Idle</dm:note>
 </dm:person>
</presence>

16:00:00,784 INFO  [PublicationControlSbb] (pool-21-thread-1) publication for resource sip:microsip@127.0.0.1 on event package presence has unsupported media type
16:00:00,785 INFO  [ServerTransactionWrapper] (pool-21-thread-1) ServerTransaction[z9hG4bKPjeddbddf5ee4445d5b856bbd51810aa47] sending response:
SIP/2.0 415 Unsupported media type
CSeq: 52515 PUBLISH
Call-ID: e6e7d585ffdb4cd9a70788e79f6a7d92
From: "microsip" <sip:microsip@127.0.0.1>;tag=bdce197285a740809b1a9b2184184e47
To: "microsip" <sip:microsip@127.0.0.1>
Via: SIP/2.0/UDP 127.0.0.1:54604;rport=54604;branch=z9hG4bKPjeddbddf5ee4445d5b856bbd51810aa47;received=127.0.0.1
Accept: application/pidf+xml
Content-Length: 0

谢谢。

It is not working since the payload you are sending is not conforming to the xsd of pidf document.(Read answer till the end for explanation)

Try this as the payload, it should work then.... I have verified on mobicents sip-servlets environment(tested it using sipp as the client):

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<pr:presence xmlns:pr="urn:ietf:params:xml:ns:pidf" entity="sip:xliteold@localhost" xmlns:caps="urn:ietf:params:xml:ns:pidf:caps"
 xmlns:cipid="urn:ietf:params:xml:ns:pidf:cipid" xmlns:counterpath="www.counterpath.com/presence/ext" xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model"
xmlns:rpid="urn:ietf:params:xml:ns:pidf:rpid"> 
    <pr:tuple id="s03543357">
        <pr:status>
            <pr:basic>open</pr:basic>
        </pr:status>
        <rpid:user-input last-input="2015-07-09T15:47:23Z">active</rpid:user-input>
        <pr:note>Busy</pr:note>
        <pr:timestamp>2015-07-09T15:47:23Z</pr:timestamp>
    </pr:tuple>
    <dm:person id="p5447f306">
        <rpid:activities>
            <rpid:busy/>
        </rpid:activities>
        <dm:note>Busy</dm:note>
    </dm:person>
</pr:presence>


I have made one change :
In <tuple> element I have swapped the positions of:                                                      
<rpid:user-input last-input="2015-07-09T15:47:23Z">active</rpid:user-input>
<pr:note>Busy</pr:note>

Moved <note> below user input because...
If you see definition of <tuple> in pidf.xsd, the contact,note and timestamp elements come in that order and it cant be changed.
Other elements like <rpid:user-input> in this case need to come after status element and before contact element as can be seen below.  

    <xs:complexType name="tuple">
        <xs:sequence>
            <xs:element name="status" type="tns:status" />
            <xs:any namespace="##other" processContents="lax" minOccurs="0"
                maxOccurs="unbounded" />
            <xs:element name="contact" type="tns:contact" minOccurs="0" />
            <xs:element name="note" type="tns:note" minOccurs="0"
                maxOccurs="unbounded" />
            <xs:element name="timestamp" type="xs:dateTime" minOccurs="0" />
        </xs:sequence>
        <xs:attribute name="id" type="xs:ID" use="required" />
    </xs:complexType>

面临同样的问题,通过在 mobicents PS 代码中注释掉对验证器的调用,重建和部署它来继续前进;否则无法继续,因为所有客户端都发送了不正确的发布消息。