Page tree
Skip to end of metadata
Go to start of metadata

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. 

  1. Go to the webui interface, and go to the extensions page, create a PJSIP extension.
  2. 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.
  3. 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.
  4. 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.

  1. 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)
     
  2. 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.
  3. After you do all this click on submit all changes to make sure the SPA3000 saves all the settings.
  4. It's time to setup the PSTN line settings in the SPA3000. Go to the PSTN LINE tab on the webui. (part B)
  5. 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.
  6. 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.
  7. Also note the setting, PSTN caller default DP, this should match the row of dialplans, in this case, 2.
  8. 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.
     
     
     
  9. 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.
  10. We are going to create a chan_sip because I could not get PJSIP trunk to work with FreePBX.
     
  11. 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.
  12. 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.
     
  13. Submit and reload FreePBX.
  14. It's time to create the inbound route and outbound route (part C)
  15. Go to inbound routes and add a new inbound route.and match the DID number to the number provided in the SPA3000 earlier.
     
  16. Set a destination (for example extension). Save and reload. -> Inbound calls should now work from PSTN.
  17. 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.

 

5 Comments

  1. Hi,

    After some hours "try and errors", I get work a SPA3102 as PJSIP Trunk.

    All necessary values to register the trunk in Freepbx will be found in the SPA3102 "PSTN Line" folder.

    As I do not have permissions to attach my screenshots, here the text version of my my PJSIP Trunk settings :

    General :

    Trunk Name = SPA3102 "User ID:" value

    = SPA3102 "Dial Plan 2:" DID value

    PJSIP Settings:

    General :

    Username : same as "Trunk Name" = SPA3102 "User ID:" value

    Secret : SPA3102 "Password:" value

    : "Outbound"

    : "Receive"

    Advanced

    Contact User : same as "Trunk Name" = SPA3102 "User ID:" value

    Codecs

    depends on your settings in the SPA3102 "Preferred Codec:", by default it will be ulaw (G711u)

     

    THAT's it !!!!

    Very very simple and it work :

     Endpoint:  PSTN                                                 Not in use    0 of inf
        OutAuth:  PSTN/PSTN
    Aor:  PSTN                                               1
          Contact:  PSTN/sip:PSTN@172.31.254.102:5061                Avail              14.179
      Transport:  0.0.0.0-udp               udp      0      0  0.0.0.0:5060

     

     

     

     

     

     

  2. Unfortunately this guide isn't working for me on FreePBX 13 with Asterisk 13. I've followed it to the letter, but when I try to call the PSTN line, my softphone doesn't ring (softphone works fine otherwise). Trunk will register and I've triple-checked everything and it should be working with my SPA3000, but not having any luck. Parts of this guide are a little ambiguous unfortunately. I'll probably create a thread about this - I get the following log entries in the Asterisk console:

    [2016-10-08 17:14:48] NOTICE[5578]: res_pjsip/pjsip_distributor.c:525 log_failed_request: Request 'INVITE' from '"pstn" <sip:XXXXXXXXXX@192.168.1.47>' failed for '192.168.1.25:5062' (callid: 29189091-56f96099@192.168.1.25) - No matching endpoint found
    [2016-10-08 17:14:48] NOTICE[5578]: res_pjsip/pjsip_distributor.c:525 log_failed_request: Request 'INVITE' from '"pstn" <sip:XXXXXXXXXX@192.168.1.47>' failed for '192.168.1.25:5062' (callid: 29189091-56f96099@192.168.1.25) - No matching endpoint found
    [2016-10-08 17:14:48] NOTICE[5578]: res_pjsip/pjsip_distributor.c:525 log_failed_request: Request 'INVITE' from '"pstn" <sip:XXXXXXXXXX@192.168.1.47>' failed for '192.168.1.25:5062' (callid: 29189091-56f96099@192.168.1.25) - Failed to authenticate
    [2016-10-08 17:14:48] NOTICE[5578]: res_pjsip/pjsip_distributor.c:525 log_failed_request: Request 'INVITE' from '"pstn" <sip:XXXXXXXXXX@192.168.1.47>' failed for '192.168.1.25:5062' (callid: 29189091-56f96099@192.168.1.25) - No matching endpoint found
    [2016-10-08 17:14:48] NOTICE[5578]: res_pjsip/pjsip_distributor.c:525 log_failed_request: Request 'INVITE' from '"pstn" <sip:XXXXXXXXXX@192.168.1.47>' failed for '192.168.1.25:5062' (callid: 29189091-56f96099@192.168.1.25) - Failed to authenticate

     

  3. I no longer use this setup, so I cannot test what's wrong, did you ever figure it out stephendt?

    And where is your thread? / cannot find it on google.

  4. Hey SupaYoshi,

    Thread is here: http://community.freepbx.org/t/linksys-spa3000-pstn-gateway-w-freepbx-13-inbound-not-ringing/37496 

    It remains unsolved. Not too sure what the problem is. Would an existing "catchall" inbound route for my existing SIP service be conflicting perhaps?

  5. Same problem here, I've added information to the above thread. The short answer is the pjsip trunk is not accepting calls from the sipura3000 device because the caller id information makes it unknown. Turning off caller id gets calls through, but I haven't figure out how to get them through with caller id.