A witness, including a witness specified in subdivision (b) of Section 1987, is not obliged to attend as a witness before any court, judge, justice or any other officer, unless the witness is a resident within the state at the time of service.
Ca. Civ. Proc. Code § 1989