Elastix as a PSTN Card Gateway

On this topic

Elastix as a PSTN Card Gateway

Introduction

Step 1: Connect Elastix to 3CX

Step 2: Connect 3CX to Elastix

Step 3: Inbound Calling (from PSTN via Elastix to 3CX)

Step 4: Outbound Calling (from 3CX via Elastix to PSTN)

Introduction

This document will take you through the steps required in order to convert your Elastix system, with a Digium compatible voice card (Digium, Sangoma, OpenVox), into a VoIP Gateway that can be used with 3CX. By doing so, you can re-use your PSTN interface cards until you have fully converted to a SIP trunk.

In this example, it is implied that the card was already configured in your Elastix PBX.

If you have any remarks, additions, improvements or questions regarding this setup, support is available via the Elastix & 3CX Community Forums at https://www.elastix.org/community/ or https://www.3cx.com/community/

This configuration assumes that both systems are within the same LAN.

Step 1: Connect Elastix to 3CX

To begin with, add a SIP trunk on Elastix from which calls to and from 3CX can be made. In your Elastix web interface navigate to PBX - PBX Configuration - Trunks - Add SIP Trunk”.

Specify the following settings:

  • General Settings

  • Trunk Name : 3CXTrunk
  • Outgoing Settings

  • Trunk Name :         3CXTrunk
  • PEER Details:         host=[3CX IP address]

port=[3CX SIP Port]

type=peer

  • Incoming Settings
  • USER Context: Trunk to 3CX
  • USER Details:         host=[3CX IP address/FQDN]

port=[3CX SIP Port]

type=peer

context=from-trunk

Step 2: Connect 3CX to Elastix

Now add a SIP Trunk” on 3CX from which calls to and from Elastix will be made. In your 3CX web interface navigate to SIP Trunks - + Add SIP Trunk”.

And select the following template:

For the Main Trunk No” enter the most important number from all the numbers which are connected to your PSTN card within Elastix. Lastly, enter the internal LAN IP of the Elastix install and save the configuration with OK.

Step 3: Inbound Calling (from PSTN via Elastix to 3CX)

In order to redirect incoming calls from the PSTN card in elastix to 3CX, an inbound route must be created and redirected to the 3CX SIP trunk. This step must be repeated for each DID which should be sent to 3CX or alternatively create a mask of a DID range. In case you are using analog gateways, in which there is no called number, first you must ensure that each physical port of the PSTN card has a DID mapped. For more information follow this guide.

Create Inbound Routes” which will accept calls and pass them to the 3CX SIP trunk. Click on PBX - PBX Configuration - Inbound Routes - Add Incoming Route”. 

Set a meaningful Description” and DID Number” field. The above example will apply to all number which are in the format of 813579169[1-9] where [1-9] are the DIDs of your PSTN line. Last, choose in Set Destination” the option Trunks” and select the SIP trunk pointing to 3CX - created in Step 1.

Submit Changes” and Apply Config”.

By default all calls will be routed to the set default config of the 3CX trunk. If you need to configure additional routing targets, add DIDs in 3CX. More information on how to accomplish this can be found here: https://www.3cx.com/docs/manual/inbound-rules/

Step 4: Outbound Calling (from 3CX via Elastix to PSTN)

In order to perform outgoing calls from 3CX via Elastix to the PSTN card, an Outbound Rule” must be created in 3CX to pass the calls to the Elastix PBX. Therefore, in 3CX configure Outbound Rules - + Add”.

Enter a Rule Name” and define when this rule should be triggered. The most general rule is Calls to number starting with prefix” and define 0-9,+”.

On Elastix we now need to identify outbound call requests. This is done in the same string used before in the DID Number” but now entered in the CallerID Number”. Click on PBX - PBX Configuration - Inbound Routes - Add Route” with the following configuration:

Submit Changes” and Apply Config”.

Note: In order for this to work ensure that 3CX sends a matching CallerID to the Elastix PBXUsi. The DID can be defined in the 3CX SIP trunk itself (SIP Trunk - Elastix - Caller ID - Default caller ID”) or in the extension itself ( Extension - Select Extension - General - Outbound Caller ID”).