3
votes

Well, I am facing a strange issue. I am able to create muc, able to invite users, able to join but after some time I cannot join the newly created group. This happens for only some users, while other users are able to create/join groups. I am creating MUC group as:

MultiUserChatManager manager = MultiUserChatManager.getInstanceFor(getConnection());
            MultiUserChat chatRoom = manager.getMultiUserChat(groupName+ "@conference." + Constants.XMPP_SERVICE);

            chatRoom.createOrJoin(chatGroup.title);

User Invitation is as follows:

 MultiUserChatManager manager = MultiUserChatManager.getInstanceFor(getConnection());
                        MultiUserChat chatRoom = manager.getMultiUserChat(groupName+ "@conference." + Constants.XMPP_SERVICE);
chatRoom.changeNickname(FirstName);
                                chatRoom.invite(invite.UserId + "@" + Constants.XMPP_SERVICE, groupInfo);

And the other end I have

 @Override
    public void invitationReceived(XMPPConnection conn, final MultiUserChat room, String inviter, final String reason, String password, final Message message) {
        Log.d("XMPPInvitation", "");
        try {
            room.join(FirstName);

The above code works fine but after some time it start giving below error:

org.jivesoftware.smack.XMPPException$XMPPErrorException: XMPPError: service-unavailable - cancel
 at org.jivesoftware.smack.PacketCollector.nextResultOrThrow(PacketCollector.java:232)
at org.jivesoftware.smackx.muc.MultiUserChat.enter(MultiUserChat.java:311)
at org.jivesoftware.smackx.muc.MultiUserChat.join(MultiUserChat.java:495)
at org.jivesoftware.smackx.muc.MultiUserChat.join(MultiUserChat.java:430)
at com.app.xmpp.GroupChatInvitationListener.invitationReceived(GroupChatInvitationListener.java:45)

I have room.join at GroupChatInvitationListener.java:45 I also noticed this in received XML

<presence from='[email protected]/A J 33' to='31bc27e9-c650-4870-aaab-ca7285848954@MyHOST/A J 33' type='error' xml:lang='en' id='WC0zt-374'><x xmlns='http://jabber.org/protocol/muc'/><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.igniterealtime.org/projects/smack' ver='os2Kusj3WEOivn5n4iFr/ZEO8ls='/><error code='503' type='cancel'><service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></presence>

It again start working if I restart mod_muc module from Ejabberd Admin. Can you suggest what could be the issue?

1
I am facing same issue. Were you able to figure out the problem?Mohammad Umair Khan

1 Answers

0
votes

Well, issue was in MUC implementation, if there is no user online in the MUC then server will invalidate that MUC. Even owner will also not able to join again the group if it got empty (No Online joinees are there ).

To solve this problem, we have to use MUC-SUB implementation which works as a charm, however it is experimental currently but it works :)