anchor.diff:      {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",
  +    logger:log(debug, "Appserver glue: Forwarding response '~p ~s' to '~s ~s' to CallHandler ~p",
   	       [Status, Reason, Method, sipurl:print(URI), CallHandler]),
  -    transactionlayer:send_proxy_response_handler(CallHandler, Response),
  +    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};
  
positive.code: 						      {Status, Reason} ->
  							  logger:log(debug, "Appserver glue: received sipproxy_all_terminated - asking CallHandler ~p " ++
  								     "to answer ~p ~s", [CallHandler, Status, Reason]),
  							  transactionlayer:send_response_handler(CallHandler, Status, Reason),
  							  %% XXX check that this is really a final response?
  							  State#state{completed=true};
  						      none ->
  
negative.code: 	    process_messages(NewState)
      end.
  
  safe_callhandler_send_response(none, Status, Reason) ->
      logger:log(error, "Appserver glue: CallHandler is gone, can't ask it to send '~p ~s' response", [Status, Reason]),
      error;
  safe_callhandler_send_response(TH, Status, Reason) ->
      %% XXX do catch here since we are supposed to be safe?
      transactionlayer:send_response_handler(TH, Status, Reason).
  
  %%
  %% Method is INVITE and we are already completed
  %%
  