NAT Problem with SIP and Local Network

I have a SIP with a Public IP trunk, had a lot of problems had to change the firewall brand and included on the sip.conf

All this fixed the problem, but now have another issue I also have a VPN with a branch an Asterisk is answering with the PublicIP which is not available from the VPN local network, so what I need is for network to answer with the Public IP and and on the VPN domain with the private IP. I tried setting nat on the trunks but it does not work.

You need to extend localnets to include all of the VPN.

nat= doesn’t mark a “trunk” as subject to NAT, it simply applies selected hacks for various NAT scenarios. nat=yes is deprecated in favour of listing the individual hacks required.

Thanks a lot worked like a charm

Remember hosts falling within the network ranges specified by the localnet option will be excluded from any NATing efforts by Asterisk. As a result, the source IP address within the SIP requests/responses will use the internal IP address of the network interface associated with bindaddr