Good morning Ryan~
I hope it helps for you.
Basically, it is all about match and replace by general expression. This article will provide a lot of examples that I believe easy way to understand and how it works. It allows up to 15 individual rules.
“rule 1 /match-this/ /replace-with-this/”
1. Rule Examples
rule 1 /2023331234/ /1234/ , dial ‘2023331234’ translated output ⇒ 1234 ; DID converts to internal extension
rule 1 /2023331…/ /1…/ , dial ‘2023331234’ translated output ⇒ 1234
rule 1 /^1…$/ /2023331…/ , dial ‘1234’ translated output ⇒ 2023331234
rule 1 /2023331[0-2]../ /1…/ , dial ‘2023331234’ translated output ⇒ 1234 ; Internal extension 1000~2999
rule 1 /2023331[012]../ /1…/ , dial ‘2023331234’ translated output ⇒ 1234 ; Internal extension 1000~2999
rule 1 /\(….\)/ /645\1/ , translated output ⇒ 645xxxx; Adding 645 in front of 4 digits extension(calling party) that is displayed as caller ID.
rule 1 /^.*/ // ; Anything will be translated to null string
rule 1 // // , dial ‘2023331234’ translated output ⇒ 2023331234 ; Nothing translated
rule 1 /\(^…\)123\(…\)/ /\1777\2/ , dial ‘2021238822’ translated output ⇒ 2027778822 ; Translate strings from the middle of the input string
rule 1 /\(.*\)1234/ /\15678/ , dial ‘2025551234’ translated output ⇒ 2025555678 ; Translate strings from the end of the input string
rule 1 /^202…\(….\)/ /555\1/ , dial ‘2027771234’ translated output ⇒ 5551234; Translate multiple patterns
rule 1 /\(9\)\(1234\)\(……\)/ /\1\3/, dial ‘9 1234 884422’ translated output ⇒ 9 884422; Eliminate middle of string. \1 = group1, \3 = group 3.
rule 1 /^…….$/ /9&/ , dial ‘2027777’ translated output ⇒ 92027777; “&” put everything from the match string.
rule 1 /^[2-9]..[2-9]…$/ /91&/ , dial ‘2027777’ translated output ⇒ 912027777; Translate multiple patterns
rule 1 /*/ /9011&/ , dial ‘2027777’ translated output ⇒ 90112027777; Translate multiple patterns
2. Translation Profile
– Translation Profile allows one voice translation rule for called party, one voice translation rule for calling party and one voice translation rule for redirect number.
– Translation Profile are most commonly applied to ports or dial-peers. Also, it applied on inbound and outbound each.
voice-port 0/0/0
translation-profile incoming T1-IN
translation-profile outgoing T1-OUT
dial-peer voice 10 pots
incoming called-number
translation-profile incoming T1-IN
direct-inward-dial
dial-peer voice 20 pots
destination-pattern 9[2-9]..[2-9]…
translation-profile incoming T1-OUT
direct-inward-dial
port 0/0/0:23
3. Testing and Troubleshooting
– show voice translation-profile
– show voice translation-rule
– test voice translation-rule [number] [testing number]
– show dialplan incall 0/0/0:15 number [testing number]
– show call active voice
– debug voice translation and csim start xxxxxxxx
– show dialplan number xxxxxx
* How to know original DID call digits from telco? Try “show call active voice” during the dialling DID or “debug voice translation”.