Question about SPA-3102 as gateway

Dear friends, I have the following issue:
I’m using a SPA3102 as FXO gateway to my Freepbx.
Everything runs ok, i can make and receive calls but only without Caller Id function.
If under PSTN settings / PSTN-To-VoIP Gateway Setup / PSTN-To-VoIP Gateway Enable i set it to YES, when I call to my FXO I can hear Freepbx Busy tone. When I set it to NO, I can receive the calls but without caller ID. Could please someone help me with it?

Many thanks

That seems very strange. I thought that if PSTN-To-VoIP Gateway Enable is off, an incoming call on the POTS line would not be sent to the PBX at all, though it could still ring through to an analog phone connected to Line 1 if enabled.

Several users have reported problems using SPA3102 as a pjsip trunk, if the FXS side is also in use as an extension.

Please post details of your of your setup, including trunk settings and screenshots of the PSTN Line page. Also, post the Asterisk log for a failed call that results in the PBX playing a busy tone.

Many thanks for your reply. I’m sorry if my english is not good enouth… I will try to explain more cleary and detailed all my trials and it’s behaivour when running the system:

  1. Trial 01
    SPA3102 IP: 192.168.15.235 ( Gateway is 192.168.15.1)
    FREEPBX IP: 192.168.15.250 (Gateway is 192.168.15.1)
    They are all connected to a router whose ip is 192.168.15.1

SPA3102 Settings are:
PSTN LINE TAB

Line Enable: Yes
Nat Map Enable: No
Nat Keep Alive Enable: No

Sip Settings: UDP - PORT 5062

Proxy and Registration
Proxy: 192.168.15.250
Outbound Proxy: Blank
Use Outbound Proxy: No
Use OB Proxy in Dialog: No

Subscriber Information
Display Name: Blank
User ID: PSTN
Password: 123testing
Use Auth Id: No

Audio Configuration
Preferred Codec: G711u
Use Pref Codec only: No
DTMF Tx Method: INFO

Dial Plans
Dial Plan 1 (xx.)
Dial Plan 2 2(S0<:551633710110>)
Dial Plans 3 to 8 (xx.)

VoIP-To-PSTN Gateway Setup
VoIP-To-PSTN Gateway Enable: Yes
VoIP Caller Auth Method: None
VoIP PIN Max Retry:
One Stage Dialing: Yes
Line 1 VoIP Caller DP: 1
Line 1 Fallback DP: None

PSTN-To-VoIP Gateway Setup
PSTN-To-VoIP Gateway Enable: Yes
PSTN Caller Auth Method: None
PSTN Ring Thru Line 1: No
PSTN PIN Max Retry: 3
PSTN CID For VoIP CID: Yes
PSTN Caller Default DP: 2
Off Hook While Calling VoIP: no
Line 1 Signal Hook Flash To PSTN: Disabled

FXO Timer Values (sec)
VoIP Answer Delay: 0
VoIP PIN Digit Timeout: 5
PSTN Answer Delay: 2
PSTN PIN Digit Timeout: 5
PSTN-To-VoIP Call Max Dur: 0
PSTN Ring Thru Delay: 3
VoIP-To-PSTN Call Max Dur: 0
PSTN Ring Thru CWT Delay: 3
VoIP DLG Refresh Intvl: 0
PSTN Ring Timeout: 4
PSTN Dialing Delay: 1
PSTN Dial Digit Len: .1/.1
PSTN Hook Flash Len: .1

PSTN Disconnect Detection
Detect CPC: Yes Detect Polarity Reversal: Yes
Detect PSTN Long Silence: no
Detect VoIP Long Silence: no
PSTN Long Silence Duration: 30
VoIP Long Silence Duration: 30
PSTN Silence Threshold: medium
Min CPC Duration: 0.2
Detect Disconnect Tone: Yes
Disconnect Tone: [email protected];60(.1/.1/1) “that’s correct for according to phone company”

FXO Port Impedance: 600ohms - “That’s correct according to my phone company”

Here are my settings ate my Freepbx 192.168.15.250 #
TRUNKS
CHAN_SIP TRUNK
Trunk Name: PSTN_FXO
Outbound Caller ID: 551633710110
Maximum Channels: 1
Asterisk Trunk Dial Options: T
Continue If Busy: No
Disable Trunk: No

