(CNN) — After years of accusations and denials, Bill Cosby will finally go on trial next year.

On Tuesday, a judge in Pennsylvania scheduled a June 5, 2017, court date for the 79-year-old entertainer.

He is charged with three counts of felony aggravated indecent assault related to a 2004 case involving Andrea Constand, an employee at his alma mater, Temple University.

She said she went to his home in a Philadelphia suburb for a career consultation and he gave her a mix of pills and wine that left her incapacitated and unable to consent to sex.

Cosby has pleaded not guilty to all charges. He arrived at the hearing wearing a light gray sports coat with dark stripes and holding a man’s arm and carrying a cane.

This is the first time Cosby has faced criminal charges, though more than 50 women have come forward in recent years to say Cosby sexually abused them over the last four decades. Most of the other alleged incidents occurred outside the statute of limitations.

But some of those other women may testify at Cosby’s trial.

Judge Steven O’Neill, speaking at a preliminary hearing in the Philadelphia suburb of Norristown, said the district attorney has filed a motion intending to present witnesses to 13 alleged prior instances.

Rule 404(b) of the Pennsylvania Rules of Evidence allows prosecutors to call witnesses about a defendant’s previous conduct if it relates to the trial at hand. They could help prosecutors buttress Constand’s allegations.

The women who might testify are not named in the motion and O’Neill did not rule on it Tuesday.

Nor did he rule on motions to throw out two key pieces of evidence: a deposition Cosby gave in a 2005 lawsuit by Constand and a recording of a phone call between Cosby and Constand’s mother.

Defense lawyers said they planned to file motions for a change of venue and the judge gave them 60 days to file.

The 2005 deposition

The criminal case is based partly on the deposition Cosby gave in Constand’s 2005 civil lawsuit, in which he talked about having extramarital affairs and giving other women drugs with their consent so they’d have sex with him. He also described the sexual encounter with Constand, saying it was consensual.

This motion was not argued on Tuesday and the judge didn’t say when he would rule on it.

In motions they’ve filed, the lawyers say Cosby only answered the deposition questions because Bruce Castor, the district attorney in 2005, promised to never bring a criminal case based on Constand’s allegations. To use the deposition now violates Cosby’s right against self-incrimination, they say.

Castor said he made that promise so the entertainer would not be able to use the Fifth Amendment to avoid answering questions in a deposition, according to an email from Castor to his successor, Risa Vetri Ferman. The civil suit was the best chance Constand had for finding justice, the Castor email said.

Kevin Steele, the current district attorney, has not responded to the defense motion.

Constand filed her lawsuit after Castor decided not to prosecute.

The deposition was sealed when the parties reached a settlement in 2006. The criminal case was reopened after The Associated Press went to court to compel the unsealing of the deposition.

In the years before that, more than 50 women had come forward to say Cosby sexually assaulted them, often by slipping them drugs. Cosby has denied all those accusations.

Phone call with Constand’s mother

The defense and prosecution did argue Tuesday about a recording of a January 17, 2005, phone call between Cosby and Gianna Constand, the mother of Andrea Constand. The judge said he will rule on the defense’s motion to suppress the recording within the week.

Cosby’s lawyers cited wiretapping and electronic surveillance laws. They say he didn’t know Gianna Constand was recording when he called her in Pickering, Ontario, from his home in California.

Canadian law allows calls to be legally recorded with only one party consenting, the motion says.

But the defense lawyers say Pennsylvania law, which requires two-party consent, should be applied in this case.

In his response, prosecutor Steele says Cosby knew or suspected the calls were being recorded.

A transcript of the call has him asking about a beeping, which Gianna Constand says was a parrot. In the deposition, Cosby was asked if he believed the call was recorded and he replied yes, Steele’s response says.

Further, Cosby knew he was placing a call to Canada, which only requires one-party consent, Steele says.

A transcript of the call shows Cosby offering to pay for Andrea Constands’ further education.

The recording was played in court and the audio quality was weak, with both prosecutors and the judge saying they could not hear any beeps.

CNN’s Aaron Cooper contributed to this report.