On Wednesday 22 January 2014 23:19:09 Juha Heinanen wrote:
prefix column cannot hold a regular expression. lcr routing is based on longest match, which cannot be efficiently implemented using regular expressions.
If lcr is based on longest prefix, Pete could just use a little logic to implement longest match with alias_db_lookup (his original question). I store either a full number, a 10 number block or 100 block (by leaving off the last 1 or 2 digits) and do the following:
$avp(callednumber)=$rU; if(!alias_db_lookup("dbaliases")) { strip_tail(1); if(!alias_db_lookup("dbaliases")) { strip_tail(1); if(!alias_db_lookup("dbaliases")) { $rU=$avp(callednumber); } } }
If you give bigger numberblocks to endusers just add a level (of make a decent loop that checks the remaining length of $rU).