Dialed Number Manipulations Rules : X.

SIP Settings:
Outgoing
Trunk Name:PSTN
Peer Details:
username=PSTN
type=friend
secret=123test
qualify=yes
port=5062
nat=no
host=192.168.15.235
dtmfmode=inband
context=from-pstn
canreinvite=no

Incoming:
User Context: PSTN-IN
User Details:
username=PSTN
type=friend
secret=123test
qualify=yes
port=5062
nat=no
host=192.168.15.235
dtmfmode=inband
context=from-pstn
canreinvite=no

CONECTIVITY/INBOUND ROUTES:
Description:SPA3102_INBOUND
DID NUMBER: 551633710110
CALLER ID NUMBER: ANY
CID PRIORITY ROUTE: NO
ALERT INFO: NONE
RINGER VOLUME OVERIDE: NONE
SET DESTINATION: EXTENSIO 201 (This extension is working)

CONECTIVITY / OUTBOUND ROUTES
Name: PSTN
Route CID: 551633710110
Trunk Sequence for Matched Routes: PSTN_FXO
Dial Patterns: Prefix:0 Match Pattern: X.

This is The Behaviour:
SPA3102 Power, Internet and Phone Leds are on (Green)
SPA 3102 Line led is off

Dialing to my cell phone using any extension
1- dial 0+Mycellphone number
In this case, Immediatly The SPA3102’s led “Line” becomes flashing red and call is completed with
success. Both call parties can chat with no issues. - This is perfectly working I solved Showing my CLI Report - Everything looks to be ok here:

 -- SIP/PSTN-00000003 Internal Gosub(func-apply-sipheaders,s,1(3)) start
    -- Executing [[email protected]:1] NoOp("SIP/PSTN-00000003", "Applying                                                           SIP Headers to channel SIP/PSTN-00000003") in new stack
    -- Executing [[email protected]:2] Set("SIP/PSTN-00000003", "TECH=SIP"                                                          ) in new stack
    -- Executing [[email protected]:3] Set("SIP/PSTN-00000003", "SIPHEADER                                                          KEYS=") in new stack
    -- Executing [[email protected]:4] While("SIP/PSTN-00000003", "0") in                                                           new stack
    -- Jumping to priority 12
    -- Executing [[email protected]:13] Return("SIP/PSTN-00000003", "") in                                                           new stack
  == Spawn extension (from-pstn, 0981533000, 1) exited non-zero on 'SIP/PSTN-000                                                          00003'
    -- SIP/PSTN-00000003 Internal Gosub(func-apply-sipheaders,s,1(3)) complete G                                                          OSUB_RETVAL=
    -- Called SIP/PSTN/981533000
       > 0x7f065c0abb10 -- Strict RTP learning after remote address set to: 192.                                                          168.15.235:16470
    -- SIP/PSTN-00000003 answered PJSIP/202-00000003
       > 0x7f066c052af0 -- Strict RTP learning after remote address set to: 192.                                                          168.15.100:5004
    -- Channel SIP/PSTN-00000003 joined 'simple_bridge' basic-bridge <e29bb29a-3                                                          c59-4914-83e9-92bcf1e2d461>
    -- Channel PJSIP/202-00000003 joined 'simple_bridge' basic-bridge <e29bb29a-                                                          3c59-4914-83e9-92bcf1e2d461>
       > 0x7f065c0abb10 -- Strict RTP switching to RTP target address 192.168.15                                                          .235:16470 as source
       > 0x7f066c052af0 -- Strict RTP switching to RTP target address 192.168.15                                                          .100:5004 as source
       > 0x7f066c052af0 -- Strict RTP learning complete - Locking on source addr                                                          ess 192.168.15.100:5004
       > 0x7f065c0abb10 -- Strict RTP learning complete - Locking on source addr                                                          ess 192.168.15.235:16470
    -- Channel PJSIP/202-00000003 left 'simple_bridge' basic-bridge <e29bb29a-3c                                                          59-4914-83e9-92bcf1e2d461>
  == Spawn extension (macro-dialout-trunk, s, 26) exited non-zero on 'PJSIP/202-                                                          00000003' in macro 'dialout-trunk'
  == Spawn extension (from-internal, 0981533000, 7) exited non-zero on 'PJSIP/20                                                          2-00000003'
    -- Executing [[email protected]:1] Macro("PJSIP/202-00000003", "hangupcall") i                                                          n new stack
    -- Executing [[email protected]:1] GotoIf("PJSIP/202-00000003", "1?theend")                                                           in new stack
    -- Goto (macro-hangupcall,s,3)
    -- Channel SIP/PSTN-00000003 left 'simple_bridge' basic-bridge <e29bb29a-3c5                                                          9-4914-83e9-92bcf1e2d461>
    -- Executing [[email protected]:3] ExecIf("PJSIP/202-00000003", "0?Set(CDR(                                                          recordingfile)=)") in new stack
    -- Executing [[email protected]:4] NoOp("PJSIP/202-00000003", "SIP/PSTN-000                                                          00003 montior file= ") in new stack
    -- Executing [[email protected]:5] GotoIf("PJSIP/202-00000003", "1?skipagi"                                                          ) in new stack
    -- Goto (macro-hangupcall,s,7)
    -- Executing [[email protected]:7] Hangup("PJSIP/202-00000003", "") in new                                                           stack
  == Spawn extension (macro-hangupcall, s, 7) exited non-zero on 'PJSIP/202-0000                                                          0003' in macro 'hangupcall'
  == Spawn extension (from-internal, h, 1) exited non-zero on 'PJSIP/202-0000000  

