A person voluntarily present in court or before a judicial officer may be required to testify in the same manner as if he were in attendance before such court or officer on a subpoena.