No, Kamailio should definitely not be rewriting the Contact. That is set
by the remote dialog parties only.
If the ACK is being sent directly to the host in the domain portion of
the Contact address, that is because the endpoint is ignoring/not
honouring Record-Route. That's radioactively wrong behaviour and should
be fixed.
Reinvites do not alter the Route set, as clearly stated in RFC 3261 ยง
12.2:
Requests within a dialog MAY contain Record-Route and Contact header
fields. However, these requests do not cause the dialog's route set
to be modified, although they may modify the remote target URI.
-- Alex
--
Alex Balashov | Principal | Evariste Systems LLC
Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
Web:
http://www.evaristesys.com/,
http://www.csrpswitch.com/