anchor.diff:      logger:log(debug, "~s: Marked transaction as cancelled", [LogTag]),
       case Method of
   	"INVITE" ->
  -	    SipState = NewState1#state.sipstate,
  -	    case SipState of
  +	    case NewState1#state.sipstate of
   		calling ->
  -		    logger:log(debug, "~s: Stopping resend of INVITE ~s, but NOT starting CANCEL client transaction " ++
  +		    logger:log(debug, "~s: Stopping resend of INVITE ~s, but NOT starting CANCEL client transaction "
   			       "right now since we are in state 'calling'", [LogTag, sipurl:print(URI)]),
  -		    NewState2 = stop_resendrequest_timer(NewState1),
  -		    NewState3 = NewState2#state{do_cancel={true, ExtraHeaders}},
  +		    NewState2 = NewState1#state{do_cancel={true, ExtraHeaders}},
  +		    NewState3 = stop_resendrequest_timer(NewState2),
   		    NewState3;
   		proceeding ->
   		    logger:log(debug, "~s: Stopping resends of INVITE ~s and starting a CANCEL client transaction",
  
positive.code:     {Method, URI} = {Request#request.method, Request#request.uri},
      case Method of
  	"INVITE" ->
  	    LogTag = State#state.logtag,
  	    Response = State#state.response,
  	    {Status, Reason} = {Response#response.status, Response#response.reason},
  	    case State#state.do_cancel of
  		{true, ExtraHeaders} ->
  		    logger:log(debug, "~s: A previously cancelled transaction (INVITE ~s) "
  			       "entered state 'proceeding' upon receiving a '~p ~s' response. "
  			       "CANCEL ourselves!", [LogTag, sipurl:print(URI), Status, Reason]),
  		    NewState1 = State#state{do_cancel=false},
  		    NewState2 = cancel_request(NewState1, ExtraHeaders),
  		    {NewState2, ignore};
  
negative.code: %%--------------------------------------------------------------------
  %% Function: stop_resendrequest_timer(State)
  %%           State = state record()
  %% Descrip.: Locate and stop any {resendrequest} (and possibly
  %%           {resendrequest_timeout}) siptimers.
  %% Returns : NewState = state record()
  %%--------------------------------------------------------------------
  stop_resendrequest_timer(State) when is_record(State, state) ->
      Request = State#state.request,
      Method = Request#request.method,
      NTList1 = siptimer:cancel_timers_with_appsignal({resendrequest}, State#state.timerlist),
  
      %% If it is an INVITE and we are not waiting to send out a CANCEL, we stop
      %% the resendrequest_timeout as well since an INVITE has {invite_expire} (Timer C)
      %% that takes care of ending it if nothing more is received.
      Cancelling = case State#state.do_cancel of
  		     {true, _EH} -> true;
  		     false -> false
  		 end,
      NTList2 = case {Method, Cancelling} of
  		  {"INVITE", false} ->
  		      siptimer:cancel_timers_with_appsignal({resendrequest_timeout}, NTList1);
  		  _ ->
  		      NTList1
  	      end,
  
      NewState = State#state{timerlist=NTList2},
      NewState.
  
  