@voice can support various translation rules when it comes to CLI and CLD. This is a convinent feature if your existing switch does not support it. Generally, it does as advertised where you can convert a CLD (calling number) from +13379987654 to go out as 13379987654 (the prefix “+” was removed in this instance).
Translation Rules are specified either as a replacement numbers or as a set of regular expressions with Python syntax in the following two forms:
s/<match what>/<replace with>/
s/<match what><replace with>/g
The former will match/replace a single matched occurrence or pattern, while the former – all of them. Several expressions may be used in one translation rule; in this case they need to be separated by semicolon (“;”).
There are several “special” symbols in <match what> which allows to define matching rules, for example ^ matches beginning of the string, while $ - its end, so that for example ^1 will only match 1 as the first character of the string, while 9$ will only match 9 as a last character.
For example the following translation rule can be used to strip leading 0011 prefix from the number:
s/^0011//
The following translation rule will add 53872# prefix:
s/^/53872#/
While the next rule will result in the number replaced with 123456 in all cases unconditionally.
123456
Translate all non 10 digits CLIs into the new one, and bypass the CLIs with another length
s/^.{0,9}$/0123456789/
Exclude + from the front of the number
s/^[+]//
Add 1 to any sequence of 10 symbols:
s/^(.{10})$/1\1/
Check if number contains the "space" OR "-" (dash) OR "." (dot) and replace all with "block":
s/^.*([ ]|\-|\.).*$/block/
Indicate space in number and remove it:
's/[ ]//'
To setup your translation rule for Australian domestic dialling, you can use the below:
's/^[13]{2}(?=[0-9]{8}$)/6113/; s/^[13]{2}(?=[0-9]{4}$)/6113/;s/^0{1}(?=[0-9]{9}$)/61/;s/^[18]{2}(?=[0-9]{8}$)/6118/'
For more details on Python regular expressions syntax please check the following link:
http://docs.python.org/release/2.4/lib/re-syntax.html