Asterisk in the middle of 2 SIP trunks

Hi folks, little help?

I have an interconnect to two SIP providers via MAN and one NIC.
For the 1st provider:
Asterisk eth0 -
gate -
real IP -

The gate is doing full nat. What comes from Asterisk to provider1 is routing throu the MAN of provider1 (, what comes from provider1 to is DNAT-ing back to Asterisk (all ports and protocols).

For SIP provider2:
Asterisk eth0.100 - (VLAN interface, real public IP that gave me provider2)
gate - (real public gate of provider2)
Here I have a direct routing to provider2.

I want to do ORIGINATE with number from provider1 and number with provider2. The RTP has to stay in Asterisk, these two networks cannot be accessed via Internet. Provider1 do not have access to provider2 and vise verca.

With default sip.conf (no externip or localnet) and “canreinvite = no” for provider2 when making calls throu provider2 everything works (RTP is in Asterisk). Contact header in SDP is the real IP for provider2 ( With provider1 this do not work. Contact header in SDP is my fake IP - I have to put externip in sip.conf to my external IP for provider1 to work. But in that case provider2 do not work.

In other words how do you make calls when you have 2 SIP providers with 2 different routing to them, with 2 different real IP addresses?

My temporary solution is to run 2 Asterisk servers on one box. The second * is for the second SIP trunk. The two servers are trunked via IAX2.

Do anyone has a suggestion?