The proxy core TU sends back a 407 (Proxy Authentication Required) response.
The server transaction enters the "completed" state and passes the 407 response to transport. When ACK (request) is received: passes to "confirmed" state and starts the I timer. When the I timer fires, the server transaction is destroyed.
The server transport:
before sending the response: retrieve IP@ & port from 'sent-by' and "received"
when receiving the (ACK) request: by examining 'sent-by' parameter in top Via header field, matches it to relevant server transaction + adds "received" parameter.
at Initiating UA:
The client transport:
When receiving the response: matches it to the relevant client transaction by examining 'sent-by' parameter in top Via header field
Before sending the (ACK) request: inserts 'sent-by' parameter in Via header field.
When receiving the 407 response, the client transitions to state="completed", passes the response up to the TU, generates an ACK, and passes it to transport. D timer started. When D timer fires, the client transaction is destroyed.
The UAC analyses the response and prepares a new INVITE request.