anchor.diff:  %%--------------------------------------------------------------------
   request_to_sip(Request, Origin, THandler) when is_record(Request, request), is_record(Origin, siporigin) ->
       {Method, URI} = {Request#request.method, Request#request.uri},
  -    NewLocation = case localhostname(URI#sipurl.host) of
  -		      true ->
  -			  %% Hostname matches me
  -			  User = URI#sipurl.user,
  -			  logger:log(debug, "pstnproxy: Performing ENUM lookup on ~p", [User]),
  -			  case local:lookupenum(User) of
  -			      {relay, Loc} ->
  -				  Loc;
  -			      _ ->
  -				  %% Parse configured sipproxy but exchange user with user from Request-URI
  -				  DefaultProxy = sipserver:get_env(sipproxy, none),
  -				  case sipurl:parse_url_with_default_protocol("sip", DefaultProxy) of
  -				      ProxyURL when is_record(ProxyURL, sipurl) ->
  -					  ProxyURL#sipurl{user=User, pass=none};
  -				      none ->
  -					  %% No ENUM and no SIP-proxy configured, return failure so
  -					  %% that the PBX on the other side of the gateway can try
  -					  %% PSTN or something
  -					  %%
  -					  %% XXX choose something else than 503 since some clients
  -					  %% probably mark this gateway as defunct for some time.
  -					  %% RFC3261 #16.7 :
  -					  %% In other words, forwarding a 503 means that the proxy knows it
  -					  %% cannot service any requests, not just the one for the Request-
  -					  %% URI in the request which generated the 503.
  -					  transactionlayer:send_response_handler(THandler, 503, "Service Unavailable"),
  -					  none
  -				  end
  -			  end;
  -		      _ ->
  -			  URI
  -		  end,
  -    case NewLocation of
  -	none ->
  -	    none;
  -	_ when is_record(NewLocation, sipurl) ->
  +    Dest = case localhostname(URI#sipurl.host) of
  +	       true ->
  +		   %% Hostname matches me
  +		   determine_sip_location(URI);
  +	       false ->
  +		   {proxy, URI}
  +	   end,
  +    case Dest of
  +	{proxy, NewURI} when is_record(NewURI, sipurl) ->
   	    NewHeader1 = case sipserver:get_env(record_route, true) of
   			     true -> siprequest:add_record_route(Request#request.header, Origin);
   			     false -> Request#request.header
  
positive.code: 	    {_, FromURI} = sipheader:from(NewHeader1),
  	    NewHeader = add_caller_identity_for_sip(Method, NewHeader1, FromURI),
  	    NewRequest = Request#request{header=NewHeader},
  	    proxy_request(THandler, NewRequest, NewLocation)
      end.
  
  
  %%--------------------------------------------------------------------
  %% Function: request_to_pstn(Request, Origin, THandler, LogTag)
  
negative.code:     case sipauth:pstn_call_check_auth(Method, Header, FromURI, DstNumber, Classdefs) of
  	{true, User, Class} ->
  	    logger:log(debug, "Auth: User ~p is allowed to call dst ~s (class ~s)", [User, DstNumber, Class]),
  	    logger:log(normal, "~s: pstnproxy: Relay ~s to PSTN ~s (authenticated, user ~p, class ~p) (~s)",
  		       [LogTag, Method, DstNumber, User, Class, sipurl:print(DstURI)]),
  	    sippipe:start(THandler, none, Request, DstURI, 900);
  	{stale, User, Class} ->
  	    logger:log(debug, "Auth: User ~p must authenticate (stale) for dst ~s (class ~s)", [User, DstNumber, Class]),
  