He also assaulted two police officers after being arrested on March 24.
The random attack on the woman took place on August 24 last year in Peterborough. Ali shouted racial abuse at the victim and walked away.
Police were called and a media appeal was made in a bid to identify the suspect. A police community support officer recognised Ali and on September 4 he was arrested and released on bail.
On March 24 officers were called to a report of domestic abuse at Ali’s home and he was arrested on suspicion of assaulting his mother.
Ali was erratic and aggressive in custody and spat at an officer. The next morning he remained aggressive and threw a phone he had been given to consult with his solicitor at a police officer, called him racist and spat at him through the cell hatch.
Ali pleaded guilty to racially or religiously aggravated common assault, two counts of assault on an emergency worker and assault by beating, before being jailed at Peterborough Crown Court last Friday (June 4)
PC Antonio Monteiro of Cambridgeshire Constabulary said: "The disrespect Kamran Ali showed to a complete stranger in public, and to officers who were simply doing their job, was completely unacceptable, and will not be tolerated.
"I hope this sentence gives him opportunity to reflect on his behaviour."