cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
505
Views
3
Helpful
2
Replies

Translation rules by digits length

Dimitris Mingos
Level 1
Level 1

I need assistance on translating different number starting with 2 but the length is for case a. 10 digits and for case b. more than 10 digits.

Ex I have the following numbers:

a. 92105555555 to be translated to 92105555555

b. 921799999999999  to be translated to 840021799999999999

I have the rule for case b.  rule 5 /^9\([1-9]\)/ /8400\1/

Thank you for your support.

2 Replies 2

Terry Cheema
VIP Alumni
VIP Alumni

Your post is not quite clear but see below if it helps:

voice translation-rule 1
 rule 1 /^9210\(......$\)/ /8400\1/   << This will match all 10 digits starting with 9210 (only 10 digits) and replace it with 8400 followed by rest of digits
 rule 2 /^9217/ /8400/ << This will match anything starting with 9217 and replace it with 8400 and followed by rest of the digits

 

R1#test voice translation-rule 1 9210555555
Matched with rule 1
Original number: 9210555555    Translated number: 8400555555
Original number type: none      Translated number type: none
Original number plan: none      Translated number plan: none

R1#test voice translation-rule 1 9210555555577889
9210555555577889 Didn't match with any of rules  (will only match 10 digits)
R1#test voice translation-rule 1 921799999999999
Matched with rule 2
Original number: 921799999999999        Translated number: 840099999999999
Original number type: none      Translated number type: none
Original number plan: none      Translated number plan: none

R1#test voice translation-rule 1 921799
Matched with rule 2
Original number: 921799 Translated number: 840099
Original number type: none      Translated number type: none
Original number plan: none      Translated number plan: none

-Terry

Please rate all helpful posts and mark the thread as answered if you have no other queries.

Hello Terry,

Thank you for your response.

Unfortunately your example was not what I was needed, BUT you covered my error to my configuration.

The $ sign was missing and the below text gave me the hint

voice translation-rule 1
 rule 1 /^9210\(......$\)/ /8400\1/ 

My translation profile is as following:

voice translation-rule 30

 rule 1 /^969/ /69\1/

 rule 2 /^9800/ /9800\1/

 rule 3 /^9801/ /9801\1/

 rule 4 /^92\(.........$\)/ /92\1/ # if number is 92 123456789 -> 92123456789  ($ sign was missing in my initial configuration)

 rule 5 /^9\([1-9]\)/ /8400\1/  # if number starts with 9 + [any number not matching rule 4]  -> strip 9 and add 8400

Dimitris

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: