anchor.diff:  		"+" ++ E164 ->
   		    rewrite_potn_to_e164("+" ++ E164);
   		_ ->
  -		    none
  +		    error
   	    end;
   	_ ->
  -	    none
  +	    error
       end;
   rewrite_potn_to_e164(_) ->
  -    none.
  +    error.
   
   isours(URL) ->
       case local:get_users_for_url(URL) of
  
positive.code: 	    case DefaultRoute of
  		none ->
  		    logger:log(debug, "Lookup: No default route - dropping request"),
  		    {response, 500, "Can't route request"};	% XXX rtt error-code?
  		Hostname ->
  		    {Host, Port} = sipurl:parse_hostport(Hostname),
  		    NewURI = {User, none, Host, Port, []},
  		    logger:log(debug, "Lookup: Default-routing to ~s", [sipurl:print(NewURI)]),
  		    % XXX we should preserve the Request-URI by proxying this as a loose router.
  		    % It is almost useless to only preserve the User-info IMO. We can do this
  		    % by returning {forward, Host, Port} instead.
  		    {proxy, NewURI}
  	    end
      end.
  
  lookuppotn("+" ++ E164) ->
      Loc1 = case util:isnumeric(E164) of
  	true ->
  	    Res1 = lookupenum("+" ++ E164),
      	    logger:log(debug, "Lookup: ENUM lookup on ~s -> ~p", ["+" ++ E164, Res1]),
  	    case Res1 of
  	    	none ->
      		    Res2 = lookuppstn("+" ++ E164),
      		    logger:log(debug, "Lookup: PSTN lookup on ~s -> ~p", ["+" ++ E164, Res2]),
  	    	    Res2;
      		Res1 ->
  		    Res1
  	    end;
  	_ ->
  	    none
      end;
  lookuppotn(Number) ->
      Res = rewrite_potn_to_e164(Number),
      case Res of
          none ->
              none;
          "+" ++ E164 ->
  	    lookuppotn("+" ++ E164);
  	_ ->
  	    none
      end.	    
  
  
  lookupenum("+" ++ E164) ->
      case dnsutil:enumlookup("+" ++ E164) of
  	none ->
  
negative.code: 		    none;
  		Unknown ->
  		    logger:log(error, "Lookup: Unexpected results from local:get_telephonenumber_for_user() for user ~p in get_remote_party_number: ~p",
  			       [User, Unknown]),
  		    none
  	    end;
  	nomatch ->
  	    logger:log(debug, "Lookup: No user(s) match address ~p, can't get telephone number",
  		       [sipurl:print(URL)]),
  	    none;
  	[] ->
  	    logger:log(debug, "Lookup: No user(s) match address ~p, can't get telephone number",
  		       [sipurl:print(URL)]),
  	    none;
  	Users when list(Users) ->
  	    logger:log(debug, "Lookup: Multiple users match address ~p, can't get telephone number",
  		       [sipurl:print(URL)]),
  	    none;
  	Unknown ->
  	    logger:log(error, "Lookup: Unexpected results from local:get_users_for_url() for URL ~p in get_remote_party_number: ~p",
  		       [sipurl:print(URL), Unknown]),
  	    none
      end.
  
  format_number_for_remote_party_id(Number, ToURI, DstHost) ->
      case rewrite_potn_to_e164(Number) of
  	error ->
  	    none;
  	Res ->
  	    Res
      end.
  
  get_remote_party_name(Key, URI) when list(Key) ->
      case directory:lookup_tel2name(Key) of
  