【问题标题】:Mobicents Presence Service: Getting 415 unsupported media type while PUBLISHMobicents Presence Service:在发布时获取 415 不受支持的媒体类型
【发布时间】:2015-07-09 20:19:46
【问题描述】:

我已经在 Windows 8 和 ubuntu 上的 mobicents-jainslee-2.7.0.FINAL-jboss-5.1.0.GA 上安装了来自 here 的 Mobicents Presence Service。

现在,当我尝试测试软件电话(使用 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

谢谢。

【问题讨论】:

    标签: linphone user-presence mobicents mobicents-sip-servlets


    【解决方案1】:

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

    【讨论】:

    • 谢谢。我会听从你的建议。
    【解决方案2】:
    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>
    

    【讨论】:

    • 谢谢,但是如何更改有效负载?它是由我正在使用的用户代理发送的。
    • 你说的是真的,这是你正在使用的相应 sip 软电话中的一个错误。试试看你是否可以配置它,以便元素 不会被添加到 sip:publish 有效负载中。否则使用可以使用 sipp 来测试这个场景。它是开源的,易于配置,并且可以配置消息和有效负载以测试您想要的任何场景。
    • 从 XML 的角度来看,您所说的似乎合乎逻辑,但请参见下面来自不同 UA 的请求,该请求不发送 rpid:EDIT 查看有问题的编辑
    • Presence 服务器的行为符合预期,第二次发布中的有效负载不正确。它在 元素之后有 元素,根据 pidf.xsd(见上文),这又是不正确的。 应该在 之后。如果您进行更改,则 Presence Server 将发送 200 OK 作为响应
    • 对不起,伙计,您使用的所有这些 sip 软电话都在发送格式不正确的有效载荷的发布请求。在收到 Publish 消息时,PS 将始终验证其有效负载;如果格式不正确且不符合有效的 xsds -> PS 将继续发送 415 响应。
    猜你喜欢
    • 1970-01-01
    • 2020-09-25
    • 1970-01-01
    • 1970-01-01
    • 2014-05-10
    • 2019-05-01
    • 2015-06-02
    相关资源
    最近更新 更多