anchor.diff:      Sorted = lists:sort(fun sortsrv/2, This),
       naptr_to_srvlist2(Domain, Rest, lists:flatten([Res, Sorted])).
   
  -
  -%%--------------------------------------------------------------------
  -%% Function: combine_srvresults/1
  -%% Description: Walk through a list of srventry records or {error, R}
  -%%              tuples and turn the srventry records into
  -%%              {Proto, Host, Port} tuples.
  -%% Returns: ProtoHostPortList
  -%%--------------------------------------------------------------------
  -combine_srvresults(List) ->
  -    combine_srvresults(List, [], []).
  +debugfriendly_srventry(In) when is_list(In) ->
  +    debugfriendly_srventry2(In, []).
  +
  +debugfriendly_srventry2([], Res) ->
  +    lists:reverse(Res);
  +debugfriendly_srventry2([H|T], Res) when is_record(H, srventry) ->
  +    {P, W, Port, Host} = H#srventry.dnsrrdata,
  +    This = lists:flatten(lists:concat([H#srventry.proto, ", priority=", P, ", weight=", W,
  +				       " ", Host, ":", Port])),
  +    debugfriendly_srventry2(T, [This | Res]).
  +
  +%%--------------------------------------------------------------------
  +%% Function: combine_srvresults(In)
  +%%           In = list() of srventry record() | {error, R} tuples
  +%% Descrip.: Walk through a list of srventry records or {error, R}
  +%%           tuples and turn the srventry records into
  +%%           {Proto, Host, Port} tuples.
  +%% Returns : ProtoHostPortList
  +%%           ProtoHostPortList = list() of {Proto, Host, Port}
  +%%           Proto = tcp | udp | tls
  +%%           Host  = string()
  +%%           Port  = integer()
  +%%--------------------------------------------------------------------
  +combine_srvresults(In) ->
  +    combine_srvresults(In, [], []).
   
   combine_srvresults([], [], Errors) ->
       Errors;
  
positive.code: 		       "compatible lookup for SIP SRV records under that domain name", [Domain]),
  	    TCP = srvlookup(tcp, "_sip._tcp." ++ Domain),
  	    UDP = srvlookup(udp, "_sip._udp." ++ Domain),
  	    combine_srvresults(lists:sort(fun sortsrv/2, lists:flatten([TCP, UDP])));
  	Res ->
  	    %% siplookup_naptr does it's own sorting
  	    combine_srvresults(Res)
  
negative.code: 
  %%--------------------------------------------------------------------
  %% Function: siplookup_naptr/1
  %% Descrip.: Take a list of sorted NAPTR records and try to turn
  %%           them into SRV records.
  %% Returns : SRVList |
  %%           nomatch
  %%--------------------------------------------------------------------
  naptr_to_srvlist(Domain, In) ->
      naptr_to_srvlist2(Domain, In, []).
  
  naptr_to_srvlist2(Domain, [], Res) ->
      logger:log(debug, "dns resolver: Domain ~p NAPTR (+SRV) lookup result :~n~p",
  	       [Domain, debugfriendly_srventry(Res)]),
      Res;
  naptr_to_srvlist2(Domain, [H | Rest], Res) when record(H, naptrrecord) ->
      Proto = case H#naptrrecord.services of
  