Now, when I try to call to my PSTN Number from my cellphone:
Nothing Happens!
PSTN Line led does not blink in SPA3102

I Can see that CLI is not receiving any information from the SPA3102, so I solved to Debug SPA-3102 and the only Info i receive when I try to call my PSTN number is:

FXO:DTMF CID START a

So, my problem is when receiving a call thru FreePbx. I also tried to change SPA3102 Parameter PSTN Line Register - Yes instead of no and I also tried to add Display name: PSTN instead of left blank. It still did not work.

I will make another post here with my second trial using PJSIP instead of CHANSIP. (In this case i can make and receive calls but wihtout caller ID Info. If i setup SPA3102 to send PSTN caller id to Voip, My freepbx stops receiving the call). I will explain better in my next post.

Many thanks if someone can help me.

Please try the following settings for the trunk Outgoing Peer Details:

host=dynamic
username=PSTN
type=friend
secret=123test
qualify=yes
context=from-pstn

Make the Incoming User Details completely blank.
In the SPA, PSTN Line, set Register to yes.

I believe that if it registers ok and the PSTN line is idle, the LED should be on solid.

If you have trouble, please post a screenshot of the Info page (showing registration, line voltage and current, etc.) Also, what gets logged in syslog and debug from the SPA on an attempted incoming call, and what (if anything) appears in the Asterisk log.

Unfortunately now it doesn’t make and doesnt receive calls. PSTN Line is still off.
here are the sreenshots

STATUS_

OK, so the Registration now show Failed for the PSTN line, but Registered for Line 1. If you are using the default ports on the PBX (5060 for pjsip, 5160 for chan_sip), then change for the PSTN line:
Proxy: 192.168.15.250:5160

See if the Info page now shows the PSTN Line Status as Registered. If not, we need to fix that first; report whether anything appears in Reports->Asterisk Logfiles when the SPA attempts to register.

Possibly, the SPA got ‘banned’ as a result of previous registration failures. Try disabling the FreePBX firewall if it is on and checking for any banned IPs.

Still no success… I tried changing the IP of my SPA3102 to 192.168.15.249. Freepbx still at 192.168.15.250. I also turned off firewall and i changed the username and password at SPA3102 and Freepbx to user: line_pstn password: 123testing

This is the log produced by Asterisk:

