FreePBX and Linksys SPA3102

Hi All,

I have been working with FreePBX in a basic form the last few years and recently decided I would experiment with getting FreePBX to talk to my PSTN Line. I have a SPA3102 and I have configured it as follows;

PEER DETAILS:
type=friend
secret=PASSWORD
user=pstn_fxo
qualify=yes
nat=never
incominglimit=1
host=ip_address
dtmfmode=tfc2833
disallow=all
canreinvite=no
allow=ulaw
port=5062
context-from=pstn

The trunk name is pstn_fxo the port 5062 is the port that the SPA3102 uses for the PSTN-Line.

I have then configured the proxy address on the SPA3102 with the IP of my server, user is set to pstn_fxo and the password the password I setup (I have checked this many times as I wonted to make sure it was correct)

I do not have fail2ban installed (had issues while testing some phones so removed it)

Below is the output from the CLI in debug mode

CLI Output

--- (10 headers 0 lines) ---
Really destroying SIP dialog 
'[email protected]:5160' Method: 
OPTIONS
Reliably Transmitting (no NAT) to 172.26.5.191:5062:
OPTIONS sip:172.26.5.191 SIP/2.0
Via: SIP/2.0/UDP 172.26.5.40:5160;branch=z9hG4bK5af6efb3
Max-Forwards: 70
From: "Unknown" <sip:[email protected]:5160>;tag=as7b4ba872
To: <sip:172.26.5.191>
Contact: <sip:[email protected]:5160>
Call-ID: [email protected]:5160
CSeq: 102 OPTIONS
User-Agent: FPBX-15.0.17.24(16.15.0)
Date: Fri, 28 May 2021 13:45:17 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, 
NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0

<--- SIP read from UDP:172.26.5.191:5062 --->
SIP/2.0 200 OK
To: <sip:172.26.5.191>;tag=59a071a49e64cf0di1
From: "Unknown" <sip:[email protected]:5160>;tag=as7b4ba872
Call-ID: [email protected]:5160
CSeq: 102 OPTIONS
Via: SIP/2.0/UDP 172.26.5.40:5160;branch=z9hG4bK5af6efb3
Server: Linksys/SPA3102-5.2.13(GW002)
Content-Length: 0
Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, REFER
Supported: x-sipura, replaces

<------------->
--- (10 headers 0 lines) ---
Really destroying SIP dialog 
'[email protected]:5160' Method: OPTIONS 

For some reasons the SPA and the FreePBX Server will never register with each other, I am sure I am missing something here. Has anyone else got this working with FreePBX and SPA3102? Any pointers are most welcome and keen to learn and understand what I have or haven’t done here.

You’ve set a static address for SPA, so Asterisk will not expect it to register. It would be unusual for Asterisk to have to register on the SPA, as its address should be even more static, but, in any case, you haven’t presented any evidence that you have configured Asterisk to try and register.

Asterisk did a, presumably successful qualify, although, as you screen scraped this, one cannot see the time stamps to tell whether the round trip time was acceptable.

There is no registration or call attempt in your log.

You are unlikely to need nat=never. nat= probably doesn’t do what you think it does, but that shouldn’t cause any harm.

canreinvite=no should be directmedia=no, but I think the obsolete name is still recognized.

This may be a case where type=friend is necessary, but if it is, you will not get caller IDs inbound, as you haven’t set trustrpid.

You should be able to attempt a call out through SPA, and v.v.

The SPA is not a SIP server, so Asterisk registering to it is not possible. Your two choices are SPA registers to Asterisk, or static configuration. In either case the Register String for the trunk should be blank.

For SPA registers to Asterisk:
PEER DETAILS:

type=friend
host=dynamic
secret=PASSWORD
username=pstn_fxo
qualify=yes
context=from-pstn

(note spelling of username and context parameters). The SPA Info page should show Registered.

If you want to use static configuration:

type=friend
host=ip_address
port=5062
secret=PASSWORD
username=pstn_fxo
qualify=yes
context=from-pstn

and in the SPA, set Register to no, Make Call Without Reg to yes, and Ans Call Without Reg to yes.

Hi Both,

Thank you for your quick and detailed replies.

@Stewart1 I will have a look at your suggested Configurations over the weekend, and post back if I have any more questions.

@Stewart1
I have attempted both configurations today and unfortunately I am not able to get ever of them work. If I setup as a Direct Connection to the SPA I am not able to make inbound or outbound calls.

Apologies I was going to upload screen shots but as a new user I am not allowed to upload more than one image. I will post these below (if possible).

Hopefully the file names make sense.

I am not sure of the location of logs that might be of use here so any information on which logs I should be look at would be appreciated.

Regards,

Asterisk configuration page for PEER Details no settings have been setup on the inbound tab.

Asterisk direct connection

SPA Configuration for Asterisk Direct Connect.

If there is any other settings I can provide that might help please let me know. I am going to continue to have a look today and see if I can figure out what is causing the issue.

Hi All,

I have have had some good progress in the last half and hour. I have managed to get the SPA to register to the Asterisk Server. The SPA now reports the PSTN Line as registered. But I have run into a new issue (again I think this is more my configuration than anything else).

Although I am now able to register the SPA I am not able to get an extension to ring when I call my landline number. Also if I try and make an outbound call I get a message that all lines are busy.

I have configured an inbound route to direct inbound calls to a test phone I know is working. I have also configured an outbound route for 11 numbers out.

Again I am going to keep testing but just wanted to make sure I kept this post updated as I went.

Check your SPA settings. Look at
https://attaiwi.com/2018/04/04/linksys-spa3102-with-freepbx-setup/
Many of the settings in that article don’t apply to your system. Only follow these sections:
Dial Plans
VoIP-To-PSTN Gateway Setup
PSTN-To-VoIP Gateway Setup
FXO Timer Values (sec)

If you still have trouble, paste the Asterisk log (not the CLI output, and with sip debug on) for a failing call at pastebin.freepbx.org and post the link here. If both incoming and outgoing are failing, paste a log for each.

Also, a screenshot of the PSTN Line section of the SPA settings (in advanced mode) would be useful.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.