PJSIP Failed to Authenticate

Hey guys.

I installed FreePBX on a Debian 12 virtual server.

I use real IP, without NAT on the server.

Immediately after installation, I created an extension and configured it on MicroSIP.

I can’t use it because it gives an authentication error as shown below.

I tried enabling all codecs without success.

I tried disabling the firewall (which is not the problem, as it actually tries to register)

Can anyone shed some light?

[2024-12-11 16:21:41] NOTICE[18821]: res_pjsip/pjsip_distributor.c:673 log_failed_request: Request ‘REGISTER’ from ‘sip:1001@IP_SERVER’ failed for ‘MY_IP:56491’ (callid: 63fb1378602340259f0d4b393e80e01f) - Failed to authenticate
<— Transmitting SIP response (555 bytes) to UDP:MY_IP:56491 —>
SIP/2.0 401 Unauthorized

The port?

With Wireshark you will see what’s wrong.
use tcpdump.
Check your SIP port.
Set the network on Advanced SIP settings.

Just an idea like that.

Hello franckdanard. Thanks for the reply.

I’m using VirtualBox with the network in bridge mode.

MY_IP = My PC using MicroSIP (in the case of the port, it’s the source port)
IP_SERVER = FreePBX

As I said, I just installed it and when creating the extension I noticed a warning about using pjsip on port 5060.

In settings > Asterisk SIP Settings > chan_pjsip > (udp) Port to Listen On = 5060 (default)
In SIP Network I set it to my network, which is a /16 of public IPs.

I can capture it using wireshark/tcpdump, but the packet arrives at FreePBX and is rejected due to “authentication failure”.

I installed it twice without changing anything, I just created the extension and tried to authenticate with MicroSIP. I tried disabling the firewall and adding ignoreip in fail2ban. If it were a firewall or fail2ban, you wouldn’t see anything in the asterisk debug.

It’s perfectly OK for the source port to be high.

Failed to authenticate means the password configured on the device doesn’t match that configured on Asterisk.

hello David

Thanks for your reply.

I created the extension through quick creation with the automatically generated password. I also tried changing the password, but to no avail.

I did something extremely simple to test the environment by creating an extension and authenticating.

s

Does your physical ‘extension’ (consider a softhphone here as physical) have the same server, password, port and transport set as the FreePBX extension created?

check with sngrep

Please confirm that Secret for the extension matches the password entered into MicroSIP.

Yes, if here it’s the dynamic port
I think, it happends when you don’t set the good port too. I don’t remoember correctly, One day I set 5061 instead of 5060 and I had this error too.

Anyway, there is no reason to get this error if the password is good.

Ho.
Sometimes the password doesn’t work when you change it.
Try to check this one in the pjsip conf file.

Hey guys.

Dicko, yes, I’m trying to authenticate a MicroSIP (which I already use for my extensions and they all work fine)

Stewart, I copied and pasted the secret into MicroSIP, replaced the secret with another one and also used CTRL+C/V in MicroSIP. I tried everything related to the password. Big, small password…

Franck, I tried to change the pjsip port and I couldn’t even connect (I didn’t understand). But the error is clear: authentication failure.

I also looked at sngrep which shows the same thing as the pjsip debug.

What I find strangest is that I did the installation twice using only the installation script and then (without changing anything) I created the extension.

maybe this is my stupid answer, but have you tried adding your network or IP to trusted ones?
not fail2ban, but in the firewall?

In this case, no log in Asterisk.
The IP would be dropped before connecting on Asterisk.

Hey guys.

Here is a feedback.

I think I identified the problem.

I did a new installation (3rd) and disabled IPv6. This time, the creation of extensions worked, but the Bulk import continues with an authentication error.

Finally, I installed VirtualBox on another PC (Windows) and reinstalled debian12/Freepbx. I tested the creation of an extension and also the bulk import and both worked.

I confess that this is very curious, but the problem is not with FreePBX.

I thank those who paid attention.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.