2
votes

I am having problems getting Openfire to send an invite message to all user resources associated with a user jid. I am using Openfire(3.9.3) and Strophe(1.1.3).

The users jid has 2 resources logged in on openfire (e.g. [email protected]/e1ef0b84, [email protected]/fa51aad7).

I have sent a MUC invite message to a user(i.e. userA) in order to join a room.

<?xml version="1.0"?>
<message xmlns:stream="http://etherx.jabber.org/streams"
   xmlns="jabber:client" from="[email protected]" to="[email protected]"
   version="1.0">
  <x xmlns="http://jabber.org/protocol/muc#user">
    <invite from="[email protected]"/>
  </x>
  <x xmlns="jabber:x:conference" jid="[email protected]"/>
</message>

I expected the invited to be sent to both resources (e.g. [email protected]/e1ef0b84, [email protected]/fa51aad7), however it only appears to be sent to the last logged in resources. For example if I logged in my phone as userA and then logged into my laptop as userA, the invite would only be sent to the laptop user.

Openfire seems to correctly route normal xmpp message to both user resources, I had expected muc invites to be handled in the same way.

Does anyone know whether this is at all possible?

Thanks, Steve

2

2 Answers

1
votes

Group invite is also treated as a normal message and it should get routed to all connected resources.
However for routing a message to all connected resources, Openfire has following logic:
Select session with highest presence priority, if no session qualifies, message is stored in offline store, If more than 1 sessions found with same priority, then Openfire becomes more smart ;) i.e. check the value of "route.all-resources" property.
If "route.all-resources" is true then message is routed to all those selected sessions, If value is false, then it sorts the sessions on the basis of show value (chat, available, away, xa) and again sorts the result on last active time and finally picks the 1st result and routes the message to that session.

0
votes

Pay attention: according to XEP-0045 the XML to invite userA from userB is in the following form:

<message
    from='[email protected]'
    to='[email protected]'>
  <x xmlns='http://jabber.org/protocol/muc#user'>
    <invite to='[email protected]'>
      <reason>
        Hey UserA, this is the place for all good witches!
      </reason>
    </invite>
  </x>
</message>

then the XMPP server (Openfire in this case) must provide to send the XML:

<message
    from='[email protected]'
    to='[email protected]'>
  <x xmlns='http://jabber.org/protocol/muc#user'>
    <invite from='[email protected]'>
      <reason>
        Hey UserA, this is the place for all good witches!
      </reason>
    </invite>
    <password>xyz</password>
  </x>
</message>

PS: another way is the direct invitation (not mediated by the room as in the XEP-0045), see http://xmpp.org/extensions/xep-0249.html