fix: ignore call events from own user even if todevice

This commit is contained in:
td 2024-06-11 18:43:18 +05:30
parent b37fb0728f
commit 7f41b2d4c8
No known key found for this signature in database
GPG Key ID: 62A30523D4D6CE28
1 changed files with 13 additions and 7 deletions

View File

@ -215,6 +215,13 @@ class VoIP {
Logs().w( Logs().w(
'[VOIP] _handleCallEvent call event does not contain a room_id, ignoring'); '[VOIP] _handleCallEvent call event does not contain a room_id, ignoring');
return; return;
} else if (client.userID != null &&
client.deviceID != null &&
remoteUserId == client.userID &&
remoteDeviceId == client.deviceID) {
Logs().v(
'Ignoring call event ${event.type} for room ${room.id} from our own device');
return;
} else if (!event.type } else if (!event.type
.startsWith(EventTypes.GroupCallMemberEncryptionKeys)) { .startsWith(EventTypes.GroupCallMemberEncryptionKeys)) {
// skip webrtc event checks on encryption_keys // skip webrtc event checks on encryption_keys
@ -230,7 +237,7 @@ class VoIP {
!{EventTypes.CallInvite, EventTypes.GroupCallMemberInvite} !{EventTypes.CallInvite, EventTypes.GroupCallMemberInvite}
.contains(event.type)) { .contains(event.type)) {
Logs().w( Logs().w(
'Ignoring call event ${event.type} because we do not have the call'); 'Ignoring call event ${event.type} for room ${room.id} because we do not have the call');
return; return;
} else if (call != null) { } else if (call != null) {
// multiple checks to make sure the events sent are from the the // multiple checks to make sure the events sent are from the the
@ -242,19 +249,18 @@ class VoIP {
} }
if (call.remoteUserId != null && call.remoteUserId != remoteUserId) { if (call.remoteUserId != null && call.remoteUserId != remoteUserId) {
Logs().w( Logs().w(
'Ignoring call event ${event.type} from sender $remoteUserId, expected sender: ${call.remoteUserId}'); 'Ignoring call event ${event.type} for room ${room.id} from sender $remoteUserId, expected sender: ${call.remoteUserId}');
return; return;
} }
if (call.remotePartyId != null && call.remotePartyId != partyId) { if (call.remotePartyId != null && call.remotePartyId != partyId) {
Logs().w( Logs().w(
'Ignoring call event ${event.type} from sender with a different party_id $partyId, expected party_id: ${call.remotePartyId}'); 'Ignoring call event ${event.type} for room ${room.id} from sender with a different party_id $partyId, expected party_id: ${call.remotePartyId}');
return; return;
} }
if ((call.remotePartyId != null && if ((call.remotePartyId != null &&
call.remotePartyId == localPartyId) || call.remotePartyId == localPartyId)) {
(remoteUserId == client.userID && Logs().v(
remoteDeviceId == client.deviceID!)) { 'Ignoring call event ${event.type} for room ${room.id} from our own partyId');
Logs().w('Ignoring call event ${event.type} from ourself');
return; return;
} }
} }