I’m trying to get FreePBX 13.0.192.9 (from the FreePBX Distro) to talk to a Linksys SPA-3102 gateway. The phone->SIP side seems to be working OK, but I’m having a lot of trouble with the PSTN->SIP side.
If I have “PSTN CID For VoIP CID:” disabled on the SPA, the trunk works fine, they’re routed to my “ring all the phones” rule, and generally things work fine.
Now, I’m in the UK, and I’m subscribed to my phone provider’s caller ID service. I’d like to get this data passed through to FreePBX. If I enable “PSTN CID For VoIP CID:”, none of the extension phones ring, and I have these errors in the log:
[2017-07-01 22:32:28] NOTICE[18376] res_pjsip/pjsip_distributor.c: Request 'INVITE' from '"PSTN" <sip:07912345678@voipserver>' failed for '10.0.0.25:5062' (callid: [email protected]) - No matching endpoint found
[2017-07-01 22:32:28] NOTICE[9141] res_pjsip/pjsip_distributor.c: Request 'INVITE' from '"PSTN" <sip:07912345678@voipserver>' failed for '10.0.0.25:5062' (callid: [email protected]) - No matching endpoint found
[2017-07-01 22:32:28] NOTICE[9141] res_pjsip/pjsip_distributor.c: Request 'INVITE' from '"PSTN" <sip:07912345678@voipserver>' failed for '10.0.0.25:5062' (callid: [email protected]) - Failed to authenticate
[2017-07-01 22:32:28] NOTICE[5237] res_pjsip/pjsip_distributor.c: Request 'INVITE' from '"PSTN" <sip:07912345678@voipserver>' failed for '10.0.0.25:5062' (callid: [email protected]) - No matching endpoint found
[2017-07-01 22:32:28] NOTICE[5237] res_pjsip/pjsip_distributor.c: Request 'INVITE' from '"PSTN" <sip:07912345678@voipserver>' failed for '10.0.0.25:5062' (callid: [email protected]) - Failed to authenticate
Note that for my own privacy, I’ve changed the phone numbers:
- 07912345678 is a placeholder I’m using in place of my mobile phone number (cellphone).
- 0112345678 is a placeholder for my PSTN number – the phone line attached to the trunk.
Looking at the packets being exchanged with tcpdump, this is what the SPA sends with Caller ID on:
INVITE sip:01112345678@voipserver SIP/2.0
Via: SIP/2.0/UDP 10.0.0.25:5062;branch=z9hG4bK-f2d3cef5
From: PSTN <sip:07912345678@voipserver>;tag=99ef3fa4bebd7589o1
To: <sip:01112345678@voipserver>
Remote-Party-ID: PSTN <sip:07912345678@voipserver>;screen=yes;party=calling
Call-ID: [email protected]
CSeq: 103 INVITE
Max-Forwards: 70
Authorization: Digest username="pstntrunk",realm="asterisk",nonce="REDACTED",uri="sip:01112345678@voipserver",algorithm=MD5,response="REDACTED",opaque="7887d6803b25f65c",qop=auth,nc=00000001,cnonce="11a2b512"
Contact: PSTN <sip:[email protected]:5062>
Expires: 240
User-Agent: Linksys/SPA3102-5.2.13(GW002)
Content-Length: 436
Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, REFER
Supported: x-sipura, replaces
Content-Type: application/sdp
FreePBX responds to this with a “401 Unauthorised” error.
If I turn caller ID off, the INVITE header looks like this:
INVITE sip:01112345678@voipserver SIP/2.0
Via: SIP/2.0/UDP 10.0.0.25:5062;branch=z9hG4bK-20525951
From: PSTN <sip:pstntrunk@voipserver>;tag=5ddcc412af5abd1o1
To: <sip:01112345678@voipserver>
Remote-Party-ID: PSTN <sip:pstntrunk@voipserver>;screen=yes;party=calling
Call-ID: [email protected]
CSeq: 101 INVITE
Max-Forwards: 70
Contact: PSTN <sip:[email protected]:5062>
Expires: 240
User-Agent: Linksys/SPA3102-5.2.13(GW002)
Content-Length: 436
Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, REFER
Supported: x-sipura, replaces
Content-Type: application/sdp
FreePBX responds to this with a “SIP/2.0 100 Trying” message, followed by a “183 Session Progress” and a “180 Ringing”.
It looks like the differences are that when Caller ID is on, the INVITE header changes:
- The “From” header takes on the caller’s phone number (but the name stays set to “PSTN”)
- The “Remote-Party-ID” header changes to take on the caller’s phone number (instead of the trunk username I set, “pstntrunk”)
- The SPA sends a HTTP DIGEST authentication (as it’s registering successfully, I expect the password is correct).
- The “To” header remains the same, keeping the trunk’s phone number
How can I get FreePBX to accept the caller ID data (and the SPA), instead of throwing up a bunch of “no matching endpoint” errors?
My incoming routing rule is set to CID Any, DID Any. If I remember correctly, it also works with the DID set to the trunk’s PSTN number, but I can’t be certain. In any case, it didn’t get caller ID working.
Thanks.
PS: I do have a Dialplan configured in the SPA’s PSTN Line settings. It’s dialplan 2, and the PSTN-to-VoIP dialplan is set to default to it:
(S0<:01112345678@voipserver>)