Configure SPA3000 as SIP Trunk | FreePBX 13 (PJSIP)
When someone tries to connect their FreePBX system to an analog PSTN line, an ATA can be used like the SPA3000, SPA3102, etc. This tutorial takes the SPA3000, aka SPA3K into focus and connects the SPA as an FXO port to the FreePBX system.
Step-by-step guide
Before we start our step-by-step guide, there are a few things to understand and make any needed troubleshooting easier later on. We are going to configure the SPA3000 with all the correct settings, and we are going to setup the FreePBX distro to match these settings.
This is done by:
A, creating an extension for the SPA3000 on the FreePBX system. (will be used for any incoming calls on the PSTN line, to be forwarded to the FreePBX system)
B, creating a trunk on the FreePBX system. (will be used for any outbound calls to the PSTN line.
C, creating the necessary outbound and inbound routes.
To start lets create an extension in FreePBX to be used for the SPA3000.
Go to the webui interface, and go to the extensions page, create a PJSIP extension.
You can pick any extension number for this, but we will need this in further steps for the SPA3000 settings, also note down the password.
It is not required to add an user for this account so don't add an user, unless you really feel like you do need it.
Now it's time to go to the SPA3000 webui. Of course, we don't have to explain how to get there in this howto.
The SPA3000 configuration.
Login as admin and go to advanced, you will see an page similar to this, one, to start let's go to Line 1. (part A)
At the line 2 page, check the following settings they are very important for this to work! A few notes about these settings:
- We are using PJSIP so the port is by default 5060 on FreePbx 13.
- Proxy should be the IP address of your FreePBX system. Register should be on yes, and make the rest of the settings match too.
- Subscriber information: The USER ID and password should match the extension that you created earlier during this tutorial.
- The preferred codec I use is g711a or g711u.After you do all this click on submit all changes to make sure the SPA3000 saves all the settings.
It's time to setup the PSTN line settings in the SPA3000. Go to the PSTN LINE tab on the webui. (part B)
It's very important to understand the following, you are going to make up an username and password during this step that is going to be the username and password to authenticate with the SPA for the trunk later on.
The User ID & Password are required for the trunk, note them down.Note that the dialplan should match the DID number you want to use for the inbound route, this can be anything easier is to use the PSTN number from your Telco.
Also note the setting, PSTN caller default DP, this should match the row of dialplans, in this case, 2.
The SIP port here should be the port that the trunk is going to register too (from FreePbX to SPa3000) so this should match later on.
Finishing the above setup it's time to setup a trunk in FreePBX. Submit all changes to the webui of the SPA3000 and return to FreePBX.
We are going to create a chan_sip because I could not get PJSIP trunk to work with FreePBX.
You can setup the CallerID hide yes or no, set the maximum channels to 1 here! So that you can't get any problems with that.
Time to setup the sip settings, they are: note that username should match the User ID from step 5, and password should match the password you provided the SPA3000 with.
Submit and reload FreePBX.
It's time to create the inbound route and outbound route (part C)
Go to inbound routes and add a new inbound route.and match the DID number to the number provided in the SPA3000 earlier.
Set a destination (for example extension). Save and reload. -> Inbound calls should now work from PSTN.
Setting up the outbound route, works like any other outbound route, you make a dialplan, select the trunk to be used for any calls matching it, and apply.