anchor.diff:      answer_message(RC, Caps, Dict0, Pkt).
   
   %% msg_dict/3
  -
  -%% An incoming answer, not yet decoded.
  -msg_dict(AppDict, Dict0, #diameter_packet{header
  -                                      = #diameter_header{is_request = false,
  -                                                         is_error = E},
  -                                      msg = undefined}) ->
  -    if E -> Dict0; true -> AppDict end;
  -
  -msg_dict(AppDict, Dict0, [Msg]) ->
  -    msg_dict(AppDict, Dict0, Msg);
  -
  -msg_dict(AppDict, Dict0, #diameter_packet{msg = Msg}) ->
  +%%
  +%% Return the dictionary defining the message grammar in question: the
  +%% application dictionary or the common dictionary.
  +
  +msg_dict(AppDict, Dict0, [Msg])
  +  when is_list(Msg);
  +       is_tuple(Msg) ->
       msg_dict(AppDict, Dict0, Msg);
   
   msg_dict(AppDict, Dict0, Msg) ->
       choose(is_answer_message(Msg, Dict0), Dict0, AppDict).
   
  +%% Incoming, not yet decoded.
  +is_answer_message(#diameter_packet{header = #diameter_header{} = H,
  +                                   msg = undefined},
  +                  Dict0) ->
  +    is_answer_message([H], Dict0);
  +
  +is_answer_message(#diameter_packet{msg = Msg}, Dict0) ->
  +    is_answer_message(Msg, Dict0);
  +
  +%% Message sent as a header/avps list.
  +is_answer_message([#diameter_header{is_request = R, is_error = E} | _], _) ->
  +    E andalso not R;
  +
  +%% Message sent as a tagged avp/value list.
   is_answer_message([Name | _], _) ->
       Name == 'answer-message';
   
  +%% Message sent as a record.
   is_answer_message(Rec, Dict) ->
       try
           'answer-message' == Dict:rec2msg(element(1,Rec))
  
positive.code:     local(Ans, TPid, {MsgDict, AppDict, Dict0}, Fs, ReqPkt);
  
  %% ... or relayed.
  reply(#diameter_packet{} = Pkt, _TPid, _DictT, Fs, _ReqPkt) ->
      eval_packet(Pkt, Fs),
      Pkt.
  
  %% local/5
  %%
  
negative.code: 
  %% send_A/6
  
  send_A(T, TPid, {AppDict, Dict0} = DictT0, ReqPkt, EvalPktFs, EvalFs) ->
      {MsgDict, Pkt} = reply(T, TPid, DictT0, EvalPktFs, ReqPkt),
      incr(send, Pkt, TPid, AppDict),
      incr_rc(send, Pkt, TPid, {MsgDict, AppDict, Dict0}),  %% count outgoing
      send(TPid, Pkt),
      lists:foreach(fun diameter_lib:eval/1, EvalFs).
  
  %% answer/6
  