Asterisk with 2 ip's on different nic card

cleard
cleard used Ask the Experts™
on
Hi all,

My sip provider as supplied me with 2 trunk
my Linux server as 2 nic card 2 different ips
trunk 1 external ip is xxx.xxx.xxx.189 router with static route going to internal ip 192.168.2.22 should be for long distance calls.
trunk 2 external ip is xxx.xxx.xxx.190 going to internal ip 192.168.2.29 should be for local calls
my problem is that when I do long distance call is going on ip 2.29 and when I do local calls it goes to the same ip.
My question i how can I get long distance calls to route from Asterisk to the right ip (xxx.xxx.xxx.189)?

Cleard  
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
This is interesting, I don´t think Asterisk can differentiate. When it writes SIP packets it fills the headers with whatever your sip.conf is configured with, but then passes the data to the TCP/IP stack (linux) for routing. I believe once the packet is encapsulated in UDP datagrams by the OS, the routing is left to it making it use the best route to reach the LD carrier. Can you post a route -n here?

Author

Commented:
Willlywiburwonka,

here it is:

192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth1
0.0.0.0         192.168.2.4     0.0.0.0         UG    0      0        0 eth0

Author

Commented:
don't forget I did my static route on my cisco pix
I couldn´t have forgotten cuz you didn´t mention it!

Now, in your sip.conf the 2 trunks should be configured separately with a host=x.x.x.x line in it. In the extensions.conf, there should be a extension configuration that matches calls to long distance numbers. The Dial() application will invoke the trunk for outgoing calls, using the right IP. I think this is the whole deal.

Author

Commented:
Thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial