US President Donald Trump called on Israelis and Palestinians to make compromises that could lead to peace as he wrapped up a visit with a speech in Jerusalem.