Trouble hooking up Spa 3000 / FreePBX / PSTN Line

Hello guys,

I have been trying for the past couple of weeks to hook up my SPA3000 / FreePBX 13.0.163 (using PJSIP) / PSTN line with no success. I hope i can find some light here :slight_smile:

1 - What are my goals:

a) Use asterisk to manage my calls ( IVR, Recordings etc)

b) Calls to my pstn number answered by softphones (computer and smartphones as extensions).

c) Make calls through my pstn line using softphones.

d) In case of disconected softphones, my analog phone should make and receive the calls.

2 - What I did:

a) I followed this tutorial (url wiki.freepbx.org/pages/viewpage.action?pageId=55476525 ), and after using the hints on the comment section with some try-and-error I’ve managed to make the SPA 3000 register both Line 1 and PSTN Line to my Asterisk.

check my spa3000 configuration screen prints here: ( url = dropbox.com/sh/3yjmeoex0ngega3/AABZbnkAubqf4tvQxvnnACBpa?dl=0 )

b) I setup a sip client in X-lite softphone using the credentials from Line 1 tab on the SPA (extension 30000 in this case)

My “pjsip show endpoints” return:

 Endpoint:  3000/3000                                            Not in use    0 of inf
     InAuth:  3000-auth/3000
        Aor:  3000                                               1
      Contact:  3000/sip:[email protected]:5060            c29baf5087 Avail        16.528
   Identify:  3000-identify/3000

 Endpoint:  dpma_endpoint                                        Unknown       0 of inf

 Endpoint:  fixo                                                 Not in use    0 of inf
    OutAuth:  fixo/fixo
        Aor:  fixo                                               1
      Contact:  fixo/sip:[email protected]:5062            dc5366f12a Avail        29.227
  Transport:  0.0.0.0-udp               udp      0      0  0.0.0.0:5060

3 - What is the problem:

a) When I call the pstn line, say from my cellphone line, I can hear the ringing tone on the cell, but the analog phone conected to the SPA 3000 never rings, neither does the extension I setup in x-lite (item 2 b) .

Here´s the log when I call and the X-lite is logged on extension 3000:

[2016-07-20 12:35:12] NOTICE[7642]: res_pjsip/pjsip_distributor.c:368 log_unidentified_request: Request from '"fixo" <sip:[email protected]>' failed for '192.168.0.14:5062' (callid: [email protected]) - No matching endpoint found

