XMPP:Ejabberd不向用户转发带名称空间前缀的自定义IQ

时间:2013-09-11 12:52:11

标签: xmpp ejabberd

我必须使用我自己的名称空间eva@pc377/Smackhttp://www.test.com/test发送自定义IQ到特定用户bob@pc377/Smack。当我使用OpenFire时,一切正常,但Ejabberd不会将此IQ转发给用户。在我看到的日志文件中,服务器接收到IQ,内部调度到会话管理器,但不转发给用户。如果我发送Message,则会正确转发。我使用的是基于Java的Smack-Client。

Ejabberd是否需要特定配置来转发自定义IQ?

    =INFO REPORT==== 2013-09-11 13:55:36 ===
    D(<0.658.0>:ejabberd_receiver:320) : Received XML on stream = 
    "<iq id=\"0j8w6-8\" to=\"bob@pc377/Smack\" type=\"set\">
        <ts:register-request xmlns:ts=\"http://www.test.com/test\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">
           <ts:node-id>550e8400-e29b-11d4-a716-446655440000</ts:node-id>
           <ts:properties>
              <ts:path>.</ts:path>
              <ts:delivery-mode>1</ts:delivery-mode>
           </ts:properties>
       </ts:register-request>
    </iq>"


    =INFO REPORT==== 2013-09-11 13:55:36 ===
    D(<0.659.0>:ejabberd_router:313) : route
from {jid,"eva","pc377","Smack","eva","pc377","Smack"}
to {jid,"bob","pc377","Smack","bob","pc377","Smack"}
packet {xmlelement,"iq",
               [{"id","0j8w6-8"},
                {"to","bob@pc377/Smack"},
                {"type","set"}],
               [{xmlelement,"ts:register-request",
                    [{"xmlns:ts","http://www.test.com/test"},
                     {"xmlns:xs","http://www.w3.org/2001/XMLSchema"},
                     {"xmlns:xsi",
                      "http://www.w3.org/2001/XMLSchema-instance"}],
                    [{xmlelement,"ts:node-id",[],
                         [{xmlcdata,
                              <<"550e8400-e29b-11d4-a716-446655440000">>}]},
                     {xmlelement,"ts:properties",[],
                         [{xmlelement,"ts:path",[],[{xmlcdata,<<".">>}]},
                          {xmlelement,"ts:delivery-mode",[],
                              [{xmlcdata,<<"1">>}]}]}]}]}


    =INFO REPORT==== 2013-09-11 13:55:36 ===
    D(<0.659.0>:ejabberd_local:300) : local route
from {jid,"eva","pc377","Smack","eva","pc377","Smack"}
to {jid,"bob","pc377","Smack","bob","pc377","Smack"}
packet {xmlelement,"iq",
                       [{"id","0j8w6-8"},{"to",[...]},{[...],...}],
                       [{xmlelement,[...],...}]}


    =INFO REPORT==== 2013-09-11 13:55:36 ===
    D(<0.659.0>:ejabberd_sm:411) : session manager
from {jid,"eva","pc377","Smack","eva","pc377","Smack"}
to {jid,"bob","pc377","Smack","bob","pc377","Smack"}
packet {xmlelement,"iq",
                       [{"id","0j8w6-8"},{"to",[...]},{[...],...}],
                       [{xmlelement,[...],...}]}


    =INFO REPORT==== 2013-09-11 13:55:36 ===
    D(<0.659.0>:ejabberd_sm:510) : sending to process <0.656.0>

1 个答案:

答案 0 :(得分:0)

使用更简单的XML尝试:

<iq id="0j8w6-8" to="bob@pc377/Smack" type="set">
    <register-request xmlns="http://www.test.com/test">
       <node-id>550e8400-e29b-11d4-a716-446655440000</node-id>
       <properties>
          <path>.</path>
          <delivery-mode>1</delivery-mode>
       </properties>
   </register-request>
</iq>

如果这不起作用,请尝试重命名register-requestdelivery-mode以删除短划线。这些变化都不是必需的,但要么有助于ejabberd团队找到错误。