anchor.diff:      end.
   
   route_matches_me(Route) ->
  -    {_, {_, _, Host, Port, _}} = Route,
  -    MyName = myhostname(),
  -    MyIP = siphost:myip(),
  +    {_, {_, _, Host, RoutePort, _}} = Route,
  +    Port = default_port(RoutePort),
  +    HostnameList = lists:append(sipserver:get_env(myhostnames, []), [siphost:myip()]),
  +    HostnameIsMyHostname = util:casegrep(Host, HostnameList),
       MyPort = default_port(sipserver:get_env(listenport, none)),
       if
   	Port /= MyPort -> false;
  -	Host /= MyName ->
  -	    if
  -		Host == MyIP -> true;
  -		true -> false
  -	    end;
  +	HostnameIsMyHostname /= true -> false;
   	true ->	true
       end.	   
   
  
positive.code: locations_to_contacts([]) ->
      [];
  locations_to_contacts([{Location, Flags, Class, Expire} | Rest]) ->
      lists:append([print_contact(Location, Expire)], locations_to_contacts(Rest)).
  
  print_contact(Location, Expire) ->
      % make sure we don't end up with a negative Expires
      NewExpire = lists:max([0, Expire - util:timestamp()]),
      [C] = sipheader:contact_print([{none, Location}]),
      C ++ ";expires=" ++ integer_to_list(NewExpire).
  
  process_register_wildcard_isauth(Header, Socket, Phone, Auxphones, Contacts) ->
      case is_valid_wildcard_request(Header, Contacts) of
  
negative.code: 	{error, What} ->
  	    {error, What};
  	{Host, Port} ->
  	%    InPortInt = list_to_integer(default_port(InPort)),
  	%    if
  	%	Port /= InPortInt ->
  	%	    logger:log(debug, "Warning: When looking up ~p in DNS, port ~p became port ~p",
  	%	    		[InHost, InPortInt, Port]);		
  	%	true -> true
  	%    end,
  	    UsePort = case InPort of
  		none ->
  		    integer_to_list(Port);
  		PortInt when integer(InPort) ->
  		    integer_to_list(InPort);
  		PortStr when list(InPort) ->
  		    InPort
  	    end,
  	    DNSPortList = integer_to_list(Port),
  	    if
  		UsePort /= DNSPortList ->
  		    logger:log(debug, "Warning: ~p is specified to use port ~s in DNS, but I'm going to use the supplied port ~s instead",
  		    		[InHost, DNSPortList, UsePort]);		
  		true -> true
  	    end,
  	    dnsutil:get_ip_port(Host, UsePort);
  	none ->
  	    dnsutil:get_ip_port(InHost, default_port(InPort))
      end.
  