SIP Trunk

I would like to know if there is a way that I can force a SIP trunk to only use a specific ip range but I have to be able to register soft phones on another ip range. My situation: I have set up my freepbx server at a call center and I am forced to use 2 ip ranges, one ip range for SIP registration and another for the soft phones to register but I have to limit freepbx to only use the ip range dedicated for outbound calls or else it keeps using the other ip range that is much slower and I end up with quality problems.

That doesn’t make much sense. Your trunk should have a host= setting for outbound, and will use that ip (not a range, just that one ip) however it resolves for outbound calls.

SIP registrations, from whatever, are allowed from whichever networks asterisk’s sip stack is bound to. If an extrension registers from a “slow” network, then it will pass the outbound call to that “slow” network, there is little you can do about that but use compressed codecs and ensure your QOS/TOS is honored by all intermediate routers to that network.

No, sorry what I meant was I have two IP’s set up on my asterisk all I basically want to do is to force my sip trunk to use only one specific gateway not both for sip registration because at this stage asterisk doesn’t use the correct gateway, any ideas??

That is a routing problem, not specifically an Asterisk one, set the route to your host on your router appropriately to your host= entry

To be clear you need to set a destination route in CentOS to your provider and specify the gateway you want to use.

This sounds like a flaw was made in the network design. Why do you need two default gateways with the same weight/priority? What networks do you reach from each gateway?

Sorry to bother you again, I wanted to know if you meant that I should include host=my host in the sip trunk configuration.

Your question makes no sense. The trunk host declaration is the IP address or URL of the SIP peer you are connection to.

No , to reiterate:-

“. . That is a routing problem, not specifically an Asterisk one . .” One could add to that “nor is it a FreePBX one”

I had to add the client’s current IP as a virtual interface in order for the soft phones to register with my server but I had to set up my own new network connection to provide a connection between that asterisk server and our VOIP provider but my problem is that the asterisk server keeps on using their internet connection instead of mine and that creates a problem because not only is their internet slow but it’s a prepaid wireless connection.

Bizarre as your implementation sounds, I suggest you should not have a gateway on that interface, but well configured routing/NAT tables would be a better approach.

JM2CWAE

Yes I don’t believe you need two default gateways.

What machine does this virtual network reside on? What do you mean by “your” machine and your “clients” machine? This scenario involves two Asterisk boxes? If so IAX may be a better choice.

If you want full help you need to lay out the requirements. Your question set off all the network design bells.

No, there is only one asterisk box involved. The setup is as follows: on asterisk server that registers with our VOIP server and billing system via our router and this is the one IP range (Asterisk ip= 172.17.22.10 Gateway= 172.17.22.1), and then there is the client’s network that connects all of the soft phones to that same asterisk server but on ip range(Asterisk IP= 192.168.1.241 Gateway=192.168.1.254). The problem I’m sitting with is that I want to specify to my sip trunk that connects to our VOIP provider to use IP range (172.17.22.1) instead of (192.168.1.254).

Then you need to research linux networking a little more, your sip trunk will use a ROUTE as you define it in your network infrastructure. there is no concept of ranges there (well there is. but you are way short of going there yet :wink: ), for you currently it needs to be a very specific ip (gateway) and that gateway (router) needs to be in your preferred network or it just wont do what you want it to.

Thanks will do that I though maybe there is a way in asterisk itself to specify to the sip trunks which gateway to use but I will rather research Linux networking and I am confident I will find a solution there.

Need more info, these are private IP’s do you have a VPN running back to the service provider switch? Is it a point to point circuit? Is NAT involved in either connection?

What kind of switch is the provider using? Do you control it?

Then I hope you will ultimately find and fully understand the basic ISO/OSI way of doing things:-

Then you will be less confused and understand why your initial mindset won’t work in the real world.

But congratulations to you on being the first poster for a while here to actually be prepared to actually “learn shit”

I had a look at that link you posted and yes it seems that I was searching at the wrong place for a solution. I should have though it through more thoroughly, Asterisk is only an application on Linux and that the routing is actually on Linux itself and not Asterisk but I’ll definitively widen my knowledge on Linux networking.

Glad you get it, welcome here and share when you feel comfortable . . :slight_smile: