/** Do the actual muting/unmuting. */
  private void doRun() {
    if (call != null) {
      OperationSetBasicTelephony<?> telephony =
          call.getProtocolProvider().getOperationSet(OperationSetBasicTelephony.class);

      mute = !mute;
      telephony.setMute(call, mute);

      // We make sure that the button state corresponds to the mute state.
      setSelected(mute);

      // If we unmute the microphone and the volume control is set to min,
      // make sure that the volume control is restored to the initial
      // state.
      if (!mute && volumeControl.getVolume() == volumeControl.getMinValue()) {
        volumeControl.setVolume((volumeControl.getMaxValue() - volumeControl.getMinValue()) / 2);
      }
    }
  }