[2020-03-01 15:39:24] NOTICE[10795] chan_sip.c: Peer 'PSTN' is now Reachable. (17ms / 2000ms)
[2020-03-01 15:40:18] NOTICE[9794] res_pjsip/pjsip_distributor.c: Request 'REGISTER' from '&lt;sip:[email protected]&gt;' failed for '192.168.15.249:5160' (callid: [email protected]) - No matching endpoint found
[2020-03-01 15:40:18] NOTICE[15363] res_pjsip/pjsip_distributor.c: Request 'REGISTER' from '&lt;sip:[email protected]&gt;' failed for '192.168.15.249:5160' (callid: [email protected]) - No matching endpoint found
[2020-03-01 15:40:18] NOTICE[15363] res_pjsip/pjsip_distributor.c: Request 'REGISTER' from '&lt;sip:[email protected]&gt;' failed for '192.168.15.249:5160' (callid: [email protected]) - Failed to authenticate
[2020-03-01 15:40:18] NOTICE[9794] res_pjsip/pjsip_distributor.c: Request 'REGISTER' from '&lt;sip:[email protected]&gt;' failed for '192.168.15.249:5160' (callid: [email protected]) - No matching endpoint found
[2020-03-01 15:40:18] NOTICE[9794] res_pjsip/pjsip_distributor.c: Request 'REGISTER' from '&lt;sip:[email protected]&gt;' failed for '192.168.15.249:5160' (callid: [email protected]) - Failed to authenticate

It looks like you’ve configured a chan_sip trunk, but the rejection notices are coming from the pjsip driver. Fix the registration port on the device.

That shouldn’t hurt anything (provided that it doesn’t conflict with something else on your network). However, that address should not appear anywhere in your FreePBX configuration, nor on the Line 1 or PSTN Line tabs of the SPA.

As @lgaetz noted, please confirm that the value of Proxy on the PSTN Line tab is
192.168.15.250:5160

If it still won’t register, post new screenshots of PSTN Line and Line 1 top sections (showing Proxy and Registration and Subscriber Information for each), and your trunk settings. At the Asterisk command prompt, type
sip set debug on
and
pjsip set logger on
restart the SPA so it attempts to register, paste the Asterisk log at https://pastebin.freepbx.org and post the link here.

Thank you all so much for helping… I still had no succes when trying to connect my Freepbx to SPA3102, so i Reseting router/Formating and installing Freepbx in PC / Factory reseting SPA3102 and Grandstream HT814. Starting from 0, my new config is defined as follows:
Router
IP:192.168.15.1 - Netmask 255.255.255.0
DHCP is on from IP 192.168.15.101 to 192.168.15.199

FreePbx
Static IP: 192.168.15.3 - Netmask 255.255.255.0
Gateway is: 192.168.15.1
PJSIP Extensions: 202 to 207

Grandstream HT814
Static IP: 192.168.15.4 - User: admin / Password: Admin
Netmask: 255.255.255.0
Extensions PJSIP Registered here: 202/203/204/205

SPA3102
Static IP: 192.168.15.5 - No user / No password
Netmask: 255.255.255.0
Registered PSIP Extension here: 207

After Installing FreePbx and setting up its IP/Username/ etc, I have set the “Intrusion Detection” White list as it could have all my devices SPA3102 and Grandstream HT814 free from problems:

After that I have setup all my extensions numbers on FreePbx and devices (Grandstream HT814 and SPA3102). Extensions got perfectly registered and are all working well.

Now, the PSTN trunk Setup:
I made different from the first time when I was setting up FreePbx ChanSip Trunk. Now, I setted up a PJSIP Trunk with the following Settings:





Outbound Routes



Inbound Route

SPA3102 PSTN TAB CONFIG

Please note that at the image above, i lefet the option PSTN CID For VoIP CID highlighted because when it is set to yes i cannot receive calls, and when it is off i can receive calls but without identifying the caller - i will explain with more details thereafter…
After Doing all this configurations, My SPA3102 has all its red leds on.


So here is SPA3102 INFO Page:

Behavior 01
When at SPA3102 / PSTN LINE / PSTN CID For VoIP CID: is setted to NO
From any Extension, I can dial 0+Number … Call is completed with Success.
Using My cellphone to call to my PSTN number, my extension group rings perfectly. I can Pickup the call parties are able to talk perfeclty. The only problem is that i can’t get Caller ID info. It shows SPA3102 username. CDRepport, shows Caller ID: " pstn_33710110" <pstn_33710110>
In this scenario that I can make and receive calls,
Here’s the log when receiving a call - I’m calling from 98153300 to PSTN plugged into SPA3102:

