Voice translation rules have tripped up many an engineer, especially
when troubleshooting an existing router that you may not have installed.
In those situations, it can be easy to misunderstand the subtleties of voice
translation rules when quickly reviewing a production configuration.
.
>> Any single digit
[0-9]
>> Any range of
characters
*
>> Modifier—match none or more occurrences
+
>> Modifier—match one or more occurrences
?
>> Modifier—match none or one occurrence
.*
>> Any digit followed by anything, including
null.
.+
>> Any digit followed by anything, except null.
^$
>>
For null
How to start to configure router;
cisco_5350(config)#voice
translation-rule 1
cisco_5350
(cfg-translation-rule)#rule 1 /905/ /B020/
#matches first occurrence (905)
anywhere in number and convert to second occurrence.
You can check test result like this;
cisco_5350#test voice
translation-rule 1 905434949
Matched with rule 1
Original number:
905434949 Translated number: B020434949
Also, you can set rule for 905 at the start/end of number;
cisco_5350 (config)#voice
translation-rule 2
cisco_5350
(cfg-translation-rule)#rule 2 /^905/ /B020/
#if number start with 905, it will be replaced with B020
Example:
cisco_5350#test voice
translation-rule 2 905434949
Matched with rule 2
Original number:
905434949 Translated number: B020434949
cisco_5350#test voice translation-rule 2 434905949
905434949 Didn’t match with any
of rules
cisco_5350 (config)#voice translation-rule 3
cisco_5350
(cfg-translation-rule)#rule 3 /905$/ /B020/
#if number just matched with 905, it will be replaced with B020
Example:
cisco_5350#test voice
translation-rule 3 905434949
905434949 Didn’t match with any of rules
905434949 Didn’t match with any of rules
cisco_5350#test voice translation-rule 3 434949905
Matched with rule 3
Original number: 434949905 Translated number: 434949B020
Number Slicing
In this method, you can slice the number into smaller parts,
manipulate each part and then you can put the number back again.
Template;
/ (x\) y\ (z\) / / a \1 \2 /
Split the matched number into three sets like x, y, and z.
The backward slash (\) indicates the where to slice up the number.
The brackets () indicate which sets you want to reuse in the
replacement pattern.
The a represents additional digits to insert into the replacement
number.
Set 1 inherits the value of x.
Set 2 inherits the value of z.
y will be ignored.
Result: axz
Example;
cisco_5350(config)#voice
translation-rule 1
cisco_5350(cfg-translation-rule)#rule 1 /^\(55\)8\(66\)$/ /8\1\2/
cisco_5350(cfg-translation-rule)#rule 1 /^\(55\)8\(66\)$/ /8\1\2/
Set 1: 55
Set 2: 66
Ignore: 8
Set 2: 66
Ignore: 8
cisco_5350#test voice translation-rule 1 55866
Matched with rule 1
Original number: 55866 Translated number: 85566
cisco_5350#test voice translation-rule 1 12345
No match. The match pattern is not satisfied.
cisco_5350#test voice translation-rule 1 55867
No match. The match pattern is not satisfied.
cisco_5350#test voice translation-rule 1 55466
No match. The match pattern is not satisfied.
Blocking Call
rule 1 reject /^900/
cisco_5350#test voice
translation-rule 10 9005551212
Call blocked by rule 1
Call blocked by rule 1
Number Type and Plan
You can restrict matches to particular number or plan types. Also, you
can alter the replacement plan or type.
In this example, if a number starts with “4” and the type is
“national”, the rule adds “90” as a prefix.
If the type is “international”, the rule adds “900” as the prefix.
cisco_5350 (config)#voice translation-rule 7
cisco_5350(cfg-translation-rule)#rule 1 /^4/ /904/ type national national
cisco_5350(cfg-translation-rule)#rule 2 /^4/ /9004/ type international international
cisco_5350#test voice
translation-rule 7 493456567 type national
Matched with rule 1
Original number: 493456567 Translated number: 90493456567
Original number type: national Translated number type: national
Original number plan: none Translated number plan: none
Original number: 493456567 Translated number: 90493456567
Original number type: national Translated number type: national
Original number plan: none Translated number plan: none
cisco_5350#test voice translation-rule 7 493456567 type international
Matched with rule 2
Original number: 493456567 Translated number: 900493456567
Original number type: international Translated number type: international
Original number plan: none Translated number plan: none
Original number: 493456567 Translated number: 900493456567
Original number type: international Translated number type: international
Original number plan: none Translated number plan: none
This is useful when telephone companies (Telcos) remove access codes on national and international numbers.
You can add the correct prefix with the number type as a basis.
This example changes the number type and plan.
cisco_5350 (config)#voice
translation-rule 8
cisco_5350(cfg-translation-rule)#rule 1 /^2\(…$\)/ /01779345\1/ type unknown national plan unknown isdn
cisco_5350(cfg-translation-rule)#rule 1 /^2\(…$\)/ /01779345\1/ type unknown national plan unknown isdn
This rule matches any
four-digit number that starts with “2”. The rule removes the “2”,
adds the number “01779345” as a
prefix, and sets the plan to “isdn” and the type to “national”.
cisco_5350#test voice translation-rule 8 2001 type unknown plan unknown
Matched with rule 1
Original number: 2001 Translated number: 01779345001
Original number type: unknown Translated number type: national
Original number plan: unknown Translated number plan: isdn
Please do not hesitate to ask
any question about voice translation with using my e-mail.
No comments:
Post a Comment