Section 13B. If a person in any state which by its laws has made provision for commanding persons within its borders to attend and testify in criminal proceedings pending, or grand jury investigations and proceedings commenced or about to commence, in this commonwealth is a material witness in a criminal proceeding pending in a court of record of this commonwealth, or in a grand jury investigation or proceeding which has commenced or is about to commence within the jurisdiction of such a court of record, a justice or special justice of such court may issue a certificate under the seal of the court, stating such facts and specifying the number of days the witness will be required, which certificate may be presented in accordance with the laws of such other state to a magistrate or officer thereof for appropriate action to secure the attendance of such witness in this commonwealth. Such certificate may include a recommendation that the witness be taken into immediate custody and delivered to an officer of this commonwealth to assure his attendance in this commonwealth.
If the witness is summoned to attend and testify in this commonwealth he shall be tendered the sum of ten cents a mile for each mile by the ordinary traveled route to and from the place where the criminal proceeding is pending, or the grand jury investigation or proceeding has commenced or is about to commence, and five dollars for each day that he is required to travel and attend as a witness. A witness who has appeared in accordance with the provisions of the summons shall not be required to remain within this commonwealth a longer period of time than the period mentioned in the certificate, unless otherwise ordered by the court having jurisdiction of the criminal proceeding or grand jury investigation or proceeding; and any court order that such witness remain after the time for which he was summoned shall be conditioned upon the immediate tender to him of five dollars for each day during which his further attendance as a witness is ordered. If such a witness, after coming into this commonwealth, fails without good cause to attend and testify as directed in the summons, he shall be punished in the manner provided for the punishment of a witness who disobeys a summons issued from a court of record of this commonwealth.