[sr-dev] LCR/CR and prefix mask (REGEX?)

Edson - Lists 4lists at gmail.com
Fri Jul 3 19:48:18 CEST 2009


Iñaki Baz Castillo escreveu:
> El Viernes, 3 de Julio de 2009, Edson - Lists escribió:
>> I looked around... CR uses the same approach that LCR on prefix
>> definitions (or, at least the README don't say/explain that it's
>> different). So I went to look on REGEX module...
>>
>> Iñaki, this module has Your signature... let me ask You what exactly are
>> this REGEX groups? Could I use something like:
> 
> If the module doc is not self explanatory I should improve it :)
> 
> 
>>   - Use RURI and recover associated "REGEX-group number";
> 
> No, it's not the purpose. It let you matching a pv against any regular 
> expression in the group number passed as second parameter.
> 
> However you could get the desired behaviour as follows:
> 
> 
> ---- regex file ------------------------------
> ### National fixed numbers in Spain
> [0]
> ^[89]\d{8}$
> ^(\+|00)34[89]\d{8}$
> 
> ### National mobile numbers in Spain
> [0]
> ^6\d{8}$
> ^(\+|00)346\d{8}$
> 
> ### International numbers
> [0]
> ^(\+|00)\d{8,}$
> -------------------------------------------
> 
> 
> Config file:
> 
> -----------------------------------------
> 	if pcre_match_group("$rU", 0)
> 		$var(group) = 0;  # National fixed numbers in Spain
> 	else if pcre_match_group("$rU", 1)
> 		$var(group) = 1;  # National mobile numbers in Spain
> 	else if pcre_match_group("$rU", 2)
> 		$var(group) = 2;  # International numbers
> 
> 	[do something with $var(group)]
> ------------------------------------------
> 

Thanks Iñaki... this is something that's very close in functionality of 
what I'm looking for...

Indeed, if I insert this code just before the routing decision block and 
use $var(group) as desired RURI in CR/LCR call, it should work...

I still have to work around fails and re-routing issues, but let see how 
far I can go with this approach...

Edson.



More information about the sr-dev mailing list