I understand intermediate endpoints *expect* these headers, this is why I asked if there's anyway for Kamailio to remember what is removed and essentially re-add them to the response, IE-
SIP request hits edge proxy from internal network > Via and Route headers from intermediate proxies are removed, previous 'path' is stored in memory linked to the dialog > SIP request is forwarded to end point.
End point responds to request via edge proxy > edge proxy looks up existing dialog and reinserts the missing headers > forwards to the next hop.
What I'm asking is theoretically possible, although it may not be RFC compliant or something that Kamailio supports.
Thanks