anchor.diff:              resolve_dest_a(Host, Dest); % Port is specified, make AAAA or A query
          true ->
              % otherwise, make SRV query
  -           Domain = service_proto(Transport, TLS) ++ Host,
  -           Dest = #sip_destination{transport = Transport, params = Params},
  -           resolve_dest_srv(Host, Domain, Dest)
  +           resolve_dest_srv(Service, Transport, Host)
       end.
   
  -%% @doc Determine Port and IP address by SRV queries
  -%% @end
  -resolve_dest_srv(Target, Domain, Dest) ->
  +%% @doc Determine Port and IP address by SRV queries, RFC 2782
  +%% @end
  +resolve_dest_srv(Service, Protocol, Target) ->
  +    SRV = srv_prefix(Service, Protocol) ++ Target,
  +    resolve_dest_srv(Service, Protocol, Target, SRV).
  +
  +resolve_dest_srv(Service, Protocol, Target, Domain) ->
  +    Params = if Service =:= sips -> [tls]; true -> [] end,
  +    Dest = #sip_destination{transport = Protocol, params = Params},
       case lookup_srv(Domain) of
           [] ->
               % FIXME: hard-coded default port
  
positive.code: -spec server_resolve(#sip_hdr_via{}) -> [#sip_destination{}].
  server_resolve(Via) when is_record(Via, sip_hdr_via) ->
      case Via#sip_hdr_via.transport of
          tls -> Transport = tcp, Params = [tls], TLS = true;
          Transport -> Params = [], TLS = false
      end,
      Host = Via#sip_hdr_via.host,
      Port = Via#sip_hdr_via.port,
  
negative.code:     {ok, Addrs} = inet:getaddrs(Host, inet), % FIXME: ipv6
      [Destination#sip_destination{address = Addr} || Addr <- Addrs].
  
  %% @doc Determine SRV domain prefix based on pair of service and transport
  %% @end
  srv_prefix(sip, udp) -> "_sip._udp.";
  srv_prefix(sip, tcp) -> "_sip._tcp.";
  srv_prefix(sip, sctp) -> "_sip._sctp.";
  srv_prefix(sips, tcp) -> "_sips._tcp.";
  srv_prefix(sips, sctp) -> "_sips._sctp.".
  