French President Emmanuel Macron has spoken to Iran's president, urging him to cease attacks on Middle East neighbours and in the crucial Strait of Hormuz.