cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1844
Views
0
Helpful
4
Replies

Voice Translation Problem

houstonrob
Level 1
Level 1

I have a problem that seems like it should be pretty simple but I've been banging my head against the wall for a couple days now and still nothing. I'm trying to take a number pattern (7135551[2-4]..) and put a plus in front of it (make it an e.164 number). Consider the output below:

router#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

router(config)#voice translation-rule 5

router(cfg-translation-rule)#rule 1 /^(7135551[2-4]..)$/ /+\1/

router(cfg-translation-rule)#end

router#test voice translation-rule 5 7135551212

7135551212 Didn't match with any of rules

router(config)#no voice translation-rule 6

router(config)#voice translation-rule 6

router(cfg-translation-rule)#rule 1 /^(7135551[2-4]..\)$/ /+\1/

% unmatched ()                                     ^

% Invalid input detected at '^' marker.

router(cfg-translation-rule)#rule 1 /^(7135551[2-4]..\$)/ /+\1/

router(cfg-translation-rule)#end

router#test voice translation-rule 6 7135551212

7135551212 Didn't match with any of rules

router(config)#voice translation-rule 6

router(cfg-translation-rule)#rule 1 /^1\(7135551[2-4]..\)$/ /+\1/

router(cfg-translation-rule)#end

router#test voice translation-rule 6 17135551212

Matched with rule 1

Original number: 17135551212    Translated number: +7135551212

Original number type: none      Translated number type: none

Original number plan: none      Translated number plan: none

Can anyone tell me why I'd be getting the results I'm getting? This is CME 8.5

1 Accepted Solution

Accepted Solutions

Anthony Holloway
Cisco Employee
Cisco Employee

For this rule

rule 1 /^(7135551[2-4]..)$/ /+\1/

And this test

test voice translation-rule 5 7135551212

You got

7135551212 Didn't match with any of rules

Because

Your test string of "7135551212" does not contain parenthesis "(" ")" as your pattern "/^(7135551[2-4]..)$/" is looking for.

To fix

Change your pattern to "/^\(7135551[2-4]..\)$/", which is how you group matches for recalling later

For this rule

rule 1 /^(7135551[2-4]..\)$/ /+\1/

You got

% unmatched ()

% Invalid input detected at '^' marker.

Because

You only escaped one of the parenthesis, therefore you have one literal "(" and one grouping "\)", neither of which have their required partner.

To fix

Change your pattern to "/^\(7135551[2-4]..\)$/", which is how you group matches for recalling later

For this rule

rule 1 /^(7135551[2-4]..\$)/ /+\1/

And this test

test voice translation-rule 6 7135551212

You got

7135551212 Didn't match with any of rules

Because

Your input string "7135551212" does not contain parenthesis "(" ")", nor a dollar sign "$", as your pattern "/^(7135551[2-4]..\$)/" is looking for

To fix

Change your pattern to "/^\(7135551[2-4]..\)$/", which is how you group matches for recalling later, and how you use the "end of line" special character "$"

For this rule

rule 1 /^1\(7135551[2-4]..\)$/ /+\1/

And this test

test voice translation-rule 6 17135551212

You got

Matched with rule 1

Original number: 17135551212 Translated number: +7135551212

Because

Your input string "17135551212" matches your pattern "/^1\(7135551[2-4]..\)$/" exactly, and the result was to write out a plus sign "+" followed by the match in group 1 "7135551212"

To fix

Change your pattern to "/^\(7135551[2-4]..\)$/", because it doesn't look like you actually needed to match on the leading "1"

If you simply wanted to prefix:

All numbers

rule 1 // /+/

Some numbers in a range

rule 1 /^7135551[2-4]..$/ /+\0/

A specific number

rule 1 /^7135551212$/ /+\0/

Note my use of the "\0" and the absence of parethesis grouping in the match pattern.  This is a cleaner and more effecient way than grouping, and recalling "\1", because it happens automatically, and you create no additional overhead.

View solution in original post

4 Replies 4

rgodden
Level 3
Level 3

the second part of the rule is /+/

Anthony Holloway
Cisco Employee
Cisco Employee

For this rule

rule 1 /^(7135551[2-4]..)$/ /+\1/

And this test

test voice translation-rule 5 7135551212

You got

7135551212 Didn't match with any of rules

Because

Your test string of "7135551212" does not contain parenthesis "(" ")" as your pattern "/^(7135551[2-4]..)$/" is looking for.

To fix

Change your pattern to "/^\(7135551[2-4]..\)$/", which is how you group matches for recalling later

For this rule

rule 1 /^(7135551[2-4]..\)$/ /+\1/

You got

% unmatched ()

% Invalid input detected at '^' marker.

Because

You only escaped one of the parenthesis, therefore you have one literal "(" and one grouping "\)", neither of which have their required partner.

To fix

Change your pattern to "/^\(7135551[2-4]..\)$/", which is how you group matches for recalling later

For this rule

rule 1 /^(7135551[2-4]..\$)/ /+\1/

And this test

test voice translation-rule 6 7135551212

You got

7135551212 Didn't match with any of rules

Because

Your input string "7135551212" does not contain parenthesis "(" ")", nor a dollar sign "$", as your pattern "/^(7135551[2-4]..\$)/" is looking for

To fix

Change your pattern to "/^\(7135551[2-4]..\)$/", which is how you group matches for recalling later, and how you use the "end of line" special character "$"

For this rule

rule 1 /^1\(7135551[2-4]..\)$/ /+\1/

And this test

test voice translation-rule 6 17135551212

You got

Matched with rule 1

Original number: 17135551212 Translated number: +7135551212

Because

Your input string "17135551212" matches your pattern "/^1\(7135551[2-4]..\)$/" exactly, and the result was to write out a plus sign "+" followed by the match in group 1 "7135551212"

To fix

Change your pattern to "/^\(7135551[2-4]..\)$/", because it doesn't look like you actually needed to match on the leading "1"

If you simply wanted to prefix:

All numbers

rule 1 // /+/

Some numbers in a range

rule 1 /^7135551[2-4]..$/ /+\0/

A specific number

rule 1 /^7135551212$/ /+\0/

Note my use of the "\0" and the absence of parethesis grouping in the match pattern.  This is a cleaner and more effecient way than grouping, and recalling "\1", because it happens automatically, and you create no additional overhead.

You sir, rock!

Thanks

Thank you!  And thanks for the rating!  Good luck to you.