anchor.diff:      NewTargets = cancel_pending_targets(State#state.targets),
       State#state{targets=NewTargets}.
   
  +%%--------------------------------------------------------------------
  +%% Function: printable_responses(Responses)
  +%%           Responses = list() of response record()
  +%% Descrip.: Format a list of responses for (debug) logging.
  +%% Returns : list() of string()
  +%%--------------------------------------------------------------------
   printable_responses([]) ->
       [];
   printable_responses([H | Rest]) when is_record(H, response) ->
  
positive.code:     util:safe_signal("sipproxy :", Parent, {sipproxy_terminating, self()}),
      Res.
  
  %%
  %% No actions left
  %%
  fork(State) when record(State, state), State#state.actions == [] ->
      OrigRequest = State#state.request,
      Targets = State#state.targets,
      {Method, ReqURI} = {OrigRequest#request.method, OrigRequest#request.uri},
      NewTargets = case allterminated(Targets) of
  		     true ->
  			 logger:log(debug, "sipproxy: All targets are terminated, staying alive to handle resends"),
  			 Targets;
  		     _ ->
  			 logger:log(normal, "sipproxy: Reached end of Actions-list for ~s ~s, cancelling pending targets.",
  				    [Method, sipurl:print(ReqURI)]),
  			 NewTargets1 = cancel_pending_targets(Targets),
  			 NewTargets1
      end,
      util:safe_signal("sipproxy :", State#state.parent, {sipproxy_no_more_actions, self()}),
      logger:log(debug, "sipproxy: waiting ~p seconds for final responses", [State#state.timeout]),
      process_wait(false, State#state{mystate=stayalive, targets=NewTargets, endtime=util:timestamp() + State#state.timeout}),
      ok;
  fork(State) when record(State, state) ->
      OrigRequest = State#state.request,
      [HAction | TAction] = State#state.actions,
      Method = OrigRequest#request.method,
  
negative.code: 	    none
      end.	    
  
  %%--------------------------------------------------------------------
  %% Function: aggregate_authreqs(BestResponse, Responses)
  %%           BestResponse = response record()
  %%           Responses    = list() of response record()
  %% Descrip.: Put authentication headers from all responses in
  %%           Responses into the one we have decided to send to our
  %%           parent - BestResponse.
  %% Returns : response record() | none
  %%
  %% Note    : This is described in RFC3261 #16.7 (Response Processing),
  %%           bullet 7. (Aggregate Authorization Header Field Values).
  %%--------------------------------------------------------------------
  %% BestResponse status == 407, Proxy-Authenticate
  aggregate_authreqs(#response{status=407}=BestResponse, Responses) when is_list(Responses) ->
      {Reason, Header} = {BestResponse#response.reason, BestResponse#response.header},
      ProxyAuth = collect_auth_headers(407, 'proxy-authenticate', Responses),
      logger:log(debug, "Aggregating ~p Proxy-Authenticate headers into response '407 ~s'",
  	       [length(ProxyAuth), Reason]),
      NewHeader = keylist:set("Proxy-Authenticate", ProxyAuth, Header),
      BestResponse#response{header=NewHeader};
  %% BestResponse status == 401, WWW-Authenticate
  aggregate_authreqs(#response{status=401}=BestResponse, Responses) when is_list(Responses) ->
      {Reason, Header} = {BestResponse#response.reason, BestResponse#response.header},
      WWWAuth = collect_auth_headers(401, 'www-authenticate', Responses),
      logger:log(debug, "Aggregating ~p WWW-Authenticate headers into response '401 ~s'",
  	       [length(WWWAuth), Reason]),
      NewHeader = keylist:set("WWW-Authenticate", WWWAuth, Header),
      BestResponse#response{header=NewHeader};
  %% BestResponse status is neither 401 nor 407
  aggregate_authreqs(BestResponse, Responses) when is_record(BestResponse, response), is_list(Responses) ->
      BestResponse.
  
  %%--------------------------------------------------------------------
  %% Function: collect_auth_headers(Status, Key, Responses)
  %%           Status    = integer(), SIP status code
  %%           Key       = term(), keylist key of headers to look for
  %%           Responses = list() of response record()
  %% Descrip.: Part of aggregate_authreqs(). Get all headers matched by
  %%           Key from all responses in Responses which have status
  %%           Status.
  %% Returns : list() of HValue
  %%           HValue = term(), header value as returned by
  %%                    keylist:fetch()
  %%--------------------------------------------------------------------
  collect_auth_headers(Status, Key, Responses) ->
      collect_auth_headers2(Status, Key, Responses, []).
  
  collect_auth_headers2(_Status, _Key, [], Res) ->
      Res;
  collect_auth_headers2(Status, Key, [H | T], Res) when is_record(H, response), H#response.status == Status ->
  