cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
531
Views
4
Helpful
16
Replies

Translation Rule

ece466
Level 1
Level 1

Good Morning/Afternoon All

Just need help with translation rule. I will need to translate number coming in from PSTN to a 5-digit number internally starting 8xxxx

PSTN number- +44..........

Translated to 5-digit internal extension  - 8....

Does the below rule work?

rule 1 /^\+44\(.*\)/ /\8....\1/

Many Thanks in advance

 

2 Accepted Solutions

Accepted Solutions

M02@rt37
VIP
VIP

Hello @ece466 

The \8....syntax is incorrect and won't dynamically replace the matched digits with a 5-digit extension starting with 8. Instead, you need to explicitly define how to format the internal number.

If you want to prepend 8 to the incoming number and reduce it to a 5-digit extension, you'll need to ensure you're extracting only the relevant digits from the matched pattern.

Try this:

rule 1 /^\+44.*\([0-9]\{4\}\)$/ /8\1/

Best regards
.ı|ı.ı|ı. If This Helps, Please Rate .ı|ı.ı|ı.

View solution in original post

If you want to translate one specific number to something specific this is what you’ll need.

rule 1 /^\+442070461445$/ /+442078880001/



Response Signature


View solution in original post

16 Replies 16

M02@rt37
VIP
VIP

Hello @ece466 

The \8....syntax is incorrect and won't dynamically replace the matched digits with a 5-digit extension starting with 8. Instead, you need to explicitly define how to format the internal number.

If you want to prepend 8 to the incoming number and reduce it to a 5-digit extension, you'll need to ensure you're extracting only the relevant digits from the matched pattern.

Try this:

rule 1 /^\+44.*\([0-9]\{4\}\)$/ /8\1/

Best regards
.ı|ı.ı|ı. If This Helps, Please Rate .ı|ı.ı|ı.

AFAIK the implementation of Regex in IOS does not include support for the curly brackets as normally used in other Regex implementations.

@ece466 Please see these documents for how voice translation works in IOS. Configure Number Translation with Voice Translation Profiles and  Determine Voice Translation Rules 

I think this is what you need.

rule 1 /^\+44.*\(….\)$/ /8\1/



Response Signature


You right Roger, it doesn't accept the curly brackets

ece466
Level 1
Level 1

sure. let me try that. Thanks

 

 

Here are the supported wildcard masks:

NithinEluvathingal_0-1736123741829.png

As @Roger Kallberg  mentioned, curly brackets are not applicable on Cisco Routers for translations. As far as I know, the only regex supported Cisco devices are the expressways.

NithinEluvathingal_1-1736123915595.png

 

 

The solution provided by @Roger Kallberg  will work for you. Additionally, you can test the translation rules you created using the command 

test voice translation-rule <number> digits.

NithinEluvathingal_2-1736124332874.png

 

NithinEluvathingal_3-1736124464172.png

 

 



Response Signature


Many Thanks Nithin

We have now decided to translate the whole E164 format number to a full digit number within CUCM

PSTN DDI - +442070461445
To be translated to - +44207888XXXX (8XXXX being Alternate Enterprise Number)

Wonder what would be translation rule look like for this one?

AFAIK we can also do translations at the call manager level. I tried it at the call manager level but it didn't work. Attached are snapshots

So in an nutshell, if you could please help me with both the translation patterns at gateway level and call manager level, I would be grateful.

a) Translation Rule - PSTN DDI(+442070461445) to Internal full fomat E164 number(+44207888XXXX)

b) Translation Pattern - PSTN DDI(+442070461445) to Internal full fomat E164 number(+44207888XXXX)

Many Thanks again

 

 

On the voice gateway, this can be achieved by the below options:

rule 1 /^\(\+44207\)046\(....\)$/ /\1\888\2/


Use the test command to ensure it matches your requirements.

What exactly is the requirement in your CUCM? Why do you need to make changes in two places? What's the use case?



Response Signature


From what I can tell your rule has one to many 8’s. It should be this rule 1 /^\(\+44207\)046\(....\)$/ /\1\888\2/ to fulfill the OPs ask.



Response Signature


Thanks Nitin

There is no requirement at the CUCM end. I was just trying to understand the translation patterns within CUCM. That's it

My requirement is below

My Internal E164 format is +44207888XXXX(One of the my testing number with CUCM is +442078880001 with enterprise extension 80001)

I will need to translate +442070461445(PSTN DDI) to my CUCM number  \+442078880001 specifically to test this.

I tried the ones you provided but doesn't seem to match my extension specifically. I might be wrong in interpreting.

Incoming PSTN call(+442070461445) --> Gateway --> CUCM DN (+442078880001)

Attached is the gateway configuration

 

I am trying to integrate CUBE with the below

a) SIP provider

b) MS Teams DR

c) CUCM

If you want to translate one specific number to something specific this is what you’ll need.

rule 1 /^\+442070461445$/ /+442078880001/



Response Signature


Did you actually read the documents that I shared in my first response? Those outlines how translations works in IOS. It’s really not that complicated.



Response Signature


ok, let me have a look.

Thanks

Based on your shared configuration you’re not using the translation rule at all. You’ll need to put the rule into a translation profile and then put that profile into use on the applicable dial peer in the appropriate direction of how you want to translate the number. Apart from that you’re rule isn’t correctly formed as you didn’t follow what @Nithin Eluvathingal wrote and you didn’t take into account what I’ve answered Nithin.



Response Signature


I did remove the part of config once I found it doesn't work.