Two separate Environments over one FreePBX


I had one simple use case: one hard phone and one outgoing trunk. Everything went fine.

In the time between I started my own little business and wanted to add a second trunk (an other SIP provider) and a second hard phone. The idea: hardphone1 outgoing/incoming via/from trunk1 and hardphone2 outgoing/incoming via/from trunk2.

Both trunks are registered, both hardphones are registered (everything via PJSIP)

Outbound Route:
Business: ()| [. / 3100]
Family: ()| [. / 30XX]

Business hardphones extension is 3100 and the family has 3005. I want to take every number less than 3100 for fam and 3100 and up for business to be able to add more extensions.

Is that correct for the incoming part?

If you just want to create some sort of “conceptual” division, that is you “knowing” that each extension belongs to its environment, then it is fine. If what you really want is to create a complete separation between both environments, like limiting which extension can call another extension, that would be a multi-tenant situation, for which FreePBX is not the best alternative.
Then again if you are fine with the “conceptual” approach, just direct incoming calls from each trunk to the desired extensions and create two different outbound routes, one for each trunk, setting the caller id for the two different extension groups. That would give you the separation you want, if you don’t mind that extensions 31xx can still communicate freely with 30xx

Hi what is a batter solution for multi tenant configuration ?

If you want to stay with FreePBX, one simple way without the need for custom code, would be to install two VMs with FreePBX on each one and use each FreePBX for each environment.

If you want to go with a truly multi-tenant solution, you can go with FusionPBX, the GUI PBX based on FreeSWITCH.

Hi there,

thanks for your reply. I would go for the “conceptional” idea. It is no problem that both sections can call each other.

I was just wondering if it is working in general, because I’m not able to set up the second trunk.

<--- Transmitting SIP request (1081 bytes) to UDP: --->
INVITE sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP 80.133.381.144:5060;rport;branch=z9hG4bKPjbdbb8d46-0140-4fa5-a639-2fb2b3f441f3
From: <sip:[email protected]>;tag=73a71c0f-4430-426d-bb07-9472bfb5fe39
To: <sip:[email protected]>
Contact: <sip:[email protected]:5060>
Call-ID: 6fd0445f-3dd2-4d7d-8560-adb6256bf027
CSeq: 1404 INVITE
Route: <sip:[email protected]:5060;lr>
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
Max-Forwards: 70
User-Agent: FPBX-
Content-Type: application/sdp
Content-Length:   343

o=- 1153064233 1153064233 IN IP4 80.133.381.144
c=IN IP4 80.133.381.144
t=0 0
m=audio 10004 RTP/AVP 8 9 3 111 4 101
a=rtpmap:8 PCMA/8000
a=rtpmap:9 G722/8000
a=rtpmap:3 GSM/8000
a=rtpmap:111 G726-32/8000
a=rtpmap:4 G723/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16

<--- Received SIP response (400 bytes) from UDP: --->
SIP/2.0 403 Forbidden
Via: SIP/2.0/UDP 80.133.381.144:5060;received=80.133.381.144;rport=5060;branch=z9hG4bKPjbdbb8d46-0140-4fa5-a639-2fb2b3f441f3
To: <sip:[email protected]>;tag=h7g4Esbg_wpore1iw4gphuoch6nm4sj9rwik9zowm
From: <sip:[email protected]>;tag=73a71c0f-4430-426d-bb07-9472bfb5fe39
Call-ID: 6fd0445f-3dd2-4d7d-8560-adb6256bf027
CSeq: 1404 INVITE
Content-Length: 0

The trunk is registered, incoming calls are working well, but outgoing calls are rejected:
“Dial failed for some reason with DIALSTATUS = CHANUNAVAIL and HANGUPCAUSE = 21”

Edit: I’m wondering, if the private IP of the FreePBX may be the problem? I run this server behind a NAT router. The connection to Sipgate as second provider works well.

Maybe the authentication is wrong? Or the telephone number is not formatted as expected by the provider?

You generally cannot have two trunks from the same provider in the same PoP trying to send calls to your IP on port 5060. as an example, if you try to have two trunks come from one will have problems. Change one trunk to and then everything will work.

Because it is coming from a different IP from the provider.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.