sendGroupCallTerminateEvent method

Future<String?> sendGroupCallTerminateEvent(
  1. String groupCallId
)

returns the event_id if successful

Implementation

Future<String?> sendGroupCallTerminateEvent(String groupCallId) async {
  try {
    Logs().d('[VOIP] running sendterminator');
    final existingStateEvent =
        getState(EventTypes.GroupCallPrefix, groupCallId);
    if (existingStateEvent == null) {
      Logs().e('[VOIP] could not find group call with id $groupCallId');
      return null;
    }

    final req = await client
        .setRoomStateWithKey(id, EventTypes.GroupCallPrefix, groupCallId, {
      ...existingStateEvent.content,
      'm.terminated': GroupCallTerminationReason.CallEnded,
    });

    Logs().i('[VOIP] Group call $groupCallId was killed uwu');
    return req;
  } catch (e, s) {
    Logs().e('[VOIP] killing stale call $groupCallId failed', e, s);
    return null;
  }
}