From 06728b4b754ae391146955384cf674b2de15ef7d Mon Sep 17 00:00:00 2001 From: td Date: Thu, 23 May 2024 14:10:20 +0530 Subject: [PATCH] fix: make sure room is postLoaded before starting calls more logging --- lib/src/voip/utils/famedly_call_extension.dart | 9 ++++++++- lib/src/voip/voip.dart | 14 +++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/lib/src/voip/utils/famedly_call_extension.dart b/lib/src/voip/utils/famedly_call_extension.dart index 4f5a70b1..23719e2d 100644 --- a/lib/src/voip/utils/famedly_call_extension.dart +++ b/lib/src/voip/utils/famedly_call_extension.dart @@ -129,7 +129,14 @@ extension FamedlyCallMemberEventsExtension on Room { ); } else { throw MatrixSDKVoipException( - 'User ${client.userID}:${client.deviceID} is not allowed to send famedly call member events in room $id, canJoinGroupCall: $canJoinGroupCall, room.canJoinGroupCall: $groupCallsEnabledForEveryone', + ''' + User ${client.userID}:${client.deviceID} is not allowed to join famedly calls in room $id, + canJoinGroupCall: $canJoinGroupCall, + groupCallsEnabledForEveryone: $groupCallsEnabledForEveryone, + needed: ${powerForChangingStateEvent(EventTypes.GroupCallMember)}, + own: $ownPowerLevel} + plMap: ${getState(EventTypes.RoomPowerLevels)?.content} + ''', ); } } diff --git a/lib/src/voip/voip.dart b/lib/src/voip/voip.dart index 7a752c04..847eca56 100644 --- a/lib/src/voip/voip.dart +++ b/lib/src/voip/voip.dart @@ -769,13 +769,25 @@ class VoIP { String? scope, { bool preShareKey = true, }) async { + // somehow user were mising their powerlevels events and got stuck + // with the exception below, this part just makes sure importantStateEvents + // does not cause it. + await room.postLoad(); + if (!room.groupCallsEnabledForEveryone) { await room.enableGroupCalls(); } if (!room.canJoinGroupCall) { throw MatrixSDKVoipException( - 'User ${client.userID}:${client.deviceID} is not allowed to join famedly calls in room ${room.id}, canJoinGroupCall: ${room.canJoinGroupCall}, room.canJoinGroupCall: ${room.groupCallsEnabledForEveryone}', + ''' + User ${client.userID}:${client.deviceID} is not allowed to join famedly calls in room ${room.id}, + canJoinGroupCall: ${room.canJoinGroupCall}, + groupCallsEnabledForEveryone: ${room.groupCallsEnabledForEveryone}, + needed: ${room.powerForChangingStateEvent(EventTypes.GroupCallMember)}, + own: ${room.ownPowerLevel}} + plMap: ${room.getState(EventTypes.RoomPowerLevels)?.content} + ''', ); }