Failed to AUTHENTICATE SIP INVITE to PEER server

I am getting (no NAT) Failed to Authenticate on INVITE debug message as shown in an attached image when server1 sends INVITE to server2

What could be an issue?

The obvious issue would be you had configured different passwords at each end.

For further help, you would need to provide the configuration on each side and the complete failed SIP session.

Hey , You are right , it is something related to passwords.

server1: sip.conf

[general]

[server2]
type=friend
secret=1234
context= server2_incoming
host= 192.168.71.6
canreinvite = no
disallow=all
allow=ulaw,alaw,slin12,slin16,slin24,slin32,slin44,slin48,slin96,slin192

[1001]
type=friend
;secret=1234
host=dynamic
context=phones

[9005]
type=friend
;secret=1234
host=dynamic
context=phones
allow=ulaw,alaw,slin12,slin16,slin24,slin32,slin44,slin48,slin96,slin192

server2: sip.conf

[general]

[server1]
type=friend
secret=1234
context= server1_incoming
host= 192.168.71.100
canreinvite = no
disallow=all
allow=ulaw,alaw,slin12,slin16,slin24,slin32,slin44,slin48,slin96,slin192

[1001]
type=friend
;secret=1234
host=dynamic
context=phones

[9005]
type=friend
;secret=1234
host=dynamic
context=phones
allow=ulaw,alaw,slin12,slin16,slin24,slin32,slin44,slin48,slin96,slin192

I am able to send INVITE to peer server correctly if, I comment out (remove) secret code for UAC 1001 and 9005 in both server’s sip.conf.

If I apply secret code, it is giving AUTHENTICATION ERROR as mentioned earlier

<— SIP read from UDP:192.168.71.6:5060 —>
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 192.168.71.100:5060;branch=z9hG4bK69487920;received=192.168.71.100
From: sip:1001@192.168.71.100;tag=as6dcf43c7
To: sip:111@192.168.71.6;tag=as4ff72765
Call-ID: 4c9f6a4c44b5bcbb23c8d4dc423924d8@192.168.71.100:5060
CSeq: 102 INVITE
Server: Asterisk PBX 13.38.3
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0

<------------->
— (10 headers 0 lines) —
Transmitting (no NAT) to 192.168.71.6:5060:
ACK sip:111@192.168.71.6 SIP/2.0
Via: SIP/2.0/UDP 192.168.71.100:5060;branch=z9hG4bK69487920
Max-Forwards: 70
From: sip:1001@192.168.71.100;tag=as6dcf43c7
To: sip:111@192.168.71.6;tag=as4ff72765
Contact: sip:1001@192.168.71.100:5060
Call-ID: 4c9f6a4c44b5bcbb23c8d4dc423924d8@192.168.71.100:5060
CSeq: 102 ACK
User-Agent: Asterisk PBX certified/13.21-cert4
Content-Length: 0


-- Called server2/111
-- Channel CBAnn/1-00000007;2 joined 'softmix' base-bridge <3a73a1c2-53db-47a4-a64a-ca738eb7c831>

Scheduling destruction of SIP dialog ‘4c9f6a4c44b5bcbb23c8d4dc423924d8@192.168.71.100:5060’ in 6400 ms (Method: INVITE)
– <CBAnn/1-00000007;1> Playing ‘confbridge-join.gsm’ (language ‘en’)
[Aug 18 06:13:58] NOTICE[1755]: pbx_spool.c:447 attempt_thread: Call failed to go through, reason (0) Call Failure (not BUSY, and not NO_ANSWER, maybe Circuit busy or down?)
[Aug 18 06:13:58] NOTICE[1755]: pbx_spool.c:450 attempt_thread: Queued call to SIP/server2/111 expired without completion after 0 attempts
Retransmitting #2 (no NAT) to 192.168.71.7:46039:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.71.7:46039;branch=z9hG4bK.JN8DJut9D;received=192.168.71.7;rport=46039
From: “1001” sip:1001@192.168.71.100;tag=COaFWtsBk
To: sip:1111@192.168.71.100;tag=as312d1efe
Call-ID: 0r0~dNpRPk
CSeq: 20 INVITE
Server: Asterisk PBX certified/13.21-cert4
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: sip:1111@192.168.71.100:5060
Content-Type: application/sdp
Content-Length: 270

v=0
o=root 1182371981 1182371981 IN IP4 192.168.71.100
s=Asterisk PBX certified/13.21-cert4
c=IN IP4 192.168.71.100
t=0 0
m=audio 10438 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv


