When the same room is joined again from the same PHP session the room is
left with the previous Nextcloud session before joining with the new
one. However, "disinvite" messages were not sent to the external signaling
server for regular users, so their UI was not updated to show that the
previous Nextcloud session was kicked out from the conversation.
Note, however, that as a "disinvite" message is now sent the UI will
show a "conversation not found" message rather than a "duplicated
session" state.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
When a call is left a message is sent to the external signaling server.
However, that message is based on the sessions of the participants in
the conversation. When a conversation is left and the participant was in
a call in that conversation the call is also left, but the event was
emitted after leaving the conversation. Due to that, when the message to
be sent to the external signaling server was generated the participant
was no longer in the conversation, and therefore it was not included in
the message, so the call was not left from the point of view of the
external signaling server. To solve that now the call is left and, once
that is done, the conversation is left.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
When a participant was not in the call but received an offer it was
ignored to avoid establishing a connection. However, all the other call
signaling messages were still processed. Due to this, if a participant
leaves the call but that fails in the server that participant still
receives all the participant updates (which also list that participant
as still in the call) and therefore that participant tries to establish
a connection with the other participants.
To prevent that now all call signaling messages are ignored when the
local participant is not in the call. Due to this the call signaling
message that changes the state from the local participant to
disconnected is now ignored as well, although that should not be a
problem given that (since the previous commmit) the call related data is
immediately cleared when the call is left, without waiting for the
signaling message.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
When a call is left the peer connections are immediately ended. However,
the data of the participants (like the call state), the
CallParticipantModels as well as the timers to retry failed connections
were cleared once the signaling message updating the current participant
state to disconnected was received. If leaving the call failed in the
server that message will not be received, so pending connections were
retried even if no longer in the call, and when joining again a previous
model could be reused, leading to different issues.
Due to that the call related data is now immediately cleared when the
call is left, no matter if the signaling message about leaving the call
is then received or not (and, if it is, nothing will happen as the data
was already cleared).
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
When "usersChanged(signaling, [], previousUsersInRoom)" is called
"previousUsersInRoom" is assigned to the difference with itself and,
therefore, to an empty array, so there is no need to explicitly do it
afterwards.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
When a call is left the UI always changes to the "not-in-a-call" state.
However, if leaving the call fails the signaling did not emit the
"leaveCall" event, so the WebRTC connections were not stopped due to
leaving the call, nor they were left later when the signaling sent the
updated list of participants, as the participant did not leave the call
from the point of view of the server.
Even if leaving the call fails in the server the call should be locally
left when the user requests it, so now "leaveCall" is emitted even if
leaving the call failed.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>