cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

Community Helping Community

968
Views
0
Helpful
4
Replies
Beginner

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
VIP Advisor

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

If you found this post helpful, please consider clicking that helpful button!

And for a limited time, by marking helpful posts, you're also helping Doctors Without Borders

View solution in original post

4 REPLIES 4
Highlighted
Participant

Voice Translation Problem

the second part of the rule is /+/

VIP Advisor

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

If you found this post helpful, please consider clicking that helpful button!

And for a limited time, by marking helpful posts, you're also helping Doctors Without Borders

View solution in original post

Beginner

Re: Voice Translation Problem

You sir, rock!

Thanks

VIP Advisor

Voice Translation Problem

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


Anthony Holloway

If you found this post helpful, please consider clicking that helpful button!

And for a limited time, by marking helpful posts, you're also helping Doctors Without Borders
CreatePlease to create content
Content for Community-Ad
FusionCharts will render here