Hi Alex,

On Tue, May 13, 2014 at 4:39 PM, Alex Balashov <abalashov@evaristesys.com> wrote:
Have a look at replacing your record_route() call with record_route_preset():

   http://kamailio.org/docs/modules/4.1.x/modules/rr.html#idp114624

As for the advertised address more generally, i.e. in Via, have a look at this core parameter:

   http://www.kamailio.org/wiki/cookbooks/4.1.x/core#advertised_address

Thanks. I just added the advertised_address parameter as a test, now Kamailio puts the external IP into Via and RR, but still uses the port 15060 from the other socket.

However, the docs say:
"If empty or not set (default value) the socket address from where the request will be sent is used."

This is what I would expect, but this is not what's happening. It uses a different socket for the Via and RR header than it actually uses for sending the request out.

I worked around this problem by placing the listen line for the unused TCP connection after the used one, and now it looks a lot better. But I still think, that the Via and RR headers should never differ from the actually used socket, when not using the set_advertised_address function.

Best Regards,
Sebastian