Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

Voice Translation Problem

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

Re: Voice Translation Problem

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.

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.
4 REPLIES
New Member

Voice Translation Problem

the second part of the rule is /+/

Re: Voice Translation Problem

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.

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.
New Member

Re: Voice Translation Problem

You sir, rock!

Thanks

Voice Translation Problem

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

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.
798
Views
0
Helpful
4
Replies
CreatePlease to create content