anchor.diff:      NewState = add_timer(64 * T1, "quit after CANCEL", {terminate_transaction}, State),
       Socket = State#state.socket,
       Dst = State#state.dst,
  -    Branch = State#state.branch,
  +    %% Must use branch from original request sent out, so that next hop can match
  +    %% this ACK to the right transaction. tl_branch is not necessarily the same as branch
  +    %% since the transport layer can be configured to add a stateless loop cookie.
  +    Branch = State#state.tl_branch,
       %% XXX is the 32 * T1 correct for CANCEL?
       case transactionlayer:start_client_transaction(CancelRequest, Socket, Dst, Branch, 32 * T1, none) of
   	P when pid(P) ->
  
positive.code: %%          {noreply, State, Timeout} |
  %%          {stop, Reason, State}            (terminate/2 is called)
  %%--------------------------------------------------------------------
  handle_cast({sipmessage, response, Response, ResponseSocket, LogStr}, State) ->
      %% We have received a response to one of our requests.
      LogTag = State#state.logtag,
      {Status, Reason, _, _} = Response,
      LogLevel = if
  		   Status >= 200 -> normal;
  		   true -> debug
  	       end,
      logger:log(LogLevel, "~s: Received response ~p ~s", [LogTag, Status, Reason]),
      NewState = process_received_response(Response, State),
      check_quit({noreply, NewState});
  
  handle_cast({cancel, Msg}, State) ->
  
negative.code: %% gen_server callbacks
  -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]).
  
  -record(state, {branch, socket_in, logtag, socket, report_to, request, response, sipstate,
  	timerlist, dst, timeout, cancelled, do_cancel, tl_branch}).
  
  -include("sipsocket.hrl").
  -include("siprecords.hrl").
  
  %%====================================================================
  %% External functions
  