And here’s the log when i call my pstn and the Extension 3000 is not conected to any sip client:

  -- Executing [8420101396@from-pstn:1] Set("PJSIP/fixo-00000000", "__DIRECTION=INBOUND") in new stack
    -- Executing [8420101396@from-pstn:2] Gosub("PJSIP/fixo-00000000", "sub-record-check,s,1(in,8420101396,force)") in new stack
    -- Executing [s@sub-record-check:1] GotoIf("PJSIP/fixo-00000000", "0?initialized") in new stack
    -- Executing [s@sub-record-check:2] Set("PJSIP/fixo-00000000", "__REC_STATUS=INITIALIZED") in new stack
    -- Executing [s@sub-record-check:3] Set("PJSIP/fixo-00000000", "NOW=1469028775") in new stack
    -- Executing [s@sub-record-check:4] Set("PJSIP/fixo-00000000", "__DAY=20") in new stack
    -- Executing [s@sub-record-check:5] Set("PJSIP/fixo-00000000", "__MONTH=07") in new stack
    -- Executing [s@sub-record-check:6] Set("PJSIP/fixo-00000000", "__YEAR=2016") in new stack
    -- Executing [s@sub-record-check:7] Set("PJSIP/fixo-00000000", "__TIMESTR=20160720-123255") in new stack
    -- Executing [s@sub-record-check:8] Set("PJSIP/fixo-00000000", "__FROMEXTEN=unknown") in new stack
    -- Executing [s@sub-record-check:9] Set("PJSIP/fixo-00000000", "__MON_FMT=wav") in new stack
    -- Executing [s@sub-record-check:10] NoOp("PJSIP/fixo-00000000", "Recordings initialized") in new stack
    -- Executing [s@sub-record-check:11] ExecIf("PJSIP/fixo-00000000", "0?Set(ARG3=dontcare)") in new stack
    -- Executing [s@sub-record-check:12] Set("PJSIP/fixo-00000000", "REC_POLICY_MODE_SAVE=") in new stack
    -- Executing [s@sub-record-check:13] ExecIf("PJSIP/fixo-00000000", "0?Set(REC_STATUS=NO)") in new stack
    -- Executing [s@sub-record-check:14] GotoIf("PJSIP/fixo-00000000", "2?checkaction") in new stack
    -- Goto (sub-record-check,s,17)
    -- Executing [s@sub-record-check:17] GotoIf("PJSIP/fixo-00000000", "1?sub-record-check,in,1") in new stack
    -- Goto (sub-record-check,in,1)
    -- Executing [in@sub-record-check:1] NoOp("PJSIP/fixo-00000000", "Inbound Recording Check to 8420101396") in new stack
    -- Executing [in@sub-record-check:2] Set("PJSIP/fixo-00000000", "FROMEXTEN=unknown") in new stack
    -- Executing [in@sub-record-check:3] ExecIf("PJSIP/fixo-00000000", "4?Set(FROMEXTEN=fixo)") in new stack
    -- Executing [in@sub-record-check:4] Gosub("PJSIP/fixo-00000000", "recordcheck,1(force,in,8420101396)") in new stack
    -- Executing [recordcheck@sub-record-check:1] NoOp("PJSIP/fixo-00000000", "Starting recording check against force") in new stack
    -- Executing [recordcheck@sub-record-check:2] Goto("PJSIP/fixo-00000000", "force") in new stack
    -- Goto (sub-record-check,recordcheck,5)
    -- Executing [recordcheck@sub-record-check:5] Set("PJSIP/fixo-00000000", "__REC_POLICY_MODE=FORCE") in new stack
    -- Executing [recordcheck@sub-record-check:6] GotoIf("PJSIP/fixo-00000000", "1?startrec") in new stack
    -- Goto (sub-record-check,recordcheck,16)
    -- Executing [recordcheck@sub-record-check:16] NoOp("PJSIP/fixo-00000000", "Starting recording: in, 8420101396") in new stack
    -- Executing [recordcheck@sub-record-check:17] Set("PJSIP/fixo-00000000", "AUDIOHOOK_INHERIT(MixMonitor)=yes") in new stack
[2016-07-20 12:32:55] NOTICE[7651][C-00000000]: func_audiohookinherit.c:64 func_inheritance_write: AUDIOHOOK_INHERIT is deprecated and now does nothing.
    -- Executing [recordcheck@sub-record-check:18] Set("PJSIP/fixo-00000000", "__CALLFILENAME=in-8420101396-fixo-20160720-123255-1469028775.0") in new stack
    -- Executing [recordcheck@sub-record-check:19] MixMonitor("PJSIP/fixo-00000000", "2016/07/20/in-8420101396-fixo-20160720-123255-1469028775.0.wav,ai(LOCAL_MIXMON_ID),") in new stack
    -- Executing [recordcheck@sub-record-check:20] Set("PJSIP/fixo-00000000", "__MIXMON_ID=0xb4d0a7f0") in new stack
  == Begin MixMonitor Recording PJSIP/fixo-00000000
    -- Executing [recordcheck@sub-record-check:21] Set("PJSIP/fixo-00000000", "__RECORD_ID=PJSIP/fixo-00000000") in new stack
    -- Executing [recordcheck@sub-record-check:22] Set("PJSIP/fixo-00000000", "__REC_STATUS=RECORDING") in new stack
    -- Executing [recordcheck@sub-record-check:23] Set("PJSIP/fixo-00000000", "CDR(recordingfile)=in-8420101396-fixo-20160720-123255-1469028775.0.wav") in new stack
    -- Executing [recordcheck@sub-record-check:24] Return("PJSIP/fixo-00000000", "") in new stack
    -- Executing [in@sub-record-check:5] Return("PJSIP/fixo-00000000", "") in new stack
    -- Executing [8420101396@from-pstn:3] Gosub("PJSIP/fixo-00000000", "app-blacklist-check,s,1()") in new stack
    -- Executing [s@app-blacklist-check:1] GotoIf("PJSIP/fixo-00000000", "0?blacklisted") in new stack
    -- Executing [s@app-blacklist-check:2] Set("PJSIP/fixo-00000000", "CALLED_BLACKLIST=1") in new stack
    -- Executing [s@app-blacklist-check:3] Return("PJSIP/fixo-00000000", "") in new stack
    -- Executing [8420101396@from-pstn:4] Set("PJSIP/fixo-00000000", "__FROM_DID=8420101396") in new stack
    -- Executing [8420101396@from-pstn:5] Set("PJSIP/fixo-00000000", "CDR(did)=8420101396") in new stack
    -- Executing [8420101396@from-pstn:6] ExecIf("PJSIP/fixo-00000000", "0 ?Set(CALLERID(name)=fixo)") in new stack
    -- Executing [8420101396@from-pstn:7] Set("PJSIP/fixo-00000000", "__MOHCLASS=") in new stack
    -- Executing [8420101396@from-pstn:8] Set("PJSIP/fixo-00000000", "__REVERSAL_REJECT=FALSE") in new stack
    -- Executing [8420101396@from-pstn:9] GotoIf("PJSIP/fixo-00000000", "1?post-reverse-charge") in new stack
    -- Goto (from-pstn,8420101396,11)
    -- Executing [8420101396@from-pstn:11] NoOp("PJSIP/fixo-00000000", "") in new stack
    -- Executing [8420101396@from-pstn:12] Set("PJSIP/fixo-00000000", "__CALLINGNAMEPRES_SV=allowed_not_screened") in new stack
    -- Executing [8420101396@from-pstn:13] Set("PJSIP/fixo-00000000", "__CALLINGNUMPRES_SV=allowed_not_screened") in new stack
    -- Executing [8420101396@from-pstn:14] Set("PJSIP/fixo-00000000", "CALLERID(name-pres)=allowed_not_screened") in new stack
    -- Executing [8420101396@from-pstn:15] Set("PJSIP/fixo-00000000", "CALLERID(num-pres)=allowed_not_screened") in new stack
    -- Executing [8420101396@from-pstn:16] NoOp("PJSIP/fixo-00000000", "CallerID Entry Point") in new stack
    -- Executing [8420101396@from-pstn:17] Goto("PJSIP/fixo-00000000", "from-did-direct,3005,1") in new stack
    -- Goto (from-did-direct,3005,1)
