When a user agent initiates INVITE request message, it adds "Route" header that informs which immediate proxy is going to receive this INVITE message since user agent client does not know the address of other party. As soon as, INVITE message is received by immediate proxy server, it removes "Route" header field and add "Record-Route" header field with its URI information.
Once the modified INVITE message received by proxy server of other end, it modifies the INVITE message and sends to the other party. As part of modification of INVITE message, proxy server adds another "Record-Route" field with its own URI.
When response message travels into back direction, each SIP element (proxy server) uses "Record-Route" to forward the response messages. Once the 200 OK is exchanged between user agents for a dialog/session, user agents start using "Route" field for the further message exchange as by now both the party know each other contact id.