171 (1)...
Provided that, if any complainant or witness refuses to attend or to execute a bond as directed in section 170, the officer in charge of the police-station may forward him in custody to the Magistrate, who may detain him in custody until he executes such bond, or until the hearing of the case is completed.
(2) Notwithstanding anything contained in sub-section (1), it shall be the responsibility of the police-officer to ensure that the complainant or the witness appears before the Court at the time of hearing of the case.
Procedure for witness testimony - national proceedings
Assistance of States in the attendance and testimony of witnesses and production of documents
EDIT.