SIP Invite showing Public IP for All Calls

Asterisk server with public(10) and private interface(36).

I have some phones that register on the public interface and some phones that are on the private interface. When a sip invite is sent to the private phones the sip invite contains the public IP which forces the calls to leave the network to reach the public interface of the server. This is the desired effect for the public phones. How do I separate the two on the same server to where the sip invite is going out only on the private interface for the private phones and not negatively affect the public phones.

Thank you,

I assume that you have a setting for “externip=” in sip.conf (or one of it’s include files). Do you have a setting for “localnet=” that specifies the local network address range?

I did. I ended up fixing my issue. They issue was I had a public interface 208.XXX.XXX.XXX with a default gateway and while my private interface 10.20.30.XXX My phones where on 10.20.31.XXX so everything was going out the defualt gateway. I changed my subnet to and the proper IP address was handling the call. I go a clue from another post that said Asterisk always uses IP tables to determine the egress IP address / interface.