When we need to link our Freeswitch instance with the external server then we need to create a gateway between the servers, in our case, it’s Freeswitch and VOIP server. We have FusionPBX (UI for Freeswitch) to do any configuration. Using Fusionpbx we can create a gateway, here is the step-by-step approach to do so.
Login to FusionPBX by just typing the IP address of Freeswitch PBX instance, you will be routed to the FusionPBX login page. Use proper credentials to log in.
Once logged in, you will be routed to the dashboard page as shown below,
Create Gateway:
To configure Gateway, select accounts and click gateways. The below window will popup.
Click on the “+” icon to add a new gateway.
Provide any name for the gateway. Don’t provide any Username and Password when Register is set to False. Provide the proxy address, that should be in the format of <ipaddressofvoipserver: port;transport=tcp> and then select Internal as profile. Click Save.
Now we need to configure access controls, for this select Advanced => Access Controls.
Click on the “+” icon to add new access control and the Default option must be set to “allow”. Click Save.
After saving, click on the particular access control that you just created and then we should create a Node for that.
CIDR value must be the VOIP server address with the subnet mask.
Once Access Controls are configured, we should start the configured gateway. For this go to gateway page by clicking on Accounts=>Gateways. List of gateways will be shown, select recently configured gateway and click on “start” under action column. If it started successfully, then the Status of the selected gateway will change to “Running” as shown below.
Now to dial out any number to the VOIP server, we need to create rules i.e. an outbound route.
Outbound Routes:
For this, go to Dialplan and select Outbound routes, click on the “+” icon to add a new outbound route. Select configured Gateway and choose Dialplan expression according to needs and save.
Here in the below screenshot, we had to create an outbound rule like when customer dials “demo1234” It should use configured gateway “DemoServer” and must reach our VOIP server. For this we placed a regex ^demo(\d{4})$ in Dialplan expression, meaning this rule says allow any calls which start with a demo and followed by 4 digits to route calls to VOIP server via Gateway “DemoServer”.
Have a look over my post on StackOverflow, https://stackoverflow.com/questions/53318804/fusionpbx-creating-sip-trunk-or-gateway