anchor.diff:  %%% Author  : Fredrik Thulin <ft@it.su.se>
   %%% Descrip.: A server transaction gen_server.
   %%%
  -%%% Created : 05 Feb 2004 by Fredrik Thulin <ft@lab08.lab.it.su.se>
  +%%% Created : 05 Feb 2004 by Fredrik Thulin <ft@it.su.se>
   %%%
   %%% Note    : Perhaps we should generate a 500 if we don't get adopted
   %%%           in a few seconds from when we start?
  
positive.code:     %% the original one. A resent request's URI should be byte-by-byte comparable to
      %% the original one, so in that case we don't use sipurl:url_is_equal().
      URIisEqual = sipurl:url_is_equal(OrigURI, URI),
      Reply = if
  		OrigMethod == "INVITE", Method == "ACK", URIisEqual == true ->
  		    %% Received an ACK with a Request-URI that matches our original one
  		    LogTag = State#state.logtag,
  		    %% gen_server:reply before processing
  		    gen_server:reply(From, {continue}),
  		    NewState1 = process_received_ack(State),
  		    {noreply, NewState1, ?TIMEOUT};
  		Method == OrigMethod, URI == OrigURI, CSeqNum == OrigCSeqNum ->
  		    %% This is a resent request, check if we have a response stored that we can resend
  		    case State#state.response of
  			Re when is_record(Re, response) ->
  			    {Status, Reason} = {Re#response.status, Re#response.reason},
  			    logger:log(normal, "~s: Received a retransmission of request (~s ~s), resending "
  				       "response '~p ~s'", [LogTag, Method, sipurl:print(URI), Status, Reason]),
  			    %% gen_server:reply before processing
  			    gen_server:reply(From, {continue}),
  			    transportlayer:send_proxy_response(State#state.socket, Re);
  			_ ->
  			    %% No response stored
  			    logger:log(normal, "~s: Received a retransmission of request (~s ~s) but I "
  				       "have no response to resend!", [LogTag, Method, sipurl:print(URI)]),
  			    gen_server:reply(From, {continue})
  		    end,
  		    {noreply, State, ?TIMEOUT};
  		true ->
  		    logger:log(normal, "~s: Server transaction: Received request is not particulary alike "
  			       "the first one (~p ~s ~s /= ~p ~s ~s). Dropping it on the floor.",
  			       [LogTag, CSeqNum, Method, sipurl:print(URI),
  				OrigCSeqNum, OrigMethod, sipurl:print(OrigURI)]),
  		    {reply, {continue}, State, ?TIMEOUT}
  	    end,
      check_quit(Reply);
  
  handle_call(Request, From, State) ->
      LogTag = State#state.logtag,
      logger:log(error, "~s: Received unknown gen_server call from ~p :~n~p",
  	       [LogTag, From, Request]),
      Reply = ok,
      check_quit({reply, Reply, State, ?TIMEOUT}, From).
  
  
  %%--------------------------------------------------------------------
  %% Function: handle_cast(Msg, State)
  %% Descrip.: Handling cast messages
  %% Returns : {noreply, State}          |
  %%           {noreply, State, Timeout} |
  %%           {stop, Reason, State}            (terminate/2 is called)
  %%--------------------------------------------------------------------
  
  %%--------------------------------------------------------------------
  %% Function: handle_cast({{create_response, Status, Reason,
  
negative.code: 		       [LogTag, siptimer:timeout2str(TimerJ)]),
  	    %% Install TimerJ (default 32 seconds) RFC 3261 17.2.2. Until TimerJ fires we
  	    %% resend our response whenever we receive a request resend.
  	    JDesc = "terminate server transaction " ++ ResponseToMethod ++ " " ++ sipurl:print(ResponseToURI) ++
  		" (Timer J)",
  	    add_timer(TimerJ, JDesc, {terminate_transaction}, NewState1)
      end;
  
  