[2016-07-20 12:32:55] WARNING[7651][C-00000000]: pbx.c:4365 __ast_pbx_run: Channel 'PJSIP/fixo-00000000' sent to invalid extension but no invalid handler: context,exten,priority=from-did-direct,3005,1
    -- Executing [h@from-did-direct:1] Macro("PJSIP/fixo-00000000", "hangupcall,") in new stack
    -- Executing [s@macro-hangupcall:1] GotoIf("PJSIP/fixo-00000000", "1?theend") in new stack
    -- Goto (macro-hangupcall,s,3)
    -- Executing [s@macro-hangupcall:3] ExecIf("PJSIP/fixo-00000000", "0?Set(CDR(recordingfile)=)") in new stack
    -- Executing [s@macro-hangupcall:4] Hangup("PJSIP/fixo-00000000", "") in new stack
  == Spawn extension (macro-hangupcall, s, 4) exited non-zero on 'PJSIP/fixo-00000000' in macro 'hangupcall'
  == Spawn extension (from-did-direct, h, 1) exited non-zero on 'PJSIP/fixo-00000000'
  == MixMonitor close filestream (mixed)
  == End MixMonitor Recording PJSIP/fixo-00000000

Could anyone help me?

looks like your inbound route points to a non-existent extension

Thank you bksales, indeed it was. I it must have happened during the numerous creation and deletions of extension and routes.

I pointed the inbound to extension 3000. And the problem persists. I get the same output I pasted on item 3-a above:

[2016-07-20 18:24:12] NOTICE[21029]: res_pjsip/pjsip_distributor.c:368 log_unidentified_request: Request from '"fixo" <sip:[email protected]>' failed for '192.168.0.14:5062' (callid: c4927b57-f98101[email protected]) - No matching endpoint found
localhost*CLI>

Still neither my analog phone or any sip client rings when i call.

Thank you

what does the trunk definition look like

what does the trunk definition look like

Thanks again bksales,

I am more of a curious “do it yourself” guy than an expert in this subject, so I don’t know exactly what you mean by trunk definition, that’s why I am pasting most of my pjsip conf files. I hope it’s not too much information.

pjsip.transports.conf

