Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
examples:
router#test voice translation-rule 1 123
Matched with rule 1
Original number: 123 Translated number: 456
In this example, the rule matches the first occurrence of the number that contains the pattern
"123" anywhere in the number. Specifically, you can use the start and end of number indicators.
The Example 2 and Example 3 sections show this.
Page 1 of 8
Example 2
This example shows how to replace any occurrence of "123" at the start of a number with "456".
voice translation-rule 1
rule 1 /^123/ /456/
124 اي رقم بدل rule 1 /^124/ /455/
examples.
router#test voice translation-rule 1 123
Matched with rule 1
Original number: 123 Translated number: 456
Original number: 1244 Translated number: 4554
Example 3
If you want only the match of an exact number, specify both the start and end number indicators:
voice translation-rule 1
rule 1 /^123$/ /456/
124 اي رقم بدل rule 1 /^124$/ /455/
Page 2 of 8
* Modifier—match none or more occurrences
+ Modifier—match one or more occurrences
? Modifier—match none or one occurrence
Wildcard Combination Definition
Any digit followed by none or more ocurrences. This
.* is effectively anything, including null.
Any digit followed by one or more ocurrences. This
.+ is effectively anything, except null.
^$ No digits, null
Example 1
This example replaces any five-digit number that begins with "40 or 30" with the number
"6666000".
voice translation-rule 1
rule 1 /^40.../ /6666000/
rule 1 /^30.../ /6666000/
router#test voice translation-rule 1 40123
Matched with rule 1
Original number: 40123 Translated number: 6666000
Original number: 30123 Translated number: 6666000
Rule ديجيت4 اخر اذا كانreplaces any Four-digit number that begins with "40 or 30" with the
number "original number".نعيد كتابة االورجينل نمبر
voice translation-rule 1
rule 1 /^40.../ /6666000/
rule 1 /^30.../ /6666000/
Example 2
This example replaces all numbers with "5554000".
voice translation-rule 2
rule 1 /.*/ /5554000/
Page 3 of 8
Original number: 123 Translated number: 5554000
Example 3
This example replaces all numbers, except null, with "5554000".
voice translation-rule 2
rule 1 /.+/ /5554000/
Example 4
This example replaces any number that starts with a combination of zeros (0, 00, and so forth)
with "909".
voice translation-rule 5
rule 1 /^0+/ /909/
router#test voice translation-rule 5 0123456
Matched with rule 1
Original number: 0123456 Translated number: 909123456
Number Slice
You can use number slice when you need to copy parts of a matched number across to the
replacement number. You slice the matched number into sets that you can keep or ignore.
Character Description
Page 4 of 8
\ In the match pattern, indicates where to slice up the number.
\ In the replacement pattern, indicates where to copy the sets to keep.
() Indicates which sets in the matched number to keep.
Character Usage Description
(a\) Keep expression "a".
b\ Ignore expression "b".
\1 Copy the first set into the replacement number.
Generic Example
This example provides a general explanation.
/ (x\) y\ (z\) / /w\1\2/
Split the matched number into three sets of x, y, and z. The backward slash (\) indicates the
places to slice up the number. The brackets () indicate which sets you want to reuse in the
replacement pattern. The w represents additional digits to insert into the replacement number.
Set 1 becomes expression x.
Set 2 becomes expression z.
Expression y is ignored.
Example 1
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.
voice translation-rule 7
rule 1 /^4/ /904/ type national national
rule 2 /^4/ /9004/ type international international
Page 5 of 8
router#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
Example 2
This example changes the number type and plan.
voice translation-rule 8
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".
Reject Calls
Use the reject keyword to reject calls that match. This example rejects all calls that start with
"234".
rule 1 reject /^234/
router#test voice translation-rule 10 1234
1234 Didn't match with any of rules
Page 6 of 8
voice translation-rule 3
rule 1 /123/ /456/
More Examples
Truncate Numbers Down to the Last Two Digits
rule 1 /^.*\(..\)/ /\1/
This is a number divided into one set and one ignored statement.
Ignored: ^.* None or more digits from the beginning of number
Set 1: .. two digits
The replacement statement specifies Set 1. This rule copies the last two digits of the number.
voice translation-rule 12
rule 1 /^\(01...\)\-\(......?$\)/ /\1\2/
rule 2 /^\(0[12]..\)\-\(...\)\-\(....$\)/ /\1\2\3/
Page 7 of 8
Rule 1: The number is sliced into three sequences, with two sets to be kept.
Set 1: 01...
Ignore: -
Set 2: ...... or .....
Rule 2: The number is sliced into five sequences with three sets to be kept.
Set 1: 0[12]..
Ignore: -
Set 2: ...
Ignore: -
Set 3: ....
router#test voice translation-rule 12 "01208-333444"
Matched with rule 1
Original number: 01208-333444 Translated number: 01208333444
************************
Page 8 of 8