https://pastebin.freepbx.org/view/41143657

Now, the scenario 02:
When I setup my SPA3102 to send CALLER ID to VoiP:

PSTN_CID_YS

In this case, i can make calls, but Freepbx stops receving calls… As I can see in the log file, it looks that the caller id number assumes the SPA3102 user id so it’s trying so send [email protected] and FreePbx is not Understanding it, so here is the log when i try calling my PSTN from cellphone 981533000:

[2020-03-01 20:44:33] NOTICE[15450] res_pjsip/pjsip_distributor.c: Request 'INVITE' from '<sip:[email protected]>' failed for '192.168.15.5:5062' (callid: [email protected]) - No matching endpoint found
[2020-03-01 20:44:33] NOTICE[15450] res_pjsip/pjsip_distributor.c: Request 'INVITE' from '<sip:[email protected]>' failed for '192.168.15.5:5062' (callid: [email protected]) - No matching endpoint found
[2020-03-01 20:44:33] NOTICE[15450] res_pjsip/pjsip_distributor.c: Request 'INVITE' from '<sip:[email protected]>' failed for '192.168.15.5:5062' (callid: [email protected]) - Failed to authenticate
[2020-03-01 20:44:33] NOTICE[15450] res_pjsip/pjsip_distributor.c: Request 'INVITE' from '<sip:[email protected]>' failed for '192.168.15.5:5062' (callid: [email protected]) - No matching endpoint found
[2020-03-01 20:44:33] NOTICE[15450] res_pjsip/pjsip_distributor.c: Request 'INVITE' from '<sip:[email protected]>' failed for '192.168.15.5:5062' (callid: [email protected]) - Failed to authenticate

Any suggestion on how to solve it?
Many thanks again !

Have you tried the parameter insecure=invite

Here’s an attempt to get it working with a pjsip trunk:

Temporarily disable Line 1 on the SPA.
In the trunk settings, set Authentication to Both and Match Inbound Authentication to Auth Username.
In Asterisk SIP Settings, change Endpoint Identifier Order to ip, auth_username, username, anonymous, header.
Restart (not just reload) Asterisk. Restart the SPA and confirm that the PSTN port still registers.
Test the trunk. If you have trouble, try setting Match Inbound Authentication to IP or Default. If you still have trouble, post details.
Reenable Line 1 on the SPA. See whether the trunk still works and whether the extension is working.

Thank you again for trying to help me!
At this new trial, Phone Led got off. SPA3102 Info Page says “Failed”

I tried do call my cellphone… When dialing 0981533000, immediately phone led begins flashing red and call is completed.

So i tried to call my Freepbx from my Cellphone. After some seconds it phone led also begins flashing red but I recieve a message in english saying that number dialed is not in service.

