anchor.diff:      %% Check if Number is all digits
       case util:isnumeric(Number) of
   	true ->
  -	    %% Try to rewrite Number using configured regexp 'number_to_pstn'
  -	    case util:regexp_rewrite(Number, sipserver:get_env(number_to_pstn, [])) of
  -		[] ->
  -		    logger:log(error, "Lookup: Failed rewriting number ~p using regexp 'number_to_pstn'",
  -			       [Number]),
  -		    error;
  -		Res when is_list(Res) ->
  -		    %% Check to see if what we got is a parseable URL
  -		    case sipurl:parse_url_with_default_protocol("sip", Res) of
  -			URL when is_record(URL, sipurl) ->
  -			    %% Check if it is a local URL or a remote
  -			    case homedomain(URL#sipurl.host) of
  -				true ->
  -				    {proxy, URL};
  -				_ ->
  -				    {relay, URL}
  -			    end;
  -			_ ->
  -			    logger:log(error, "Lookup: Rewrite of number ~p did not result in a parseable URL : ~p",
  -				       [Number, Res]),
  -			    error
  -		    end;
  -		nomatch ->
  -		    %% Regexp did not match
  -		    none
  -	    end;
  -	_ ->
  +	    Regexps = sipserver:get_env(number_to_pstn, []),
  +	    lookupnumber2(Number, Regexps);
  +	false ->
   	    %% Number was not numeric
   	    error
       end.
   
  +%% part of lookupnumber/1
  +lookupnumber2(Number, Regexps) when is_list(Number), is_list(Regexps) ->
  +    %% Try to rewrite Number using configured regexp 'number_to_pstn'
  +    case util:regexp_rewrite(Number, Regexps) of
  +	Res when is_list(Res) ->
  +	    %% Check to see if what we got is a parseable URL
  +	    case sipurl:parse_url_with_default_protocol("sip", Res) of
  +		URL when is_record(URL, sipurl) ->
  +		    %% Check if it is a local URL or a remote
  +		    case homedomain(URL#sipurl.host) of
  +			true ->
  +			    {proxy, URL};
  +			false ->
  +			    {relay, URL}
  +		    end;
  +		_ ->
  +		    logger:log(error, "Lookup: Rewrite of number ~p using 'number_to_pstn' did not "
  +			       "result in a parseable URL : ~p", [Number, Res]),
  +		    error
  +	    end;
  +	nomatch ->
  +	    %% Regexp did not match
  +	    none
  +    end.
  +    
   %%--------------------------------------------------------------------
   %% Function: rewrite_potn_to_e164(Number)
   %%           Number = string()
  
positive.code: %%           none
  %%           URL = sipurl record()
  %%--------------------------------------------------------------------
  lookupregexproute(Input) ->
      Routes = database_regexproute:list(),
      Sortedroutes = lists:sort(fun (Elem1, Elem2) ->
  				      Prio1 = lists:keysearch(priority, 1, Elem1#regexproute.flags),
  				      Prio2 = lists:keysearch(priority, 1, Elem2#regexproute.flags),
  
negative.code: 	_ ->
  	    error
      end;
  rewrite_potn_to_e164(_Unknown) ->
      error.
  
  %%--------------------------------------------------------------------
  