anchor.diff:  %%--------------------------------------------------------------------
   handle_info({sipproxy_response, FromPid, _Branch, Response}, #state{forkpid=FromPid}=State)
     when is_record(Response, response), is_pid(FromPid) ->
  -    NewState1 =
  -	case State#state.callhandler of
  -	    none ->
  -		{Status, Reason} = {Response#response.status, Response#response.reason},
  -		logger:log(error, "Appserver glue: Received a response (~p ~s) that I can't forward "
  -			   "since CallHandler is 'none'", [Status, Reason]),
  -		State;
  -	    _ ->
  -		handle_sipproxy_response(Response, State)
  -	end,
  -    check_quit({noreply, NewState1, ?TIMEOUT});
  +    NewState = handle_sipproxy_response(Response, State),
  +    check_quit({noreply, NewState, ?TIMEOUT});
   
   %%--------------------------------------------------------------------
   %% Function: handle_info({sipproxy_all_terminated, FromPid,
  
positive.code: %%           process and figure out what to do with it. See if we
  %%           should send it on to our parent and record if this was a
  %%           final response (set State#state.completed=true if so).
  %% Returns : NewState = state record()
  %%--------------------------------------------------------------------
  %%
  %% Method is INVITE and we are already completed
  %%
  handle_sipproxy_response(Response, #state{sipmethod="INVITE", completed=true}=State) when record(Response, response) ->
      Request = State#state.request,
      URI = Request#request.uri,
      {Status, Reason} = {Response#response.status, Response#response.reason},
      if
  	Status >= 200, Status =< 299 ->
  	    %% XXX change to debug level
  	    logger:log(normal, "Appserver glue: Forwarding 'late' 2xx response, ~p ~s to INVITE ~s statelessly",
  		       [Status, Reason, sipurl:print(URI)]),
  	    transportlayer:send_proxy_response(none, Response);
  	true ->
  	    logger:log(error, "Appserver glue: NOT forwarding non-2xx response ~p ~s to INVITE ~s - " ++
  		       "a final response has already been forwarded (sipproxy should not do this!)",
  		       [Status, Reason, sipurl:print(URI)])
      end,
      State;
  %%
  %% Method is non-INVITE and we are already completed
  %%
  handle_sipproxy_response(Response, #state{completed=true}=State) when record(Response, response) ->
      Request = State#state.request,
      {Method, URI} = {Request#request.method, Request#request.uri},
      {Status, Reason} = {Response#response.status, Response#response.reason},
      logger:log(error, "Appserver glue: NOT forwarding response ~p ~s to non-INVITE request ~s ~s - " ++
  	       "a final response has already been forwarded (sipproxy should not do this!)",
  	       [Status, Reason, Method, sipurl:print(URI)]),
      State;
  %%
  %% We are not yet completed
  %%
  handle_sipproxy_response(Response, State) when record(Response, response), record(State, state) ->
      Request = State#state.request,
      {Method, URI} = {Request#request.method, Request#request.uri},
      {Status, Reason} = {Response#response.status, Response#response.reason},
      CallHandler = State#state.callhandler,
      logger:log(debug, "Appserver glue: Forwarding response '~p ~s' to '~s ~s' to CallHandler ~p",
  	       [Status, Reason, Method, sipurl:print(URI), CallHandler]),
      case transactionlayer:is_good_transaction(CallHandler) of
  	true ->
  	    transactionlayer:send_proxy_response_handler(CallHandler, Response);
  	false ->
  	    logger:log(error, "Appserver glue: Can't forward response '~p ~s' to bad CallHandler '~p'",
  		       [Status, Reason, CallHandler])
      end,
      if
  	Status >= 200 ->
  	    State#state{completed=true};
  	true ->
  	    State
      end.
  
  %%--------------------------------------------------------------------
  %% Function: garbage_collect_pid(Descr, Pid)
  %%           Descr = string(), only used in logging
  %%           Pid   = pid() | none
  %% Descrip.: Check if a process is still alive, return 'none' if it
  %%           isn't.
  %% Returns : Pid | none
  %%           Pid = pid(), same as input Pid
  %%--------------------------------------------------------------------
  garbage_collect_pid(_Descr, none) ->
      none;
  garbage_collect_pid(Descr, Pid) when is_pid(Pid) ->
      case util:safe_is_process_alive(Pid) of
  	{true, _}  ->
  	    Pid;
  	_ ->
  	    logger:log(error, "Appserver glue: ~s ~p is not alive, garbage collected.",
  		       [Descr, Pid]),
  	    none
      end.
  
  %%--------------------------------------------------------------------
  %% Function: garbage_collect_transaction(Descr, TH)
  %%           Descr = string(), only used in logging
  %%           TH    = term() (thandler record())
  %% Descrip.: Check if a transaction handle still refers to an alive
  %%           transaction handler process.
  %% Returns : Pid | none
  %%           Pid = pid(), same as input Pid
  %%--------------------------------------------------------------------
  garbage_collect_transaction(Descr, TH) ->
      case transactionlayer:is_good_transaction(TH) of
  	true ->
  	    TH;
  	_ ->
  	    logger:log(error, "Appserver glue: ~s transaction is not alive, garbage collected.",
  		       [Descr]),
  	    none
      end.
  
negative.code: %%====================================================================
  
  %%--------------------------------------------------------------------
  %% Function: start_link(Request, Actions)
  %%           Request = request record()
  %%           Actions = list() of sipproxy_action record()
  %% Descrip.: start this appserver_glue gen_server.
  %% Returns : gen_server:start_link/4
  %%--------------------------------------------------------------------
  start_link(Request, Actions) when is_record(Request, request), is_list(Actions) ->
      gen_server:start_link(?MODULE, [Request, Actions], []).
  
  start_link_cpl(Parent, BranchBase, CallHandler, Request, Actions) when is_pid(Parent), is_list(BranchBase),
  								       is_record(Request, request), is_list(Actions) ->
      gen_server:start_link(?MODULE, [cpl, Parent, BranchBase, CallHandler, Request, Actions], []).
  
  
  %%====================================================================
  %% Server functions
  