anchor.diff:  %% Returns: true  |
   %%          false
   %%--------------------------------------------------------------------
  -all_terminated(State) when record(State, state) ->
  +all_terminated(State) when is_record(State, state) ->
       ServerAlive = transactionlayer:is_good_transaction(State#state.serverhandler),
       ClientAlive = client_transaction_alive(State),
       if
  
positive.code: 	    Res
      end.
  
  %%
  %% Dst is an URI
  %%
  guarded_start(ServerHandler, ClientPid, Request, URI, Timeout) when record(URI, sipurl) ->
      %% URI input
      Dst = #sipdst{uri=URI},
      logger:log(debug, "sippipe: Made sipdst record out of URI input : ~s", [sipurl:print(URI)]),
      guarded_start(ServerHandler, ClientPid, Request, [Dst], Timeout);
  
  %%
  %% Dst == route
  %%
  guarded_start(ServerHandler, ClientPid, Request, route, Timeout) ->
      %% Request should have a Route header
      %% URI passed to process_route_header is foo here
      case siprequest:process_route_header(Request#request.header, Request#request.uri) of
  	nomatch ->
  	    logger:log(error, "sippipe: No destination given, and request has no Route header"),
  	    erlang:fault("no destination and no route", [ServerHandler, ClientPid, Request, route, Timeout]);
  	{ok, NewHeaderX1, DstURI, ReqURI} when record(DstURI, sipurl), record(ReqURI, sipurl) ->
  	    %% XXX is it right to just ditch NewHeaderX{1,2} here or should we stick it into Request?
  	    {ok, NewHeaderX2, ApproxMsgSize} = siprequest:check_proxy_request(Request),
  	    logger:log(debug, "sippipe: Routing request as per the Route header, Destination ~p, Request-URI ~p",
  		      [sipurl:print(DstURI), sipurl:print(ReqURI)]),
  	    case sipdst:url_to_dstlist(DstURI, ApproxMsgSize, ReqURI) of
  		{error, nxdomain} ->
  		    logger:log(debug, "sippipe: Failed resolving URI ~s : NXDOMAIN (responding '604 Does Not Exist Anywhere')",
  			       [sipurl:print(DstURI)]),
  		    transactionlayer:send_response_handler(ServerHandler, 604, "Does Not Exist Anywhere"),
  		    error;
  		{error, What} ->
  		    logger:log(normal, "sippipe: Failed resolving URI ~s : ~p", [sipurl:print(DstURI), What]),
  		    transactionlayer:send_response_handler(ServerHandler, 500, "Failed resolving Route destination"),
  		    error;
                  DstList when list(DstList) ->
                      guarded_start(ServerHandler, ClientPid, Request, DstList, Timeout);
                  Unknown ->
                      logger:log(error, "sippipe: Failed resolving URI ~s : ~p", [sipurl:print(DstURI), Unknown]),
  		    transactionlayer:send_response_handler(ServerHandler, 500, "Failed resolving Route destination"),
  		    error
              end;
  	Unknown ->
  	    logger:log(error, "sippipe: Unkown result from sipdst:url_to_dstlist : ~p",
  		       [Unknown]),
  	    transactionlayer:send_response_handler(ServerHandler, 500, "Server Internal Error"),
  	    error
      end;
  
  %% First, we want to get the branch base from an existing ServerHandler
  guarded_start(ServerHandler, ClientPid, Request, DstList, Timeout) when record(Request, request), list(DstList) ->
      case transactionlayer:is_good_transaction(ServerHandler) of
  	true ->
  	    %% Adopt server transaction and then continue
  	    case adopt_st_and_get_branch(ServerHandler) of
  		error ->
  		    transactionlayer:send_response_handler(ServerHandler, 500, "Server Internal Error"),
  		    error;
  		cancelled ->
  		    ok;
  		Branch ->
  		    guarded_start2(Branch, ServerHandler, ClientPid, Request, DstList, Timeout)
  	    end;
  	false ->
  	    %% Either dead transaction handler, or none supplied. Try to find a valid handler
  	    %% using the request.
  	    case transactionlayer:get_handler_for_request(Request) of
  		{error, E} ->
  		    logger:log(error, "sippipe: Could not start pipe, no valid server transaction " ++
  			       "supplied (~p) and none found using transaction layer, error : ~p",
  			       [ServerHandler, E]),
  		    error;
  		STHandler ->
  		    %% Ok, found the server transaction handler. Adopt it and query it for it's branch base.
  		    case adopt_st_and_get_branch(STHandler) of
  			error ->
  			    transactionlayer:send_response_handler(STHandler, 500, "Server Internal Error"),
  			    error;
  			cancelled ->
  			    ok;
  			Branch ->
  			    guarded_start2(Branch, STHandler, ClientPid, Request, DstList, Timeout)
  		    end
  	    end
      end.
  
  %%
  %% ClientPid /= none
  %%
  guarded_start2(Branch, ServerHandler, ClientPid, Request, DstListIn, Timeout) when record(Request, request), ClientPid /= none ->
      %% A client pid was supplied to us, go to work
      {ok, _, ApproxMsgSize} = siprequest:check_proxy_request(Request),
      final_start(Branch, ServerHandler, ClientPid, Request, DstListIn, Timeout, ApproxMsgSize);
  
  %%
  %% ClientPid == none
  %%
  guarded_start2(Branch, ServerHandler, _, Request, [DstIn | DstInT], Timeout) when record(Request, request), record(DstIn, sipdst) ->
      %% No client transaction handler is specified, start a client transaction on the first
      %% element from the destination list, after making sure it is complete.
      DstListIn = [DstIn | DstInT],
      {ok, _, ApproxMsgSize} = siprequest:check_proxy_request(Request),
      case resolve_if_necessary(DstListIn, ApproxMsgSize) of
  	[] ->
  	    logger:log(error, "sippipe: Failed starting sippipe, no valid destination(s) found"),
  	    transactionlayer:send_response_handler(ServerHandler, 500, "Failed resolving destination"),
  	    error;
  	[FirstDst | DstT] ->
  	    DstList = [FirstDst | DstT],
  	    NewRequest = Request#request{uri=FirstDst#sipdst.uri},
  	    case transactionlayer:start_client_transaction(NewRequest, none, FirstDst, Branch, Timeout, self()) of
  		BranchPid when pid(BranchPid) ->
  		    final_start(Branch, ServerHandler, BranchPid, Request, DstList, Timeout, ApproxMsgSize);
  		{error, E} ->
  		    logger:log(error, "sippipe: Failed starting client transaction : ~p", [E]),
  
negative.code: %%              client transaction and then enter loop/1.
  %% Returns: Does not matter
  %%--------------------------------------------------------------------
  start(ServerHandler, ClientPid, Request, Dst, Timeout) when is_record(Request, request) ->
      case catch guarded_start(ServerHandler, ClientPid, Request, Dst, Timeout) of
  	{'EXIT', Reason} ->
  	    logger:log(error, "=ERROR REPORT==== from sippipe :~n~p", [Reason]),
  	    transactionlayer:send_response_handler(ServerHandler, 500, "Server Internal Error"),
  