Here’s the Log:
[2020-03-02 08:02:56] VERBOSE[9570] pbx_variables.c: Setting global variable 'SIPDOMAIN' to '192.168.15.3' [2020-03-02 08:02:56] VERBOSE[14031][C-00000003] pbx.c: Executing [[email protected]:1] NoOp("PJSIP/anonymous-00000003", "Received incoming SIP connection from unknown peer to 01633710110") in new stack [2020-03-02 08:02:56] VERBOSE[14031][C-00000003] pbx.c: Executing [[email protected]:2] Set("PJSIP/anonymous-00000003", "DID=01633710110") in new stack [2020-03-02 08:02:56] VERBOSE[14031][C-00000003] pbx.c: Executing [[email protected]:3] Goto("PJSIP/anonymous-00000003", "s,1") in new stack [2020-03-02 08:02:56] VERBOSE[14031][C-00000003] pbx_builtins.c: Goto (from-sip-external,s,1) [2020-03-02 08:02:56] VERBOSE[14031][C-00000003] pbx.c: Executing [[email protected]:1] GotoIf("PJSIP/anonymous-00000003", "1?setlanguage:checkanon") in new stack [2020-03-02 08:02:56] VERBOSE[14031][C-00000003] pbx_builtins.c: Goto (from-sip-external,s,2) [2020-03-02 08:02:56] VERBOSE[14031][C-00000003] pbx.c: Executing [[email protected]:2] Set("PJSIP/anonymous-00000003", "CHANNEL(language)=en") in new stack [2020-03-02 08:02:56] VERBOSE[14031][C-00000003] pbx.c: Executing [[email protected]:3] GotoIf("PJSIP/anonymous-00000003", "1?noanonymous") in new stack [2020-03-02 08:02:56] VERBOSE[14031][C-00000003] pbx_builtins.c: Goto (from-sip-external,s,5) [2020-03-02 08:02:56] VERBOSE[14031][C-00000003] pbx.c: Executing [[email protected]:5] Set("PJSIP/anonymous-00000003", "TIMEOUT(absolute)=15") in new stack [2020-03-02 08:02:56] VERBOSE[14031][C-00000003] func_timeout.c: Channel will hangup at 2020-03-02 08:03:11.618 -03. [2020-03-02 08:02:56] VERBOSE[14031][C-00000003] pbx.c: Executing [[email protected]:6] Set("PJSIP/anonymous-00000003", "receveip=pjsip,remote_addr") in new stack [2020-03-02 08:02:56] VERBOSE[14031][C-00000003] pbx.c: Executing [[email protected]:7] Log("PJSIP/anonymous-00000003", "WARNING,"Rejecting unknown SIP connection from 192.168.15.5:5062"") in new stack [2020-03-02 08:02:56] WARNING[14031][C-00000003] Ext. s: "Rejecting unknown SIP connection from 192.168.15.5:5062" [2020-03-02 08:02:56] VERBOSE[14031][C-00000003] pbx.c: Executing [[email protected]:8] Answer("PJSIP/anonymous-00000003", "") in new stack [2020-03-02 08:02:56] WARNING[14031][C-00000003] translate.c: No translator path: (starting codec is not valid) [2020-03-02 08:02:56] WARNING[14031][C-00000003] translate.c: No translator path: (starting codec is not valid) [2020-03-02 08:02:56] VERBOSE[14031][C-00000003] pbx.c: Executing [[email protected]:9] Wait("PJSIP/anonymous-00000003", "2") in new stack [2020-03-02 08:02:58] WARNING[14031][C-00000003] channel.c: Unable to find a codec translation path: (g723) -> (ulaw) [2020-03-02 08:02:58] ERROR[14031][C-00000003] channel.c: Could not return write format to its original state [2020-03-02 08:02:58] VERBOSE[14031][C-00000003] pbx.c: Executing [[email protected]:10] Playback("PJSIP/anonymous-00000003", "ss-noservice") in new stack [2020-03-02 08:02:58] VERBOSE[14031][C-00000003] file.c: <PJSIP/anonymous-00000003> Playing 'ss-noservice.ulaw' (language 'en')

From where you are now, if in Asterisk SIP Settings you set Allow Anonymous Inbound SIP Calls to Yes, your inbound call will likely work. IMO you should test that (in case it shows up other problems). Report the result.

However, that can be a security issue so you need to find out why the SPA can’t register. Reboot the SPA so it tries to register and post what the Asterisk log shows on the attempt.

Thank you very, very much!! Everything is working perfectly now!!! Have a nice week!

I’m just experiencing some audio issues now, when the calling party calls my FreePBX pstn line plugged into SPA3102, his voice is too low. He can hear me well but he has to speak louder. I suppose it is easy to adjust, only setting audio gains and turning off echo cancel.

Another thing that is happening sometimes, not often… if call from my cellphone to SPA3102, phone led begins flashing, my group of extensions begins ringing, caller Id shows the number, but when I try to answer the call from any extension, I can’t. When I take phone from the hook, this extension plays me a dial tone. The other extensions stops ringing. From my cell phone I still listen calling tone and spa3102 keeps flashing phone led. Sounds that Freepbx some times ignores the call.
When it happens again I will check the log file to see whats happening. Many thks again!
Do you know if Grandstream HT813 is better? Im asking because I have one here. If it sounds more reliable I can try to use it instead of 3102. Thanks

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