hangup method

  1. @override
Future<void> hangup()
override

Implementation

@override
Future<void> hangup() async {
  if (!isOnCalling) {
    await reject();
    return;
  }
  _exitRoom();
  if (_isEmpty(mCurGroupId)) {
    for (int i = 0; i < mCurInvitedList.length; i++) {
      var time = DateTime.now().millisecondsSinceEpoch - mEnterRoomTime;
      var customMap = getCustomMap();
      customMap["call_end"] = time;
      await timManager.getSignalingManager().cancel(
          inviteID: _getGroupCallId(mCurInvitedList[i]),
          data: jsonEncode(customMap));
    }
  } else {
    if (mCurRoomRemoteUserSet.isEmpty) {
      timManager
          .getSignalingManager()
          .cancel(inviteID: mCurCallID, data: jsonEncode(getCustomMap()));
    }
  }
  _stopCall();
  emitEvent(TRTCCallingDelegate.onCallEnd, {});
}