Can't Hangup correctly "Failed to authenticate on BYE"

Hi,

I’ve got an issue on asterisk 1.6 (Debian squeeze)
I can’t hangup with certain trunk sip provider.
extension.conf :

exten => s,1,Answer()
exten => s,n,NoOP('test')
exten => s,n,Hangup()

Asterisk on debug :

[Sep 7 10:20:52] NOTICE[17598]: chan_sip.c:18858 handle_response: Failed to authenticate on BYE to '<sip:XXX ....
tcpdump :

[code]10:20:52.566937 IP (tos 0x0, ttl 64, id 40087, offset 0, flags [none], proto UDP (17), length 541)
10.0.0.101.5060 > XXX.5062: SIP, length: 513
BYE sip:XXXX:5062 SIP/2.0
Via: SIP/2.0/UDP 10.0.0.101:5060;branch=z9hG4bK7f75ae85;rport
Max-Forwards: 70
From: sip:XXXX@XXXX;tag=as35b57a5d
To: sip:XXXX@XXXX:5060;tag=XXXX+1+89c4de33+b3a37209;isup-oli=00
Call-ID: 0gQAAC8WAAACBAAALxYAAIGxjrYq5b3PU2quUEaNqmI7CWAwoQkMFpu7tPWqYlqm@XXXX
CSeq: 102 BYE
User-Agent: Asterisk PBX 1.6.2.9-2+squeeze6
X-Asterisk-HangupCause: Normal Clearing
X-Asterisk-HangupCauseCode: 16
Content-Length: 0

10:20:52.576686 IP (tos 0x0, ttl 57, id 0, offset 0, flags [DF], proto UDP (17), length 656)
XXXX.5062 > 10.0.0.101.5060: SIP, length: 628
SIP/2.0 401 Unauthorized
Call-ID: 0gQAAC8WAAACBAAALxYAAIGxjrYq5b3PU2quUEaNqmI7CXAwoQkMFpu7tPWqYlqm@XXXX
CSeq: 102 BYE
From: sip:XXXX@XXXX;tag=as35b57a5d
To: sip:XXXX@XXXX:5060;tag=XXXX+1+89c4de33+b3a37209;isup-oli=00
Via: SIP/2.0/UDP 10.0.0.101:5060;received=XXXX;rport=5060;branch=z9hG4bK7f75ae85
Content-Length: 0
Supported: resource-priority, 100rel
Contact: sip:213.151.164.130:5062
WWW-Authenticate: Digest realm=“sip.XXX.net”,nonce=“660f7d3ec209”,stale=false,algorithm=MD5,qop="auth"
Server: DC-SIP/2.0
Organization: Metaswitch Networks[/code]

as you can see, there’s no Authorization: Digest on the BYE, so provider return a 401
Same with asterisk 1.8 (ubuntu 12.04)

Why asterisk doesn’t send this header on the BYE ?

You need the 401 response to know the nonce and digest method.

However, it is not normal to re-authenticate on in dialogue requests. I would wonder if the remote system had some problem in matching the request with the existing session.

Thanks for your answer :smile:

[quote=“david55”]You need the 401 response to know the nonce and digest method.
[/quote]
I agree, but asterisk doesn’t answer to this 401 (it has the digest so it can answer). Is there a way to force the “re-authentication” ?

[quote=“david55”]
However, it is not normal to re-authenticate on in dialogue requests. I would wonder if the remote system had some problem in matching the request with the existing session.[/quote]
Maybe, thanks for the hint.

I having the same issue. I am using a Vonage Softphone. It successfully answers the call and executes a Playback() and Verbose() command but it fails on Hangup().

“Failed to authenticate on BYE to …”

I am running a Ubuntu Server on VirtualBox with Windows 7 Host. Asterisk version is 1.11. I can provide my sip.conf if that helps.

Any suggestions or workarounds?