Browse Source

feat: Retries joining the room on room creation error.

Fixes jitsi/jitsi-meet#13957.
release-8443
damencho 1 year ago
parent
commit
f8a18cf09f
1 changed files with 20 additions and 0 deletions
  1. 20
    0
      modules/xmpp/ChatRoom.js

+ 20
- 0
modules/xmpp/ChatRoom.js View File

@@ -1221,6 +1221,26 @@ export default class ChatRoom extends Listenable {
1221 1221
 
1222 1222
             } else {
1223 1223
                 logger.warn('onPresError ', pres);
1224
+
1225
+                const txt = $(pres).find('>error[type="cancel"]>text[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]');
1226
+
1227
+                // a race where we have sent a conference request to jicofo and jicofo was about to leave or just left
1228
+                // because of no participants in the room, and we tried to create the room, without having
1229
+                // permissions for that (only jicofo creates rooms)
1230
+                if (txt.length && txt.text() === 'Room creation is restricted') {
1231
+                    if (!this._roomCreationRetries) {
1232
+                        this._roomCreationRetries = 0;
1233
+                    }
1234
+                    this._roomCreationRetries++;
1235
+
1236
+                    if (this._roomCreationRetries <= 3) {
1237
+                        // let's retry inviting jicofo and joining the room
1238
+                        this.join(this.password, this.replaceParticipant);
1239
+
1240
+                        return;
1241
+                    }
1242
+                }
1243
+
1224 1244
                 this.eventEmitter.emit(
1225 1245
                     XMPPEvents.ROOM_CONNECT_NOT_ALLOWED_ERROR);
1226 1246
             }

Loading…
Cancel
Save