Hi Guys, I have FreePbx phone system 40 and. Linksys SPA3102. The SPA3102 is set up as extn105 and both Line 1 & PSTN are showing as registered. Extend to extension calls work fine as does outgoing PSTN calls. Unfortunately Incoming calls from the PSTN fail, the caller hears ringing tone, but no phones connected to FreePBX ring. Any guidance would be gratefully accepted. Thanks
See my answer in Speed Up SPA3102 . If you are treating this device as an incoming trunk (using Inbound Routes, etc.), then the relevant Dial Plan should be something like
(<:12125551212>S0)
(replace 12125551212 with the DID number used in your route).
If you still have trouble: If a failing call is logged in the PBX, post the log. If not, post a screenshot of the SPA3102 info page, taken when the call has been ringing for about 10 seconds.
Hi, Attached are 2 docs, screen shot of the SPA3102 Info page after an incoming call has benn calling for at least 10 seconds. Also is a screen shot of the FreePbx log. I hope this help as I am pulling my hair out and there is not much left
The number redacted on both files is my mobile number which I was using to generate the incoming call. The FreePBX is on IP 192.168.1.175 and the SPA3102 is on IP 192.168.1.151.
Thanks
Peter
I might be wrong here, but I think this is failing because of how you defined your trunk. SPA3102 is sending âpstnâ as username, but your trunk is not correctly configured for that username.
In order for me to help you, please provide your trunk definition on FreePBX and your FXO configuration and dial plan on SPA3102
Unfortunately, my 3102 is on an old system (chan_sip only) and Iâve never used pjsip in a Registration Receive scenario. As a guess, try setting Match (Permit) for the trunk to 192.168.1.151 and reloading (or restarting) Asterisk. Also, make sure that you have a default (any DID) Inbound Route, in case there is an issue there.
If no luck, post screenshots of the pjsip trunk settings (General and Advanced) and maybe we can spot something. Otherwise, trying chan_sip is a possibility.
The redacted text is my PSTN line number.
Sorry, I meant the FXO registration settings. Also, there is a high probability that you will get better result with a CHAN_SIP trunk instead of CHAN_JSIP in this particular case.
As I can see, the username pstn seems to be configured correctly both on the SPA and on the trunk definition, but for some reason FreePBX doesnât recognize it, from the fact that you get the error that there is no endpoint called pstn. Have you tried setting the trunk as a CHAN_SIP trunk instead of PJSIP?
In the Inbound Route setting, the CallerID Number field should be blank. When you put something there, it means that only calls from the number you specify should use that route.
Also, until you get this working, donât push your luck by routing the calls back to the 3102 itself â use another extension that you have tested (by calling it from ext. 105 or from a third extension) and is known to receive incoming calls properly.
If you still have trouble, please post screenshots of the 3102 Dial Plans and the PSTN-To-VoIP Gateway Setup, and the Advanced tab of the pjsip Settings for the trunk.
Ok I have changed to a SIP trunk (screen shots attached), but now cant get the PSTN (SPA3102) to register. I have also changed the CID on the Inbound route to blank as per Stewrat1â s suggestion.
Just to say - I really
appreciate the support that you guys are giving me, thanks.I have also changed the âset Destinationâ on the âInbound Routeâ to extension 100
Maybe you shouldnât have switched to chan_sip before posting the rest of your pjsip settings. But anyhow, here are my chan_sip settings:
Of course, your user and trunk names will be different.
Assuming that you are using the default ports (pjsip on 5060 and chan_sip on 5160), in the 3102 you need to change Proxy to 192.168.1.175:5160
Also, if this is your first chan_sip trunk or extension, youâll need to permit UDP port 5160 in whatever firewall you may be running on the PBX.
If you still canât register, see if anything gets logged for the attempts. If not, itâs probably a firewall issue.
Or, post your pjsip and 3102 details as previously requested and weâll try to debug that.
You Guys are fantastic, I now have incoming and outgoing calls working. Thank you so much.
Best regards
Peter
Iâm glad that you got it working. Please post the solution, to help the next user with a similar issue.
I think I know what your problem is with a registration receive PJSIP trunk.
In short, inbound invites will fail to authenticate if the user portion in the from header of the invite thatâs coming in doesnât equal your trunk name in your PJSIP trunk.
Thatâs because pjsip is matching the endpoint to the username in the from header. As you have your 078603xxx number in the from header, but your trunk username is pstn, there is no match and your call fails.
PJSIP unfortunately does not currently support using a registered IP address to do inbound IP based matching.
The are two solutions, but each one requires adding a parameter in custom.conf files.
Solution 1:
Force your PJSIP trunk to not authenticate incoming invites on the user portion in the invite from header, but on authentication username of the trunk, which is âpstnâ in your example.
You do this by adding the parameter identify_by=auth_username
to pjsip.endpoint_custom_post.conf with your endpoint (trunk) name in square brackets.
Like this:
[pstn](+)
identify_by=auth_username
Solution 2:
Look for a setting on your gateway thatâs equivalent to the parameter âfrom userâ on Asterisk. Set this to your trunk name.
Then calls will work but all show the same CallerID.
To fix that make sure to send PAI or RPID header and set your PJSIP trunk to trust remote party ID, which it doesnât do by default.
For this you need to add parameter trust_id_inbound in pjsip.endpoint_custom_post.conf:
[pstn](+)
trust_id_inbound=yes
There are feature requests on the bug tracker to add those options to the GUI.
Vote them up if you would like them to happen:
https://issues.freepbx.org/projects/FREEPBX/issues/FREEPBX-17158
https://issues.freepbx.org/projects/FREEPBX/issues/FREEPBX-17157
Best would be if Digium changed PJSIP to support using a registered IP address to do inbound IP based matching.
In the OPâs case (gateway and PBX on the same LAN), a simple solution for pjsip would be to have the gateway IP address be static or (static DHCP). You could then set it up like a âwholesaleâ trunk, no registration, no authentication, put the gateway address in the Match (Permit) field, put the PBX address in the gatewayâs VoIP Access List.
@avayax, assuming that the OP tried my suggestion for the Mach (Permit) field and it didnât help, do you know whether that gets ignored when Registration Receive is set?
The Match (Permit) setting gets ignored with Registration Receive.
Itâs normally part of the identify section of an endpoint, but endpoints receiving registration have none.
The identify configuration enables IP address matching against an endpoint.
But PJSIP canât use a registered IP address to do inbound IP based matching, therefore no need for an identify for registration receivers.
For calls from a trunking provider that you have registered to, the From user may be different every time,
so you want to match against IP address instead of From user, and that is what the Identify section and Match (Permit) field is for.
Thatâs also an option.
With the gateway on static IP there is no need for registration. The trunk can then still be set to authenticate invites in whatever directions the OP wants, but he wonât encounter the problem he is describing, as matching will be done on IP address.
If you set the PJSIP trunk to not register, an identify section and a Match field will be set automatically.
There is a default order in PJSIP by which endpoint identifiers are given priority.
Itâs:
endpoint_identifier_order=ip,username,anonymous,auth_username
Many thanks for the explanation.
We really need a âpjsip cookbookâ or maybe âpjsip for dummiesâ. The drumbeat is âUse pjsip; chan_sip is deprecatedâ, but few know how it works.
In my own situation, with the 3102 at a remote location on a dynamic IP, Registration Receive is mandatory. Your âSolution 2â wonât work on a 3102, because the only way to not put the calling number in the From header is to not have caller ID at all. Solution 1 would work fine, but not knowing that there are âsecretâ pjsip parameters not exposed in the GUI, I would have given up and switched to chan_sip. Of course, when people do that, they join the crowd that believes that pjsip is not ready for prime time.