anchor.diff:  remove_non_sips_locations([#siplocationdb_e{address=URL}=H | T], Res)
     when is_record(URL, sipurl), URL#sipurl.proto == "sips" ->
       remove_non_sips_locations(T, [H | Res]);
  -remove_non_sips_locations([H | T], Res) when is_record(H, siplocationdb_e) ->
  -    remove_non_sips_locations(T, Res);
  +remove_non_sips_locations([#siplocationdb_e{address=URL}=H | T], Res) ->
  +    %% XXX do we need to lowercase what we get from url_param:find?
  +    case url_param:find(URL#sipurl.param_pairs, "transport") of
  +	["tls"] ->
  +	    %% Keep this location
  +	    remove_non_sips_locations(T, [H | Res]);
  +	_ ->
  +	    %% Not SIPS protocol or TLS transport parameter, remove this location from result
  +	    remove_non_sips_locations(T, Res)
  +    end;
   remove_non_sips_locations([], Res) ->
       lists:reverse(Res).
   
  
positive.code: 		URL when is_record(URL, sipurl), URL#sipurl.user == none, URL#sipurl.pass == none ->
  		    {forward, URL};
  		_ ->
  		    logger:log(error, "Failed parsing configured appserver ~p, responding '500 Server Internal Error'",
  			       [AppServer]),
  		    {response, 500, "Server Internal Error"}
  	    end
      end.
  
negative.code: %%           formatted differently, thus the DstHost parameter (a TSP
  %%           gateway to PSTN might only handle E.164 numbers, while a
  %%           PBX might be expecting only a 4-digit extension number).
  %% Returns : {ok, RPI, Number} |
  %%           none
  %%           RPI    = contact record()
  %%           Number = string()
  %%--------------------------------------------------------------------
  get_remote_party_number(User, _Header, URI, DstHost) when is_list(User), is_list(DstHost), is_record(URI, sipurl) ->
      case local:get_telephonenumber_for_user(User) of
  	Number when is_list(Number) ->
  	    {ok, FormattedNumber} = local:format_number_for_remote_party_id(Number, URI, DstHost),
  	    Parameters = [{"party", "calling"}, {"screen", "yes"}, {"privacy", "off"}],
  	    RPURI = sipurl:set([{user, FormattedNumber}, {pass, none}, {param, []}], URI),
  	    {ok, contact:new(none, RPURI, Parameters), FormattedNumber};
  	nomatch ->
  	    logger:log(debug, "Lookup: No telephone number found for user ~p", [User]),
  	    none
      end.
  
  %%--------------------------------------------------------------------
  %% Function: format_number_for_remote_party_id(Number, Header,
  %%                                             DstHost)
  %%           Number  = string(), the number to format
  %%           Header  = keylist record()
  %%           DstHost = term(), destination for request
  %% Descrip.: Hook for the actual formatting once
  %%           get_remote_party_number/2 has found a number to be
  %%           formatted. This default function simply tries to rewrite
  %%           the number to E.164. If one or more of your PSTN gateways
  %%           wants the Caller-ID information in any other format, then
  %%           override this function in local.erl.
  %% Returns : {ok, Number}
  %%           Number = string()
  %%--------------------------------------------------------------------
  format_number_for_remote_party_id(Number, _Header, _DstHost) when is_list(Number) ->
      case rewrite_potn_to_e164(Number) of
  	error ->
  	    none;
  	Res when is_list(Res) ->
  	    {ok, Res}
      end.
  
  