Register with Asterisk through pjsip

Hi Guys,

Quick question.

When I register an account through Asterisk I can
register without any problems, but somehow it sends two requests when I look at the pjsip history.

ip-172-31-29-37*CLI> pjsip show history
No.   Timestamp  (Dir) Address                  SIP Message                        
===== ========== ============================== ===================================
00008 1610499786 * <== <IP>:60898      REGISTER sip:54.168.134.254:25060 SIP/2.0
00009 1610499786 * ==> <IP>:60898      SIP/2.0 401 Unauthorized
00010 1610499786 * <== <IP>:60898      REGISTER sip:54.168.134.254:25060 SIP/2.0
00011 1610499786 * ==> <IP>:60898      SIP/2.0 200 OK

As you can see;

First time: The client registers, asterisk send an unauthorized response.
Second time: The client registers, asterisk send an ok response.

Is this a normal process for a register or did I do something wrong in the settings?
It seems odd that the client needs to send two requests before he gets an ok response.

Thank you.

I don’t know If I am right, but just found the following online.

401 Unauthorized means “The request requires user authentication”.

It’s not an error.

It’s just a notice to show the authentication information.
Is this correct?

It’s normal. It’s how ‘challenge / response’ works.

@sedwards

Thank you!
I was thinking a bit too much.
Learned something new :slight_smile:

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