Redirect all inbound calls to trunk


I am new in FreePBX, and i would like to ask one question.
I have installed FreePBX Distro and Digium TDM410 with 4 FXO ports.
Because in my country the operators are not gave you SIP trunks, i have 3 PSTN lines attached to my system. I have configure different scenarios, but i need to know is there possibility to redirect all incoming calls to SIP trunk that goes to another country. With this scenario we will have PSTN to VoIP gateway.
Can you please explain to me if this scenario is possible and how can i configure this in FreePBX.

Thank You very much.
Best Regards

Are you suggesting a SIP to another server in another country to breakout to external calls? If so you could use a VPN connection between the server so “disguise” the VoIP traffic.

Hi leemason,

Thank you for your reply.
No, i don’t need VPN, the scenario is simple how to forward all incoming calls that are coming on Digium TDM410 card (or on 3 PSTN lines) to any SIP trunk.
This trunk for example may be on another PBX in the same local network, it doesn’t matter, because i don’t know how to redirect the calls from Zap channel g0 to SIP trunk.

Thank You

You can do this.

You will need to give each analogue trunk a DID, say 9001 9002 9003 and 9004 and build an incoming route with DID _900[1234] and direct the inbound route to the SIP trunk.

In the oposite direction make the SIP trunk context from-internal and build an outbound route that directs to the analogue trunks. Setup the dial patterns to match the digits that will come in on the SIP trunk and modify them if necessary to comply with your Telcos dial plan.

Hi stonet,

Thank you very much for your answer, it helps a lot.

Best Regards


I also tried to configure all 4 FXO ports like different Zap trunk.
I set Zap/g1, Zap/g2, Zap/g3 and Zap/g4, i have deleted the Zap/g0, but i can’t redirect the calls only through Zap/g1 for example. I have setup dial patterns 07X. go through Zap/g1, and XXX. go to Zap/g2.
What i’m missing?
Thank You

It’s not g1 g2 etc, the g stands for group. Just use the integer channel number shown in ‘dahdi show channels’ from CLI.

Thank you SkykingOH
I will try this and get back to you.

Best Regards

Hi SkykingOH,

Thank You again, it works now.