anchor.diff:  		 end,
       Socket = State#state.socket,
       Dst = State#state.dst,
  -    %% Must use branch from response (really from original request sent out, but that
  -    %% should be what is in the response) to make sure we get the exact same branch in this ACK.
  -    TopVia = sipheader:topvia(RHeader),
  -    Branch = sipheader:get_via_branch_full(TopVia),
  +    %% 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,
       ACKRequest = {"ACK", URI, SendHeader, ""},
       transportlayer:send_proxy_request(Socket, ACKRequest, URI, ["branch=" ++ Branch, {dst, Dst}]),
       ok.
  
positive.code:     NewState = add_timer(64 * T1, "quit after CANCEL", {terminate_transaction}, State),
      Socket = State#state.socket,
      Dst = State#state.dst,
      Branch = State#state.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) ->
  
negative.code: %%          {noreply, State, Timeout} |
  %%          {stop, Reason, State}            (terminate/2 is called)
  %%--------------------------------------------------------------------
  handle_cast({sipmessage, Response, Origin, LogStr}, State) when record(Response, response), record(Origin, siporigin) ->
      %% We have received a response to one of our requests.
      LogTag = State#state.logtag,
      CompatResponse = {Response#response.status, Response#response.reason, Response#response.header, Response#response.body},
      LogLevel = if
  		   Response#response.status >= 200 -> normal;
  		   true -> debug
  	       end,
      logger:log(LogLevel, "~s: Received response ~p ~s", [LogTag, Response#response.status, Response#response.reason]),
      NewState = process_received_response(CompatResponse, State),
      check_quit({noreply, NewState});
  
  handle_cast({cancel, Msg}, State) ->
  