01-05-2025 07:19 AM - edited 01-05-2025 07:32 AM
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
Solved! Go to Solution.
01-05-2025 07:46 AM
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/
01-06-2025 04:25 AM - edited 01-06-2025 04:52 AM
If you want to translate one specific number to something specific this is what you’ll need.
rule 1 /^\+442070461445$/ /+442078880001/
01-05-2025 07:46 AM
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/
01-05-2025 10:21 AM
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/
01-06-2025 02:37 AM
You right Roger, it doesn't accept the curly brackets
01-05-2025 07:49 AM
sure. let me try that. Thanks
01-05-2025 04:47 PM
Here are the supported wildcard masks:
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.
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
.
01-06-2025 02:57 AM
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
01-06-2025 03:26 AM - edited 01-06-2025 03:59 AM
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?
01-06-2025 03:39 AM
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.
01-06-2025 03:40 AM - edited 01-06-2025 03:52 AM
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
01-06-2025 04:25 AM - edited 01-06-2025 04:52 AM
If you want to translate one specific number to something specific this is what you’ll need.
rule 1 /^\+442070461445$/ /+442078880001/
01-06-2025 04:37 AM
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.
01-06-2025 04:43 AM
ok, let me have a look.
Thanks
01-06-2025 05:00 AM
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.
01-06-2025 07:30 AM
I did remove the part of config once I found it doesn't work.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide