Also, although I have’t looked too closely at this in Asterisk, IP was intended to be an internet protocol, to make one big network out of multiple networks. It was never intended to create disjoint networks accessed from the same machine.
I am not completely convinced that you can make this work without using two instances of Asterisk, linked by something other than SIP.
At least for 188.8.131.52, it looks to me that there is only one IP address ever used when contacting machines believed to be within the NAT boundary:
[code]/*! \brief our (internal) default address/port to put in SIP/SDP messages
- internip is initialized picking a suitable address from one of the
- interfaces, and the same port number we bind to. It is used as the
- default address/port in SIP messages, and as the default address
- (but not port) in SDP messages.
static struct sockaddr_in internip;[/code]
and only one other used for machines outside the NAT boundary.
[code]/*! \brief our external IP address/port for SIP sessions.
- externip.sin_addr is only set when we know we might be behind
- a NAT, and this is done using a variety of (mutually exclusive)
- ways from the config file:
- with “externip = host[:port]” we specify the address/port explicitly.
- The address is looked up only once when (re)loading the config file;
- with “externhost = host[:port]” we do a similar thing, but the
- hostname is stored in externhost, and the hostname->IP mapping
- is refreshed every ‘externrefresh’ seconds;
- with “stunaddr = host[:port]” we run queries every externrefresh seconds
- to the specified server, and store the result in externip.
- Other variables (externhost, externexpire, externrefresh) are used
- to support the above functions.
static struct sockaddr_in externip; /!< External IP address if we are behind NAT */[/code]
I’m not aware of changes in later versions, which means that the application layer will arbitrarily choose one address, which is not going to work if you have disjoint networks, unless the other sides ignore the information in the SIP headers and just use the actual source address.
I tend to describe the sort of configuration you seem to want as an “improperly multi-homed” one.