Sipura/Linksys 3102 + PJSIP as Device / Extension

SOLVED

So that I’m not that a**h*le who doesn’t share solutions, here’s an update.

As predicted, through some more grepping and debug, I noticed that the pjsip was spotting the IP address of the SPA3102 and assuming it was the trunk (FXO) trying to register, not the FXS

I have fixed the problem, by doing this:

In FreePBX / Trunk:

  • Set the Authentication to “BOTH”
  • Set the Registration to “RECEIVE”
  • Set Match Inbound Authentication to “Auth_Username”

In FreePBX / SIP Settings / Chan_pjsip

  • Set the Endpoint Identification Order to be auth_username, ip, username, anonymous, header

In the SPA3102 / PSTN Line :

  • Set the Proxy to the Asterisk server IP address
  • Set the Port to 5062
  • Set Register to “YES”
  • Set User ID and Auth ID to the name of the trunk in asterisk/FreePBX
  • Set the Password to match the Secret in asterisk/FreePBX
  • Set User Auth ID to YES

This forces the SPA3102 to register using a username with asterisk, and removes the IP address of the SPA3102 from the pjsip identify configuration. It won’t be looking for the IP address of the SPA3102 any more. You’ll see the PSTN section of the SPA3102 saying it’s registered.

In the FreePBX/Extension (or Device):

  • Don’t do anything special. The “out of the box” config seems to work.

In the SPA 3102 Line 1 Configuration:

  • In the Proxy put the address of the asterisk server
  • Set the port to 5060
  • Set Auth INVITE to NO
  • Set Register to YES
  • Set the User ID and Auth ID to be the same as the Extension / Device number
  • Set the Password to be the same as the Secret in FreePBX/asterisk
  • Set Use Auth ID to YES

Essentially this is not telling asterisk the IP address of the SPA3102, but forcing the SPA3102 to register both the trunk (FXO) and extension (FXS) separately with asterisk, and telling asterisk it needs to send auth to the SPA3102 when it wants to create an outbound session.

Now I can:

  • Receive calls from the PSTN (FXO) into Asterisk
  • Send calls to the PSTN (FXO) from Asterisk
  • Send calls from the Extension (FXS) into Asterisk
  • Receive calls from Asterisk onto the Extension (FXS)

There was an outstanding problem, which was fixed directly after I posted this. For context, I’ll leave the description of the problem here:

When I try and call the extension (the FXS) from Asterisk, I get this error:

res_pjsip_outbound_authenticator_digest.c: Endpoint: '801': Unable to create request with auth. No auth credentials for realm(s) '<asterisk server IP>' in challenge.

I don’t know what to do to rectify that, but I’ll keep looking and update here if I find it.

1 Like