[sr-dev] LCR/CR and prefix mask (REGEX?)
Iñaki Baz Castillo
ibc at aliax.net
Fri Jul 3 21:01:24 CEST 2009
El Viernes, 3 de Julio de 2009, Edson - Lists escribió:
> > 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...
You could use LCR after getting the $var(group) and use that value as LCR
"from_user" field (lcr table) in order to select the gateways in order of
preference. This is: configure in LCR some gateways (failover and redundancy
based on LCR priority and weigh) for each $var(group) value, which would match
the "from_user" field.
--
Iñaki Baz Castillo <ibc at aliax.net>
More information about the sr-dev
mailing list