[0.0.0.0-udp]
type=transport
protocol=udp
bind=0.0.0.0:5060
external_media_address=179.190.193.26
external_signaling_address=179.190.193.26
allow_reload=yes
local_net=192.168.0.0/24

pjsip.aor.conf
include pjsip.aor_custom.conf

[3000]
type=aor
max_contacts=1
remove_existing=yes
maximum_expiration=7200
minimum_expiration=60
qualify_frequency=60

[fixo]
type=aor
qualify_frequency=60
max_contacts=1

pjsip.auth.conf

[3000-auth]
type=auth
auth_type=userpass
password=*********
username=3000

[fixo]
type=auth
auth_type=userpass
password=*********
username=fixo

pjsip.endpoint.conf

[3000]
type=endpoint
aors=3000
auth=3000-auth
allow=ulaw,alaw,gsm,g726
context=from-internal
callerid=device <3000>
dtmf_mode=rfc4733
aggregate_mwi=yes
use_avpf=no
ice_support=no
media_use_received_transport=no
trust_id_inbound=yes
media_encryption=no
timers=yes
media_encryption_optimistic=no
send_pai=yes
rtp_symmetric=yes
rewrite_contact=yes
force_rport=yes
language=en

[fixo]
type=endpoint
transport=0.0.0.0-udp
context=from-pstn
disallow=all
allow=ulaw,alaw,gsm,g726
aors=fixo
outbound_auth=fixo
t38_udptl=no
t38_udptl_ec=none
fax_detect=no
t38_udptl_nat=no
dtmf_mode=auto

[dpma_endpoint]
type=endpoint
context=dpma-invalid

pjsip.registration.conf
It’s empty

pjsip.identify.conf
pjsip.identify_custom.conf

[3000-identify]
type=identify
endpoint=3000

a trunk is used to accept input or to send output. your spa needs a trunk, an inbound route and and outbound route.

in the FreePBX gui, go to connectivity and then trunks - do you have any defined? if not you need to create at one - in laymans terms, this is the connection between your pbx and the spa.
also under connectivity, you need to have both an inbound route and and outbound route. again in simple terms, the trunk passings incming calls to the inbound route which in turn sends the call to where you want it (extensions, ivr, queue, etc). the outbound route is how calls from your pbx are routed. you define things like dial patterns or the dialing sequences that will trigger the route to do something. outbound router also defines what trunk the call should be sent.

so in summary, you need a trunk, an inbound route and an outbound route and at least one extension to route inbound calls to.

Bksales,

I do have a pjsip trunk setup.

I thought the conf files I pasted contained the info about the trunk.

In fact, the tutorial I followed here ( url: wiki.freepbx.org/pages/viewpage.action?pageId=55476525 ) is about creating a pjsip trunk.

I thought the endopoint “fixo” shown below was referring to my trunk. Am I wrong?

Endpoint: 3000/3000 Not in use 0 of inf
InAuth: 3000-auth/3000
Aor: 3000 1
Contact: 3000/sip:[email protected]:5060 c29baf5087 Avail 16.528
Identify: 3000-identify/3000

Endpoint: dpma_endpoint Unknown 0 of inf

Endpoint: fixo Not in use 0 of inf
OutAuth: fixo/fixo
Aor: fixo 1
Contact: fixo/sip:[email protected]:5062 dc5366f12a Avail 29.227
Transport: 0.0.0.0-udp udp 0 0 0.0.0.0:5060

I created an Extension ( 3000 ) and a Trunk ( Fixo) for the spa. Isn’t that what my pjsip show endpoints show?

what happens when you make an inbound call? you said you fixed the inbound route issue so the traces should now show what is happening.

bksales, thank you a lot for your responses. I couldn’t make it work with pjsip / Asterisk 13. I could make it work downgrading back to Asterisk 11 and using Chan Sip. Don’t know why thou.

thank you anyway,

David

You could have probably gotten it work using Chan-SIP on the “alternate” port that you would configure for running both Chan-SIP and PJ-SIP under Asterisk 13.

On the other hand, now that you have it working, let’s not upset anything for a while.

If you decide you want to make another run at this, go pick up the cheapest, crappiest, barely working-est piece of PC junk you can find and install the Asterisk 13 distro. It’s only for experimentation, so if it only supports one phone, you’re golden. That way, you can fuss with the various parts and settings and get it working in your new “state of the art testbed.”