<— SIP read from UDP:192.168.71.7:46039 —>
ACK sip:1111@192.168.71.100:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.71.7:46039;rport;branch=z9hG4bK.ny8iTHJxr
From: “1001” sip:1001@192.168.71.100;tag=COaFWtsBk
To: sip:1111@192.168.71.100;tag=as312d1efe
CSeq: 20 ACK
Call-ID: 0r0~dNpRPk
Max-Forwards: 70
User-Agent: Linphone/4.5.1 (Pixel 2 XL) LinphoneSDK/5.0.1 (tags/5.0.1^0)

<------------->
— (8 headers 0 lines) —

<— SIP read from UDP:192.168.71.7:46039 —>
ACK sip:1111@192.168.71.100:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.71.7:46039;branch=z9hG4bK.ny8iTHJxr;rport
From: “1001” sip:1001@192.168.71.100;tag=COaFWtsBk
To: sip:1111@192.168.71.100;tag=as312d1efe
CSeq: 20 ACK
Call-ID: 0r0~dNpRPk
Max-Forwards: 70
User-Agent: Linphone/4.5.1 (Pixel 2 XL) LinphoneSDK/5.0.1 (tags/5.0.1^0)

<------------->
— (8 headers 0 lines) —

<— SIP read from UDP:192.168.71.7:46039 —>
ACK sip:1111@192.168.71.100:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.71.7:46039;branch=z9hG4bK.ny8iTHJxr;rport
From: “1001” sip:1001@192.168.71.100;tag=COaFWtsBk
To: sip:1111@192.168.71.100;tag=as312d1efe
CSeq: 20 ACK
Call-ID: 0r0~dNpRPk
Max-Forwards: 70
User-Agent: Linphone/4.5.1 (Pixel 2 XL) LinphoneSDK/5.0.1 (tags/5.0.1^0)

<------------->
— (8 headers 0 lines) —
Really destroying SIP dialog ‘4c9f6a4c44b5bcbb23c8d4dc423924d8@192.168.71.100:5060’ Method: INVITE

<— SIP read from UDP:192.168.71.7:46039 —>

<------------->

<— SIP read from UDP:192.168.71.6:5060 —>
OPTIONS sip:192.168.71.100 SIP/2.0
Via: SIP/2.0/UDP 192.168.71.6:5060;branch=z9hG4bK59a3fb66
Max-Forwards: 70
From: “asterisk” sip:asterisk@192.168.71.6;tag=as0dc000a8
To: sip:192.168.71.100
Contact: sip:asterisk@192.168.71.6:5060
Call-ID: 09d64af70ebcf13b6730af3257abade4@192.168.71.6:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 13.38.3
Date: Wed, 18 Aug 2021 06:14:11 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0

<------------->
— (13 headers 0 lines) —
Sending to 192.168.71.6:5060 (no NAT)
Looking for s in PA (domain 192.168.71.100)

<— Transmitting (no NAT) to 192.168.71.6:5060 —>
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 192.168.71.6:5060;branch=z9hG4bK59a3fb66;received=192.168.71.6
From: “asterisk” sip:asterisk@192.168.71.6;tag=as0dc000a8
To: sip:192.168.71.100;tag=as09129c26
Call-ID: 09d64af70ebcf13b6730af3257abade4@192.168.71.6:5060
CSeq: 102 OPTIONS
Server: Asterisk PBX certified/13.21-cert4
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Accept: application/sdp
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘09d64af70ebcf13b6730af3257abade4@192.168.71.6:5060’ in 32000 ms (Method: OPTIONS)

<— SIP read from UDP:192.168.71.7:46039 —>

<------------->
Really destroying SIP dialog ‘09d64af70ebcf13b6730af3257abade4@192.168.71.6:5060’ Method: OPTIONS

It is not safe to have two devices with the same name, and type=friend or user on machines connected by a tie trunk. If, in practice, 1001 and 9005, on the same machine, have different IP addresses, you should use type=peer. There is no valid reason for not using type=peer for server1 and server2, although that is not the source of the problem.

If 1001 and 9005 can have the same IP address, you ensure that calls from the other daemon don’t have caller IDs that match their name, as it will not be possible to avoid the user of type=friend.

Also note that canreinvite is deprecated in favour of directmedia, and that the use of chan_sip is strongly advised against, on new systems, unless there is a specific technical reason, and, in fact, chan_sip is not enabled by default in the latest version of Asterisk. The overuse of type=friend and the use of options deprecated ore than half a decade ago is typical of using sample configurations from the net, without finding out what they mean. Very few, if any, such examples are both correct and follow good practice.

Also using allow without an initial disallow has been found to cause problems on some recent versions of Asterisk (SDP negotiation failures).

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