FreePBX + Digium gateway 2G402F?

Dear all,

I installed a free-PBX (version + Digium Gate 2G402F (4 port) + two PSTN providers

Free-PBX server IP:
Digium gateway has two IPs: and

I have two extensions: 6XXX and 7XXX
I need to configure outbound calls for extensions with: 7XXX through port 1 on Digium gateway and 6XXX through port 2 on Digium gateway. so I created two trunks in freePBX to Digium gateway:

first trunk:
trunk name: 6XXX

and second trunk:

trunk name: 7XXX

I created outbound route in freePBX and saw that extensions 6XXX go through trunk name: 6XXX and extensions 7XXX go through trunk name: 7XXX

I also created two call routing rules on Digium gateway. the outbound calls on trunk 6XXX go through port 1 and 7XXX go through port 2.

but I have issue, all outbound calls go through port 1 on Digium gateway.

Please help on this

That is probably because the ports in the gateway are configured to act as a trunk, that is the gateway decides which port to use. Look for an option to configure port selection.

I re-checked the call routing rules in gateway.
the trunk 6XXX --> port1 in gateway --> PSTN 1
the trunk 7XXX --> port2 in gateway --> PSTN 2

But outbound calls still went through port 1 --> PSTN1

when I tried to disable port1 in gateway, then outbound calls went through port2 --> PSTN2

Does the gateway verify the trunk by IP address, so any trunks from one IP will be same?


In general, all FXO gateways decide internally how to use the ports. Depending on the brand, the configuration varies according to how they manage port assignment. If you are sure that your outbound rules are correctly defined, I suggest you take a look on Digium’s documents to configure port assignment. For example, on Grandstream gateways, you assign the FXO ports to different TCP ports and configure the trunks for each port, like 5060, 5062 and so on. That way the gateway knows which FXO port to use depending on the TCP port that received the dial request. I guess your Digium gateway might have a similar way of doing it, either by TCP ports or by SIP accounts, but you need to check the manual to be sure.

You probably don’t need two trunks, but help us understand your setup a bit better.
When you say you have two extensions, are those SIP endpoints registering to FreePBX, or analog sets connecting to the gateway?

Those SIP endpoints register to Free-PBX. and Free-PBX will do outbound routes to gateway by extension.

If extension is 6XXX–> Trunk name: 6XXX -->Trunk: 6XXX in gateway --> port 1 (E1) --> PSTN1
If extension is 7XXX --> trunk name: 7XXX -->Trunk: 7XXX in gateway --> port 2 (E1) --> PSTN2

It seems digium gateway cannot identify the calls is called from which trunk, I monitored in freepbx log and saw that freePBX sent to gateway as [email protected] or [email protected]

Please help.


I don’t see that model on Digium’s website

1 Like

this is the model


That is not a PSTN gateway. That is a T1/E1 gateway.

@arielgrin, when did T1/E1’s stop being able to connect to the PublicServiceTelephoneNetwork?

Sorry, I meant it in the sense that is not an analog gateway. My bad for not specifying correctly.
Anyway, according to its manual, you should have an option called “Send Call Through” on menu “Call Routing rules” that should let you specify which port to use according to specified rules.

there was never a mention of analog in this thread, just E1,

A caveat, I know nothing about these devices, but If the device has two ip’s logically they have two trunks, if they had had two ports, I would assume one trunk and two extensions, if two ip’s then routing through that ip specific trunk is ineffective?

Maybe the rules are not correctly defined, I’m not sure that by only setting two different IPs is enough to direct calls through one port or another. In fact that gateway has four T1 ports.

Try this as a starting point

No guessing allowed, (it’s pointless).

@caoquocai . . . please
b) let us know more about what you did.

I created two trunks to two IP addresses of gateway. In gateway also showed two trunks connected from one IP address: (freepbxIP).

when calling, freePBX routes to gateway with string: [email protected] or [email protected] without any information about IP of gateway.

is that problem to make the gateway doesn’t know the calls to which trunk in gateway?

I tried to create one more freePBX with IP and configured like below, it worked.

freepbx1 ( --> trunk 6XXX in gateway --> PSTN1
freepbx2 ( --> trunk 7XXX in gateway --> PSTN2


Did you read all of


I already read this some times, but it not mentions about one free-PBX to gateway with two trunks.

You will have to be way more explicit as to how you did that, you might want to go to the Digium support site because that is where you bought it, I’m sure you will find other folks with the same hardware and likely useful solutions, here you will find . . . . well , not so many, so we can’t guess.