nextcloud / talk-ios

📱😀 Video & audio calls through Nextcloud on iOS
GNU General Public License v3.0
146 stars 88 forks source link

Re-join room when starting a call results in 404 #1756

Closed SystemKeeper closed 2 weeks ago

SystemKeeper commented 1 month ago

There have been reports that a call might fail with "Conversation not found or joined", that happens when there's no active session on the server. In that case we get a 404 back. Currently we try to join the call 3 times (but only the call, not the room), after that an error is shown that is not recoverable.

When presenting a CallViewController, we actually join the room, to make sure there's a session: https://github.com/nextcloud/talk-ios/blob/da21f2b635e5d28bd24acee87fae6def03839fb1/NextcloudTalk/NCRoomsManager.m#L467-L469

but in case we already have a NCRoomController, we just flip the flags, without actually joining: https://github.com/nextcloud/talk-ios/blob/da21f2b635e5d28bd24acee87fae6def03839fb1/NextcloudTalk/NCRoomsManagerExtensions.swift#L35-L46

This could (in theory) lead to the problem described above. Therefore we should handle 404 differently at

https://github.com/nextcloud/talk-ios/blob/da21f2b635e5d28bd24acee87fae6def03839fb1/NextcloudTalk/NCCallController.m#L203-L211

Note: Simply calling forceReconnect will not work, as _joinedCallOnce will still be false.

One solution I can see is to call NCRoomsManager.shared.rejoinRoom(...) if we extend the method to have a completion block and in the completion block call joinCall again.