Linksys SPA3000 PSTN Gateway w/ FreePBX 13 Inbound Not Ringing

(Stephendt) #1

Hey guys, been tearing my hair out over this one. I originally gave this a go a couple of months ago with no success, so I decided to swap over my ATA today and give it another go. I originally tried with an SPA3102, and am now trying with an SPA3000 and am getting the same results, so I’m thinking it’s more to do with the asterisk configuration more than anything.

I currently have a PSTN line that cannot get ported to a SIP provider for various reasons and still receives a number of inbound calls. It’s never used for outbound calls so I don’t have an inbound route (we use the new SIP phones for that), but I’d like these calls to ring on our various IP phones.

I’ve followed this guide to the letter: I’d post screenshots but it’d be a waste of time, I literally have the same configuration - I’ve triple checked. I get the feeling this guide is incomplete or out of date, because it just isn’t working on my FreePBX server.

Essentially what is happening is when I dial my PSTN number, my desired softphone doesn’t ring.

I had a quick look at the asterisk console output when I try to dial in and I’m getting this:

[2016-10-08 17:14:48] NOTICE[5578]: res_pjsip/pjsip_distributor.c:525 log_failed_request: Request 'INVITE' from '"pstn" <sip:XXXXXXXXXX@>' failed for '' (callid: 29189091-56f96099@ - 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@>' failed for '' (callid: 29189091-56f96099@ - 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@>' failed for '' (callid: 29189091-56f96099@ - 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@>' failed for '' (callid: 29189091-56f96099@ - 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@>' failed for '' (callid: 29189091-56f96099@ - Failed to authenticate

XXXXXXXX = my mobile, = FreePBX13, = my ATA.

It’s almost as if the inbound route has no idea where to send it - even though I’ve specifically told it to route to a particular extension. The extension works fine otherwise. The destination extension is using pjsip whilst the trunk is using chan_sip, but I don’t think this would be a problem.

If anyone could give me some clues that would be really appreciated.

(Karl Hakimian) #2

I’ve followed the same guide with the same versions with the same results. However, I might have an additional bit of information that can shed some light on the issue.

When I call my own phone number, my local phone company calls me back with a message about calling party/called party (vestiges of the party line days). When that call comes in, the sipura-3000 forwards it to freepbx and it is properly sent to the configured extension.

What this tells me is the information being sent from the sipura-3000 is not in a format that is working for freepbx. It only matches when the calls caller id is coming from my own number. Maybe this bit of information will help someone with some knowledge about the sipura-3000 and/or freepbx (I’m quite new to both) solve the issue.

(Karl Hakimian) #3

After doing a bit of reading, I thought the problem might be my dial plan. The guide suggests


Reading the docs on dialplans, I thought (S0< x.:YourDID>) might be what was really wanted. This should replace any incoming number with my did and allow freepbx to pick up. What actually happened is my sipura-3000 picked up the call gave a busy single and the became unresponsive over the net for a bit. Freepbx never saw a thing.

Changing it back did make the sipura-3000 responsive again, so while I think I might be on the right track, I’m certainly not doing it correctly.


One suggestion is to use chan_sip not chan_pjsip, i.e. use 5061 not 5060 on the ATA, I’ve been using them for years and no problem with that recipe and chan_sip

(Karl Hakimian) #5

I actually started with chan_sip and could not make it work. Things are looking much better with the pjsip. (I’m willing to believe the chan_sip issue was just me).

As far as getting this setup to work goes, if I turn off sending the caller id from the PSTN then all calls go through as expected. Unfortunately, this means they don’t have caller id.

It does seem something is not right in how the sipura3000 is sending the call when caller id is on. I’[m going to try to downgrade to an earlier firmware version and see if it does the same things.

The downgrade to 3.1.18 did not fix anything.

To recap, the issue seems to be that calls come into CID@server and only DID@server or username@server are understood and accepted. I need to ether get the server to accept *@server or get the supura3000 to send one of the accepted versions but still do caller id.


karl how do you do this in the spa3000?

(Karl Hakimian) #7

On the PSTN line page, it is the “PSTN CID For VoIP CID” optoin

(Karl Hakimian) #8

dicko, any chance you can provide more details on the chan_sip setup? I’ve been trying to get the sipura3000 to register the trunk via chan_sip for many hours. I’ve followed any guide I can and no matter what I do, I get errors from pjsip telling me it can’t find the endpoint. That is true using ports 5060, 5061, 5062 and 5160. When I change the port, I change it in the sip settings on freepbx and on the pstn line page on the sipura3000. Whatever port I set, I get the message that PJSIP can’t register the device on that port.

(Karl Hakimian) #9

OK. With help from #freepbx, I have this working. The main issue I had with chan_sip is the firewall. I forgot about it having a firewall, so I never checked, but apparently the builtin firewall blocks port 5160. Since that is the default port for chan_sip, this seems like an oops, but oh well.

Since my switch is behind my normal firewall, turning off the one in freepbx should not be an issue and it did solve the problem.

(Dave Burgess) #10

Configuring the integrated firewall to work correctly would also not hurt you.

(Lorne Gaetz) #11

Deny by default is good practice for Firewall. Since you didn’t configure it properly for your needs, presumably others will omit this step as well, which is exactly why it is not good practice to allow by default.

(Karl Hakimian) #12

I’ve been looking at fixing the firewall, but it looks like I will have to turn it on the configure it. I’ll have to wait until tonight to do that.

It might also be that the bad registrations caused fail2ban to ban my spa. I can’t seem to find out how to check or to unban if that is the case.

Anyway, I agree, configuring the firewall properly would be good. Right now, it will have to wait.

(Stephendt) #13

I’m confused. How does the firewall interfere with this? It’s already on the local network, so it should be good to go… besides, someone mentioned that disabling Caller ID makes it work, so I’m a little confused how these are linked.

(Karl Hakimian) #14

Once I dove in to figure out what was going on, I realized that this was (yet another) self inflicted wound. I have several networks at home and moved my phone switch from one to another one that I thought was more appropriate for it. In the move, having forgotten about the firewall, I did not update the trusted networks. The sipura was installed on the network that I moved the phone switch to so it was not yet trusted.

I’ve added that network in and turned the firewall on. Everything is working as it should be.

The reason pjsip worked and chan_sip did not was the default firewall rules allow pjsip from anywhere, but not chan_sip.

(Stephendt) #15

Alright, so I’d like to have another go this weekend. To recap, all I need to do is configure it as a pj_sip trunk and it should just work? I don’t see any specific instructions on using pj_sip for this but I suppose I could give it a go.

(Karl Hakimian) #16

The final configuration I used was chan_sip for everything. The reason for this is pjsip is missing some functionality that did not allow incoming calls to work the way I needed them to. The trick to using chan_sip (and something I did not find documented anywhere) is to specify the proxy using the format

ip:port. For my setup that ended up being The port field on the device is for it to listen on. I set line 1 to 5060 and pstn to 5062.

(Stephendt) #17

Hey guys,

Another update. Still struggling with this. I’ve tried switching things over to PJ_SIP (with caller ID disabled) and that didn’t help. Trunk registers, but now I get zero activity in the log when I call my landline number, but this log does pop up after a while:

Connected to Asterisk 13.10.0 currently running on FreePBX13 (pid = 2772)
[2016-12-09 00:12:02] WARNING[32497]: res_pjsip_registrar.c:709 registrar_on_rx_request: AOR ‘pstn’ has no configured max_contacts. Endpoint ‘pstn’ unable to register
[2016-12-09 00:12:07] WARNING[11949]: res_pjsip_registrar.c:664 find_registrar_aor: AOR ‘100’ not found for endpoint ‘pstn’

I then tried switching back to chan_sip with the port within the proxy field in of my ATA (in my case, Checked firewall settings, all OK there, chan_sip is allowed to operate on the local network. Still no luck. Similar issue to before. :frowning: I feel like either I’m missing something or there’s something about my setup which is incompatible.

Would someone be able to screenshot the inner workings of their working setup? It would be super appreciated.

(Dave Burgess) #18

There are a couple of possibilities.

The first, and most obvious, is that the PJ-SIP channel doesn’t have the number of max contacts (which I think is the same as “max channels” in Chan-SIP) set in the config. I don’t even know if there is such a thing, but since the driver is complaining, it’s probably a setting in the PJ-SIP stuff that needs attention.

The second, and just as likely, is that PJ-SIP and Chan-SIP are different, and this (like the “host-ip without a password” thing) means that PJ-SIP is just not ready to fully replace Chan-SIP.

If it’s working with Chan-SIP, I’d leave it alone until we get another couple of iterations down the road on PJ-SIP.

(Karl Hakimian) #19

This setup is now working for me with chan_sip on two different systems, we should be able to get it to work for you as well.

What does your sip settings section of the truck look like, min is something like

secret=your super secret password

The port 5061 is the port that was setup in the PSTN line section of sipura. It is the port the sipura will be listening on.

(Stephendt) #20

Thanks for the responses. Tore more hair out today, not much luck.

Anyway, lets forget about pjsip for the trunk since it seems a bit broken for this particular use case. I’m back to using chan_sip.

I’ve tried tweaking a few things and am still getting the same output as you can see in my OP. Karl, I tried what you said by putting the port under the proxy in my ATA under the PSTN config (I tried both and with no success), but that just results in nothing in my Asterisk console when I try to call, and no response from my extension (although it dials like normal on my cell phone). I also tried disabling the firewall, and my entire 192.168.1.x range is in the trusted zone, so I don’t think it’s that. If it’s blocking it, I can’t seem to see anything indicating that.

Here are screenshots of my entire setup. If someone could point out where i’m going wrong I’d greatly appreciate it.