mute method

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

Implementation

bool mute({String? callId}) {
  if (callId == null) {
    if (!callCurrentIsEmpty()) {
      Call? call = _sipuaHelper.findCall(_callIdCurrent!);
      if (call != null) {
        if (_audioMuted) {
          call.unmute(true, false);
          Helper.setMicrophoneMute(false, _localStream!.getAudioTracks()[0]);
        } else {
          call.mute(true, false);
          Helper.setMicrophoneMute(true, _localStream!.getAudioTracks()[0]);
        }
        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 (_audioMuted) {
        call.unmute(true, false);
        Helper.setMicrophoneMute(false, _localStream!.getAudioTracks()[0]);
      } else {
        call.mute(true, false);
        Helper.setMicrophoneMute(true, _localStream!.getAudioTracks()[0]);
      }
      return true;
    }
    return false;
  }
}