RFC 3261 states: UAs SHOULD cache the credentials for a given value of the To header
field and "realm" and attempt to re-use these values on the next
request for that destination. ... and later in the rfc: If a UA receives a Proxy-Authenticate header field value in a 401/407
response to a request with a particular Call-ID, it should
incorporate credentials for that realm in all subsequent requests
that contain the same Call-ID.
When running SipUnit tests against SipExchange, I found that by the time the BYE was sent out for a call, the cached credentials were no longer valid and SipExchange dropped the request. Trace at proxy:
22:34:47,444 INFO [jain-sip-nist-stack] <message
from="192.168.112.1:9091"
to="192.168.112.1:5060"
time="1251426887444"
isSender="false"
transactionId="z9hg4bk99c0f13c8366cf4e5d6ac9de8edb3bfb3735"
callId="2f78306456f8c79e2f708235a4b271e1@192.168.112.1"
firstLine="ACK sip:becky@192.168.112.1:9091;lr;transport=udp SIP/2.0"
>
<![CDATA[ACK sip:becky@192.168.112.1:9091;lr;transport=udp SIP/2.0
Call-ID: 2f78306456f8c79e2f708235a4b271e1@192.168.112.1
CSeq: 2 ACK
Via: SIP/2.0/UDP 192.168.112.1:9091;branch=z9hG4bK99c0f13c8366cf4e5d6ac9de8edb3bfb3735
From: <sip:amit@cafesip.org>;tag=469052195
To: <sip:becky@cafesip.org>;tag=894722090
Max-Forwards: 70
Route: <sip:192.168.112.1:5060;lr>
Proxy-Authorization: Digest uri="sip:becky@cafesip.org",realm="cafesip.org",username="amit",opaque="7lTSXiMBAAAOD4kG",nonce="tOLaXiMBAAAOD4kG",algorithm=MD5,response="3bfc5238fa28986906a2b77a5a3fcd70"
Content-Length: 0
]]>
</message>
22:34:47,450 INFO [jain-sip-nist-stack] <message
from="192.168.112.1:5060"
to="192.168.112.1:9091"
time="1251426887449"
isSender="true"
transactionId="z9hg4bk99c0f13c8366cf4e5d6ac9de8edb3bfb3735"
callId="2f78306456f8c79e2f708235a4b271e1@192.168.112.1"
firstLine="ACK sip:becky@192.168.112.1:9091;lr;transport=udp SIP/2.0"
>
<![CDATA[ACK sip:becky@192.168.112.1:9091;lr;transport=udp SIP/2.0
Call-ID: 2f78306456f8c79e2f708235a4b271e1@192.168.112.1
CSeq: 2 ACK
Via: SIP/2.0/UDP 192.168.112.1:9091;branch=z9hG4bK99c0f13c8366cf4e5d6ac9de8edb3bfb3735
From: <sip:amit@cafesip.org>;tag=469052195
To: <sip:becky@cafesip.org>;tag=894722090
Max-Forwards: 70
Proxy-Authorization: Digest uri="sip:becky@cafesip.org",realm="cafesip.org",username="amit",nonce="tOLaXiMBAAAOD4kG",opaque="7lTSXiMBAAAOD4kG",algorithm=MD5,response="3bfc5238fa28986906a2b77a5a3fcd70"
Content-Length: 0
]]>
</message>
22:34:50,474 INFO [jain-sip-nist-stack] <message
from="192.168.112.1:9091"
to="192.168.112.1:5060"
time="1251426890473"
isSender="false"
transactionId="z9hg4bk4ebadc88ab44e7dda2d0336f6776dc653735"
callId="2f78306456f8c79e2f708235a4b271e1@192.168.112.1"
firstLine="BYE sip:becky@192.168.112.1:9091;lr;transport=udp SIP/2.0"
>
<![CDATA[BYE sip:becky@192.168.112.1:9091;lr;transport=udp SIP/2.0
Via: SIP/2.0/UDP 192.168.112.1:9091;branch=z9hG4bK4ebadc88ab44e7dda2d0336f6776dc653735
CSeq: 3 BYE
Call-ID: 2f78306456f8c79e2f708235a4b271e1@192.168.112.1
From: <sip:amit@cafesip.org>;tag=469052195
To: <sip:becky@cafesip.org>;tag=894722090
Expires: 600
Max-Forwards: 70
Route: <sip:192.168.112.1:5060;lr>
Proxy-Authorization: Digest uri="sip:becky@cafesip.org",realm="cafesip.org",username="amit",opaque="7lTSXiMBAAAOD4kG",nonce="tOLaXiMBAAAOD4kG",algorithm=MD5,response="3bfc5238fa28986906a2b77a5a3fcd70"
Content-Length: 0
]]>
</message>
22:34:50,491 INFO [AuditLogger] Audit Log:
Service: subscriber user
Operation: authentication (SIP)
Status: Error - Authentication failed
User: anonymous
Primary Object(s): amit@cafesip.org
22:34:50,972 INFO [jain-sip-nist-stack] <message
from="192.168.112.1:9091"
to="192.168.112.1:5060"
time="1251426890972"
isSender="false"
transactionId="z9hg4bk4ebadc88ab44e7dda2d0336f6776dc653735"
callId="2f78306456f8c79e2f708235a4b271e1@192.168.112.1"
firstLine="BYE sip:becky@192.168.112.1:9091;lr;transport=udp SIP/2.0"
>
<![CDATA[BYE sip:becky@192.168.112.1:9091;lr;transport=udp SIP/2.0
Via: SIP/2.0/UDP 192.168.112.1:9091;branch=z9hG4bK4ebadc88ab44e7dda2d0336f6776dc653735
CSeq: 3 BYE
Call-ID: 2f78306456f8c79e2f708235a4b271e1@192.168.112.1
From: <sip:amit@cafesip.org>;tag=469052195
To: <sip:becky@cafesip.org>;tag=894722090
Expires: 600
Max-Forwards: 70
Route: <sip:192.168.112.1:5060;lr>
Proxy-Authorization: Digest uri="sip:becky@cafesip.org",realm="cafesip.org",username="amit",opaque="7lTSXiMBAAAOD4kG",nonce="tOLaXiMBAAAOD4kG",algorithm=MD5,response="3bfc5238fa28986906a2b77a5a3fcd70"
Content-Length: 0
]]>
</message>
22:34:51,972 INFO [jain-sip-nist-stack] <message
from="192.168.112.1:9091"
to="192.168.112.1:5060"
time="1251426891972"
isSender="false"
transactionId="z9hg4bk4ebadc88ab44e7dda2d0336f6776dc653735"
callId="2f78306456f8c79e2f708235a4b271e1@192.168.112.1"
firstLine="BYE sip:becky@192.168.112.1:9091;lr;transport=udp SIP/2.0"
>
<![CDATA[BYE sip:becky@192.168.112.1:9091;lr;transport=udp SIP/2.0
Via: SIP/2.0/UDP 192.168.112.1:9091;branch=z9hG4bK4ebadc88ab44e7dda2d0336f6776dc653735
CSeq: 3 BYE
Call-ID: 2f78306456f8c79e2f708235a4b271e1@192.168.112.1
From: <sip:amit@cafesip.org>;tag=469052195
To: <sip:becky@cafesip.org>;tag=894722090
Expires: 600
Max-Forwards: 70
Route: <sip:192.168.112.1:5060;lr>
Proxy-Authorization: Digest uri="sip:becky@cafesip.org",realm="cafesip.org",username="amit",opaque="7lTSXiMBAAAOD4kG",nonce="tOLaXiMBAAAOD4kG",algorithm=MD5,response="3bfc5238fa28986906a2b77a5a3fcd70"
Content-Length: 0
]]>
</message>