hangup when currentSession has inCall flag = 0

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2022-01-05 21:10:54 +01:00 committed by Marcel Hibbe (Rebase PR Action)
parent b3b8c867f7
commit f70f94e6be

View File

@ -1618,10 +1618,12 @@ public class CallActivity extends CallBaseActivity {
} }
private void processUsersInRoom(List<HashMap<String, Object>> users) { private void processUsersInRoom(List<HashMap<String, Object>> users) {
Log.d(TAG, "processUsersInRoom");
List<String> newSessions = new ArrayList<>(); List<String> newSessions = new ArrayList<>();
Set<String> oldSessions = new HashSet<>(); Set<String> oldSessions = new HashSet<>();
hasMCU = hasExternalSignalingServer && webSocketClient != null && webSocketClient.hasMCU(); hasMCU = hasExternalSignalingServer && webSocketClient != null && webSocketClient.hasMCU();
Log.d(TAG, " hasMCU is " + hasMCU);
// The signaling session is the same as the Nextcloud session only when the MCU is not used. // The signaling session is the same as the Nextcloud session only when the MCU is not used.
@ -1630,13 +1632,18 @@ public class CallActivity extends CallBaseActivity {
currentSessionId = webSocketClient.getSessionId(); currentSessionId = webSocketClient.getSessionId();
} }
Log.d(TAG, " currentSessionId is " + currentSessionId);
for (HashMap<String, Object> participant : users) { for (HashMap<String, Object> participant : users) {
if (!participant.get("sessionId").equals(currentSessionId)) { if (!participant.get("sessionId").equals(currentSessionId)) { // own session is skipped
Object inCallObject = participant.get("inCall"); Object inCallObject = participant.get("inCall");
boolean isNewSession; boolean isNewSession;
if (inCallObject instanceof Boolean) { if (inCallObject instanceof Boolean) {
isNewSession = (boolean) inCallObject; isNewSession = (boolean) inCallObject;
} else { } else {
Log.d(TAG,
" inCallObject of participant " + participant.get("sessionId").toString().substring(0,4) +
" : " + inCallObject);
isNewSession = ((long) inCallObject) != 0; isNewSession = ((long) inCallObject) != 0;
} }
@ -1645,6 +1652,13 @@ public class CallActivity extends CallBaseActivity {
} else { } else {
oldSessions.add(participant.get("sessionId").toString()); oldSessions.add(participant.get("sessionId").toString());
} }
} else {
Object inCallObject = participant.get("inCall");
Log.d(TAG, " inCallObject of currentSessionId: " + inCallObject);
if(((long) inCallObject) == 0){
Log.d(TAG, " hangup!!!!!!!!!!");
hangup(true);
}
} }
} }
@ -1674,6 +1688,7 @@ public class CallActivity extends CallBaseActivity {
} }
for (String sessionId : newSessions) { for (String sessionId : newSessions) {
Log.d(TAG, " newSession joined: " + sessionId);
getPeerConnectionWrapperForSessionIdAndType(sessionId, "video", false); getPeerConnectionWrapperForSessionIdAndType(sessionId, "video", false);
} }
@ -1682,6 +1697,7 @@ public class CallActivity extends CallBaseActivity {
} }
for (String sessionId : oldSessions) { for (String sessionId : oldSessions) {
Log.d(TAG, " oldSession that will be removed is: " + sessionId);
endPeerConnection(sessionId, false); endPeerConnection(sessionId, false);
} }
} }