Problem using two sip trunk to a Freepbx softswitch from the same IP


Here’s my problem. We have two FreePBX system:

FreePBX 1 (Softswitch)
Contains all SIP providers trunks to make external calls and contains also SIP extensions that FreePBX2 connects to.

FreePBX 2 (Standard PBX)
Contains users extensions and two SIP trunks connected to the FreePBX 1

Main issue: FreePBX 2 is connected to the softswitch SIP extensions with two sip trunks. Outbound routes are made on the FreePBX2 to use, depending on the call, trunk1 or trunk2. The thing is that for some reason the system seems to use the trunks randomly, regardless the outbound routes made on FreePBX 2.

One of my coworker though it might be because these two trunks connects from the same system (same IP) to the softswitch, but that actually shouldn’t cause any problem I think.

So, that being said, we are stuck there because using two trunks seems not possible from there. I can provide the trunk’s Peer Details and User context if needed.

Thanks you for you help.

Once again for everyone out there …
What version of freePBX are you using ???
This can be found by going to Admin -> System Admin in the FreePBX GUI !!! it really is not that hard to supply this information …

What outbound routes do you have on FreePBX1?
Is FreePBX1 basically a gateway from the internal PBX to the outside world?

Are the calls leaving FreePBX2 on the right trunk?

Hi mark,

Thanks for taking the time to answer me. Both FreePBX are running on version

As you said, FreePBX1 is a gateway, only this one has the outside world trunks. It has about 15 trunks connected to different SIP providers. FreePBX2 (and 3,4,5,6,etc) all goes by FreePBX1 to call to the outside world.

Outbound rules on the gateway only provide which trunks to use depending on what number is dialed from the other PBX.

To answer your last question, the main issue actually is that not all calls leave FreePBX2 on the right trunk, as if it will use any trunks that are configured.

I will provide a little drawing of the actual configuration that might help to understand the setting. Thank you.

Need more information to help you:

What are your outbound routes?
How many?
List each one, the patterns it matches, and which trunk it goes to AND the order that the trunk is listed in FreePBX

For example

Outbound route 1
Trunk 1

Also, and I think the reason Mark asked for what version, I have read that older FreePBX/Asterisk versions had a bug where you had to name the Outbound Trunks


Or else they wouldnt order properly. Order of trunks is inportant because patterns attempt to be matched in that order. For example if i dial 123 and my trunk patterns are

1-trunk: 5xxx
2-trunk: xxx
3-trunk: 123

123 will match the pattern xxx before it matches 123 and will be sent out trunk 2 instead of trunk 3

1 Like