On 06.09.2010 13:46, rabs(a)dimension-virtual.com
wrote:
dpid priority matchop matchex matchlen subsex
replaceex attributes
0 1 1 (00|\+)([1-9][0-9]+) 0 (00|\+)([1-9][0-9]+) \2
0 1 1 ([5-9][0-9]{8}) 0 ([5-9][0-9]{8}) 34\1
The first rule 'it's supposed' to remove + or 00 from full qualified
E164 numbers, the seccond rule 'should' add 34 as prefix to all
'valid' spanish numbers, they was running on some little test I did,
but when try to put them on pre-production enviroment I get strage
results.
I call dp_translate as dp_translate("0","$rU/$rU");
And this what I get :
Input RURI Output RURI
900XXXXXX(a)dom.tld XXXXXX(a)dom.tld
I'd suppose that both rules match this RURI and since they have the same
priority the first one applies.. (00|\+) matches 00 in any part of the
string, so leading 9 is simply discarded and you get XXXXXX.
Try putting it as ^(00|\+)([1-9][0-9]+) and ^([5-9][0-9]{8}) to
designate start of the string.
Umm .. it doesn't work, let see:
mysql> select * from dialplan;
+----+------+----+----------+------------------------+-----------+---------
---------------+----------+-------+
| id | dpid | pr | match_op | match_exp | match_len |
| subst_exp repl_exp | attrs |
+----+------+----+----------+------------------------+-----------+---------
---------------+----------+-------+
| 1 | 0 | 1 | 1 | ^(00|\+)([1-9][0-9]+)$ | 0 | ^(00|\+)
([1-9][0-9]+)$ | \2 | |
| 2 | 0 | 1 | 1 | ^([5-9][0-9]{8})$ | 0 | ^([5-9]
[0-9]{8})$ | 34\1 | |
+----+------+----+----------+------------------------+-----------+---------
---------------+----------+-------+
DEBUG: dialplan [dialplan.c:217]: integer value
DEBUG: dialplan [dialplan.c:238]: searching 7
DEBUG: dialplan [dialplan.c:326]: input is +34900XXXXXX
DEBUG: dialplan [dp_repl.c:300]: regex operator testing
DEBUG: dialplan [dp_repl.c:300]: regex operator testing
DEBUG: dialplan [dp_repl.c:329]: no matching rule
DEBUG: dialplan [dialplan.c:331]: could not translate +34900XXXXXX
with dpid 0
Any hit about that? ... If I test the regex in