anchor.diff:  	    Address = sipurl:print(URL),
   	    case local:get_user_with_address(Address) of
   		nomatch ->
  -		    logger:log(debug, "Auth: Address ~p does not match any of my users, no need to verify.", 
  +		    logger:log(debug, "Auth: Address ~p does not match any of my users, no need to verify.",
   			       [Address]),
   		    {true, unknown, Class};
  -		User when list(User) ->
  +		User when is_list(User) ->
   		    Allowed = local:can_use_address(User, URL),
  -		    {Allowed, User, Class};
  -		Unknown ->
  -		    logger:log(error, "Auth: Unknown result returned from get_user_for_address(~p) : ~p",
  -			       [Address, Unknown]),
  -		    {false, unknown, Class}
  +		    {Allowed, User, Class}
   	    end;
  -	_ ->
  -	    case get_user_verified_proxy(Header, Method) of
  +	false ->
  +	    case pstn_get_user_verified(Header, Method) of
   		false ->
   		    {false, none, Class};
  -		stale ->
  -		    {stale, none, Class};
  +		{stale, User} ->
  +		    {stale, User, Class};
  +		{peer_authenticated, User} ->
  +		    %% For Peer-authenticated User, we don't check to see if User might use From: address or not
  +		    case local:is_allowed_pstn_dst(User, ToNumber, Header, Class) of
  +			true ->
  +			    {true, User, Class};
  +			false ->
  +			    {false, User, Class}
  +		    end;
   		{authenticated, User} ->
   		    UserAllowedToUseAddress = local:can_use_address(User, URL),
   		    AllowedCallToNumber = local:is_allowed_pstn_dst(User, ToNumber, Header, Class),
  
positive.code: 			    {false, User, Class};
  			true ->
  			    {true, User, Class}
  		    end;
  		Unknown ->
  		    logger:log(error, "Auth: Unknown result from get_user_verified_proxy: ~p", [Unknown]),
  		    {false, none, Class}
  	    end
      end.
  
  
negative.code: %% Descrip.: Authenticate a request.
  %% Returns : {authenticated, User} |
  %%           {stale, User}         |
  %%           false                 |
  %%           throw({siperror, ...})
  %%--------------------------------------------------------------------
  get_user_verified2(Method, Authheader, Header) ->
      Authorization = sipheader:auth(Authheader),
      %% Remember the username the client used
      OrigUser = dict:fetch("username", Authorization),
      %% Canonify username
      User = case local:canonify_authusername(OrigUser, Header) of
  	       undefined ->
  		   OrigUser;
  	       Res when is_list(Res) ->
  		   Res
  	   end,
      Password = case local:get_password_for_user(User) of
  		   nomatch ->
  		       nomatch;
  		   PRes when is_list(PRes) ->
  		       PRes
  	       end,
      Realm = realm(),
      Now = util:timestamp(),
      do_get_user_verified2(Method, User, OrigUser, Password, Realm, Now, Authorization).
  
  %% do_get_user_verified2/7 - part of get_user_verified2/3 in order to make it testable
  do_get_user_verified2(Method, User, OrigUser, Password, Realm, Now, AuthDict) ->
      Opaque = case dict:find("opaque", AuthDict) of
  		 error ->
  		     throw({siperror, 400, "Authorization should contain opaque"});
  		 {ok, Value} ->
  		     Value
  	     end,
      AuthURI = dict:fetch("uri", AuthDict),
      Response = dict:fetch("response", AuthDict),
      Nonce2 = get_nonce(Opaque),
      Nonce = dict:fetch("nonce", AuthDict),
  
      Timestamp = hex:from(Opaque),
      logger:log(debug, "Auth: timestamp: ~p now: ~p", [Timestamp, Now]),
      Response2 = get_response(Nonce2, Method, AuthURI,
  			     OrigUser, Password, Realm),
      if
  	Password == nomatch ->
  	    logger:log(normal, "Auth: Authentication failed for non-existing user ~p", [User]),
  	    false;
  	Response /= Response2 ->
  	    logger:log(debug, "Response ~p /= Response2 ~p", [Response, Response2]),
  	    logger:log(normal, "Auth: Authentication failed for user ~p", [User]),
  	    false;
  	Nonce /= Nonce2 ->
  	    logger:log(normal, "Auth: Nonce ~p /= ~p, authentication failed for user ~p", [Nonce, Nonce2, User]),
  	    false;
  	Timestamp < Now - 30 ->
  	    logger:log(normal, "Auth: Timestamp ~p too old. Now: ~p, authentication failed for user ~p",
  		       [Timestamp, Now, User]),
  