onCallHangup method

Future<void> onCallHangup(
  1. String roomId,
  2. String _,
  3. Map<String, dynamic> content
)

Implementation

Future<void> onCallHangup(String roomId, String _ /*senderId unused*/,
    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[callId];
  if (call != null) {
    if (call.room.id != roomId) {
      Logs().w(
          'Ignoring call hangup for room $roomId claiming to be for call in room ${call.room.id}');
      return;
    }
    // hangup in any case, either if the other party hung up or we did on another device
    await call.terminate(CallParty.kRemote,
        content['reason'] ?? CallErrorCode.UserHangup, true);
  } else {
    Logs().v('[VOIP] onCallHangup: Session [$callId] not found!');
  }
  if (callId == currentCID) {
    currentCID = null;
  }
}