Praise be to Allah.
If the time for prayer comes when the traveller is still in his city, then he should pray it in full because he has not yet left his city. If he has left his city and is on the road when the time for prayer comes, then he should pray two rak’ahs even if the adhaan came before he left his city. What counts here is the prayer (not the adhaan). Similarly, if the time for prayer comes whilst you are still travelling, but you reach your home before you pray, then you have to pray four rak’ahs, because in this case what counts is the actual prayer. If you pray when you are travelling, you should shorten your prayer; if you pray when you are at home, you should pray it in full.