I have system setup where there are few Asterisk servers behind Kamailio that is behind the firewall. There is a problem with call initiation. When phone from outside sends INVITE to Kamailio, it then passes it to one of Asterisk servers. Asterisk server eventually replies to Kamailio with 200 OK. Contact header contains Asterisk's local IP address and port. Kamailio executes function fix_nated_contact before sending reply to the phone. However Contact header will still have Asterisk's local socket.
fix_nated_contact is being executed with no doubt. I can see xlog output that I set before and after it. Can someone tell how exactly fix_nated_contact gets "request's source address:port pair" and if it can be printed to the log?