onCallHangup method

Future<void> onCallHangup(
  1. Room room,
  2. Map<String, dynamic> content
)

Implementation

Future<void> onCallHangup(Room room, Map<String, dynamic> content) async {
  // stop play ringtone, if this is an incoming call
  await delegate.stopRingtone();
  Logs().v('[VOIP] onCallHangup => ${content.toString()}');
  final String callId = content['call_id'];

  final call = calls[VoipId(roomId: room.id, callId: callId)];
  if (call != null) {
    // hangup in any case, either if the other party hung up or we did on another device
    await call.terminate(
        CallParty.kRemote,
        CallErrorCode.values.firstWhereOrNull(
                (element) => element.reason == content['reason']) ??
            CallErrorCode.userHangup,
        true);
  } else {
    Logs().v('[VOIP] onCallHangup: Session [$callId] not found!');
  }
  if (callId == currentCID?.callId) {
    currentCID = null;
  }
}