A ceasefire deal has been agreed after 15 months of warfare in the region.