anchor.diff:      yxa_test_config:set(remote_party_id, false),
       ACI_Header5 = keylist:from_list([]),
       ACI_Header5_Res = add_caller_identity(pstn, "INVITE", ACI_Header5, ACI_Dst1, ACI_Ctx4),
  -    
  +
       autotest:mark(?LINE, "add_caller_identity/5 - pstn 5.2"),
       %% verify
       [] = keylist:fetch("Remote-Party-Id", ACI_Header5_Res),
  
positive.code: 		       "(stale auth)", [YxaCtx#yxa_ctx.app_logtag, Method, User, DstNumber, DstClass]),
  	    true;
  	IsStale ->
  	    logger:log(normal, "~s: pstnproxy: Disallowing ~s request from user ~p to number ~s, class '~p' "
  		       "(stale auth)", [YxaCtx#yxa_ctx.app_logtag, Method, User, DstNumber, DstClass]),
  	    transactionlayer:send_challenge(YxaCtx#yxa_ctx.thandler, proxy, _Stale = true, _RetryAfter = none),
  	    false;
  
negative.code: 	    error -> PstnCtx#pstn_ctx.called_number;
  	    N when is_list(N) -> N
  	end,
      Class =
  	case DstNumber of
  	    undefined ->
  		undefined;
  	    _ ->
  		{ok, Classdefs} = yxa_config:get_env(classdefs),
  		{ok, Class1} = sipauth:classify_number(DstNumber, Classdefs),
  		Class1
  	end,
      {ok, UnauthClasses} = yxa_config:get_env(sipauth_unauth_classlist),
      User = PstnCtx#pstn_ctx.user,
      PstnCtx1 =
  	PstnCtx#pstn_ctx{dst_number = DstNumber,
  			 dst_class  = Class
  			},
  
      case DstNumber of
  	undefined ->
  	    case Request#request.method of
                  "BYE" ->
                      logger:log(debug, "~s: pstnproxy: Allowing BYE request to PSTN GW without trying to "
  			       "determine PSTN number destination", [YxaCtx#yxa_ctx.app_logtag]),
  		    %% BYEs from IP to PSTN are sent to the Contact used by the gateway. The Contact may
  		    %% include the PSTN number, or it may not - it depends completely on the gateway.
  		    %% Better not make any assumptions. XXX check that there is a to-tag too?
  		    {ok, true, PstnCtx1};
  		_ ->
  		    logger:log(debug, "~s: pstnproxy: Disallowing non-BYE request to PSTN gateway because "
  			       "no PSTN number destination could be determined", [YxaCtx#yxa_ctx.app_logtag]),
  		    transactionlayer:send_response_handler(YxaCtx#yxa_ctx.thandler, 403, "Forbidden", []),
  		    {ok, false, PstnCtx1}
  	    end;
  	_ when is_list(DstNumber) ->
  	    case lists:member(Class, UnauthClasses) of
  		true ->
  		    logger:log(normal, "~s: pstnproxy: Allowing request from user ~p to number available to anyone "
  			       "(~s, class '~p')", [YxaCtx#yxa_ctx.app_logtag, User, DstNumber, Class]),
  		    {ok, true, PstnCtx1};
  		false when is_list(User) ->
  		    case local:is_allowed_pstn_dst(User, DstNumber, Request#request.header, Class) of
  			true ->
  			    %% Ok, now just check that the authorization isn't stale (or is allowed to be stale)
  			    Verdict = check_auth_for_allowed_pstn_dst(Request, YxaCtx, PstnCtx1),
  			    {ok, Verdict, PstnCtx1};
  			false ->
  			    logger:log(normal, "~s: pstnproxy: User ~p NOT allowed request to number ~s, class '~p'",
  				       [YxaCtx#yxa_ctx.app_logtag, User, DstNumber, Class]),
  			    transactionlayer:send_response_handler(YxaCtx#yxa_ctx.thandler, 403, "Forbidden", []),
  			    {ok, false, PstnCtx1}
  		    end;
  		false when User == undefined ->
  		    Verdict = check_unauth_request_to_pstn_dst(Request, YxaCtx, PstnCtx1),
  		    {ok, Verdict, PstnCtx1}
  	    end
      end.
  
  
  %% part of authorize_user_call_to_pstn/3
  %% Returns: true | false
  