2 SIP Trunk

Hi
I have two sip trunk that i want to use them both in my asterisk
one of them should be registered with a public ip address and the other with a private ip address behind a router!
as we cann’t use externip for each separately how can i have these two trunk in my asterisk.
for more detail assume that addresses are like this:

sip trunk 1:
sip server1 ip address: w.x.v.q/24 (private)
my ip address: w.x.y.z/24 (private)

sip trunk 2:
sip server2 ip address: a.b.c.d/32 (public)
my public ip address: e.f.g.h/32 (public)

i use asterisk 1.8

You will probably need two instances, one talking to the public internet and the other to the second private network. That assumes that you don’t really have a single w.x/16 network.

My scenario is exactly like above!
Is there any solution to do it?!

[quote=“imantaki”]My scenario is exactly like above!
Is there any solution to do it?![/quote]
I don’t see what this adds to your original posting.

I already gave you a solution. One instance of asterisk talks to the external provider and the local network. The other talks to the provider on the unrelated local network. As both are on the same local local network, they can talk to each other and thus calls can be forwarded between the true public server and the disjoint local network one.

I also hinted that most people would not use NAT between two local sub-networks, and would have full routing between them.

Aha! But I don’t understand what do you mean by two instances! You mean i should have 2 asterisk?!
Is there any solution that i have these in one server?

Running 2 instances of Asterisk should not be necesarry in that case. Majority of my installations use a similar setup and I eazily manage this in Asterisk configuration.

Try using localnet, externip and nat=yes on the trunk on the internet and nat=no on the trunk that is on the LAN.

nat= doesn’t do what you think it does. It is actually for when the remote peer is behind NAT, but isn’t compensating for that. It causes Asterisk to use the actual source IP address, rather than the IP address contained in the SIP packet.

This is only simple if there is not actually a NAT process between the two private networks, and there is only really one private network, made from two subnetworks.