×

Warning message

  • Cisco Support Forums is in Read Only mode while the site is being migrated.
  • Cisco Support Forums is in Read Only mode while the site is being migrated.

voice translation rule (prefix)

Answered Question
Aug 13th, 2012
User Badges:

Hello,


Please help to create a voice translation rule that will prefix 9 to any longer 5 digits.


12345      -> 9123435

123456    -> 9123456

1234       -> 1234



Thanks

Correct Answer by Daniele Giordano about 5 years 6 days ago

You must use a voice rule with 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.

CharacterDescription
\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 UsageDescription
(a\)Keep expression "a".
b\Ignore expression "b".
\1Copy 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.

The replacement number is a concatenated number: wxz.

Specific Example

This example provides further detail:

voice translation-rule 1
 rule 1 /^\(12\)3\(45\)$/ /6\1\2/
  • Set 1: 12
  • Set 2: 45
  • Ignore: 3
router#test voice translation-rule 1 12345
Matched with rule 1
Original number: 12345        Translated number: 61245




An example can be:


voice translation-rule 1

rule 1 /^\([0-9]...\)/ /9\1/



- copy every numbers with 5 digit and started with a digit between 0 or 9

- prepend 9



Regards.

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (1 ratings)
Loading.
Correct Answer
Daniele Giordano Mon, 08/13/2012 - 02:43
User Badges:
  • Gold, 750 points or more

You must use a voice rule with 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.

CharacterDescription
\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 UsageDescription
(a\)Keep expression "a".
b\Ignore expression "b".
\1Copy 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.

The replacement number is a concatenated number: wxz.

Specific Example

This example provides further detail:

voice translation-rule 1
 rule 1 /^\(12\)3\(45\)$/ /6\1\2/
  • Set 1: 12
  • Set 2: 45
  • Ignore: 3
router#test voice translation-rule 1 12345
Matched with rule 1
Original number: 12345        Translated number: 61245




An example can be:


voice translation-rule 1

rule 1 /^\([0-9]...\)/ /9\1/



- copy every numbers with 5 digit and started with a digit between 0 or 9

- prepend 9



Regards.

Actions

This Discussion