anchor.diff:                     request           :: #sip_request{},                            % SIP request message
                      destinations = [] :: [#sip_destination{}],                      % list of IP addresses to try next
                      target_set        :: sip_priority_set:priority_set(#sip_uri{}), % URI to visit next (redirects)
  +                   cancelled = false :: boolean(),                                 % If request was cancelled. If 2xx will arrive, send BYE immediately.
                      callback          :: callback()}).                              % Callback to invoke on responses
   
  --record(state, {requests = [] :: [{reference(), #req_info{}}],            % Mapping from unique request id to state
  -                transactions = [] :: [{#sip_tx_client{}, reference()}]}). % Mapping transaction key to request id
  +%% Pending requests (that have not received final responses yet)
  +%% First element is unique request id (that does not change accross retries),
  +%% second element is current transaction that makes the request and third
  +%% element is information about the request
  +-record(state, {requests = [] :: [{reference(), #sip_tx_client{}, #req_info{}}]}).
   
   
   -type gen_from() :: {pid(), term()}.
  
positive.code:     {ok, TxKey} = sip_transaction:start_client_tx(self(), Top, Request2),
  
      % Update ref to request info & txkey to ref mappings
      Requests = lists:keystore(Ref, 1, State#state.requests, {Ref, ReqInfo2}),
      Transactions = lists:keystore(TxKey, 1, State#state.transactions, {TxKey, Ref}),
      State2 = State#state{requests = Requests, transactions = Transactions},
  
      % stop processing
      error_m:fail({processed, State2}).
  
negative.code:     {noreply, State2};
  
  handle_call({cancel, Ref}, _From, State) ->
      Entry = lists:keyfind(Ref, 1, State#state.requests),
      {Reply, State2} = do_cancel(Entry, State),
      {reply, Reply, State2};
  
  handle_call(Request, _From, State) ->
      {stop, {unexpected, Request}, State}.
  