05-02-2022 08:12 AM
We are introducing a Mass Notification system via Singlewire--- it is working. We are now configuring the Voice Gateways to allow the Mass Notification to work with SRST. In a "non-SRST" state the users dial a leading "*" before any of the numbers that allow for Lockdowns, Secure, etc.... (e.g. *9XXXXX). I am trying to create a voice translation rule that will remove the "*". We are using the following command but keep getting an error from the router when we enter the command (% ?+* follows nothing):
Here is the syntax we are using to slice the number.
voice translation-rule 1
rule 1 /*\(9.....\)/ /\1/
We are needing to remove the "*" so that our dial-peer only sends 9XXXXX to the Singlewire Fusion servers.
Is this possible?
Thanks in advance
Solved! Go to Solution.
05-02-2022 09:22 AM
Found this information on a link that was posted by @tylerpalmer in a response to a post by @Kshitij Singhi titled "A custom made guide on translation rules/profiles and some common uses."
This excerpt is from Cisco documentation titled "Voice Translation Rules" at this link.
The section specific to dealing with Special Characters has this info:
Remove Unwanted Digits in a Number
This example is useful because certain Telcos have been known to insert hypens into calling party numbers. Since this is against standards, it causes the calling party number to be ignored. The Telco sends the calling numbers in two formats, with one hypen and sometimes with two. Two rules are required in the voice translation rule. Additionally, the first format can have five or six digit numbers after the hypen. You can match both of these conditions using one rule with the '?' character (match none or one occurrence).
Notes on special characters:
The hyphen character is used to indicate a range in a match pattern, for example [0-9]. In order to indicate in this rule that you want to match on the hypen character, it is necessary to use the '\' character to escape its meaning. This is because the hyphen character is a special character. The '\-' characters really means hyphen. The trailing '\' indicates that the number is sliced here.
If you type ? directly, IOS thinks it is a request for help. You must type Control-V then ?.
voice translation-rule 12 rule 1 /^\(01...\)\-\(......?$\)/ /\1\2/ rule 2 /^\(0[12]..\)\-\(...\)\-\(....$\)/ /\1\2\3/
Rule 1: The number is sliced into three sequences, with two sets to be kept.
Set 1: 01...
Ignore: -
Set 2: ...... or .....
Rule 2: The number is sliced into five sequences with three sets to be kept.
Set 1: 0[12]..
Ignore: -
Set 2: ...
Ignore: -
Set 3: ....
router#test voice translation-rule 12 "01208-333444" Matched with rule 1 Original number: 01208-333444 Translated number: 01208333444 router#test voice translation-rule 12 "01208-72345" Matched with rule 1 Original number: 01208-72345 Translated number: 0120872345 router#test voice translation-rule 12 "0161-333-4444" Matched with rule 2 Original number: 0161-333-4444 Translated number: 01613334444 router#test voice translation-rule 12 "0208-123-4567" Matched with rule 2 Original number: 0208-123-4567 Translated number: 02081234567
Hope this helps.
05-02-2022 10:40 AM - edited 05-02-2022 10:37 PM
@stuartschwarzman The syntax was not *\ before, it was \(. Ie the backslash is escaping the ( to indicate that it is the start of a number slice, where \) indicates the end of the slice. Your new rule has the syntax \*, meaning that it literal looks for a * and doesn’t treat this as a wild card character. I would suggest that you make this additional change to your rule.
voice translation-rule 1
rule 1 /^\*\(9.....\)$/ /\1/
This will look for the pattern starting with a *, as indicated by the ^, and then a 9 with any five digits following that, ending the match string with a $ that means end of string. This is a much more specific rule than what you have now.
05-02-2022 09:22 AM
Found this information on a link that was posted by @tylerpalmer in a response to a post by @Kshitij Singhi titled "A custom made guide on translation rules/profiles and some common uses."
This excerpt is from Cisco documentation titled "Voice Translation Rules" at this link.
The section specific to dealing with Special Characters has this info:
Remove Unwanted Digits in a Number
This example is useful because certain Telcos have been known to insert hypens into calling party numbers. Since this is against standards, it causes the calling party number to be ignored. The Telco sends the calling numbers in two formats, with one hypen and sometimes with two. Two rules are required in the voice translation rule. Additionally, the first format can have five or six digit numbers after the hypen. You can match both of these conditions using one rule with the '?' character (match none or one occurrence).
Notes on special characters:
The hyphen character is used to indicate a range in a match pattern, for example [0-9]. In order to indicate in this rule that you want to match on the hypen character, it is necessary to use the '\' character to escape its meaning. This is because the hyphen character is a special character. The '\-' characters really means hyphen. The trailing '\' indicates that the number is sliced here.
If you type ? directly, IOS thinks it is a request for help. You must type Control-V then ?.
voice translation-rule 12 rule 1 /^\(01...\)\-\(......?$\)/ /\1\2/ rule 2 /^\(0[12]..\)\-\(...\)\-\(....$\)/ /\1\2\3/
Rule 1: The number is sliced into three sequences, with two sets to be kept.
Set 1: 01...
Ignore: -
Set 2: ...... or .....
Rule 2: The number is sliced into five sequences with three sets to be kept.
Set 1: 0[12]..
Ignore: -
Set 2: ...
Ignore: -
Set 3: ....
router#test voice translation-rule 12 "01208-333444" Matched with rule 1 Original number: 01208-333444 Translated number: 01208333444 router#test voice translation-rule 12 "01208-72345" Matched with rule 1 Original number: 01208-72345 Translated number: 0120872345 router#test voice translation-rule 12 "0161-333-4444" Matched with rule 2 Original number: 0161-333-4444 Translated number: 01613334444 router#test voice translation-rule 12 "0208-123-4567" Matched with rule 2 Original number: 0208-123-4567 Translated number: 02081234567
Hope this helps.
05-02-2022 09:42 AM
We were able to solve this by changing our syntax from *\ to \*\
We now have the following:
voice translation-rule 1
rule 1 /\*\(9.....\)/ /\1/
05-02-2022 10:40 AM - edited 05-02-2022 10:37 PM
@stuartschwarzman The syntax was not *\ before, it was \(. Ie the backslash is escaping the ( to indicate that it is the start of a number slice, where \) indicates the end of the slice. Your new rule has the syntax \*, meaning that it literal looks for a * and doesn’t treat this as a wild card character. I would suggest that you make this additional change to your rule.
voice translation-rule 1
rule 1 /^\*\(9.....\)$/ /\1/
This will look for the pattern starting with a *, as indicated by the ^, and then a 9 with any five digits following that, ending the match string with a $ that means end of string. This is a much more specific rule than what you have now.
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