A ceasefire agreed between Thailand and Cambodia aims to end almost three weeks of the worst fighting in years between the Southeast Asian nations.