Iran and Israel traded waves of missile attacks as the ceasefire announced by US President Trump approached.