toggleHold method

bool toggleHold({
  1. String? callId,
})

Implementation

bool toggleHold({String? callId}) {
  if (callId == null) {
    if (!callCurrentIsEmpty()) {
      Call? call = _sipuaHelper.findCall(_callIdCurrent!);
      if (call != null) {
        if (_holdCall) {
          call.unhold();
        } else {
          call.hold();
        }
        return true;
      }
      return false;
    } else {
      _logger.error('You have to set callIdCurrent or pass param callId');
      return false;
    }
  } else {
    Call? call = _sipuaHelper.findCall(callId);
    if (call != null) {
      if (_holdCall) {
        call.unhold();
      } else {
        call.hold();
      }
      return true;
    }
    return false;
  }
}