With digit manipulation on IOS, keep a few things in mind:
1. / -- / - It always starts with / and ends with / 2. Anything within parenthesis would be kept. characters are keep are like (a\) characters to ignore are like b\ \1 copy the first set into the replacement number, \2 copy the second set into the replacement number, etc 3. The following represents the digits/characters: . : Any single digit 0 to 9,*,# : Any specific character [0-9] : Any range or sequence of characters * : Modifier—match none or more occurrences + : Modifier—match one or more occurrences ? : Modifier—match none or one occurrence Look at the following examples. This should clarify: Examples: Example 1: voice translation-rule 1 rule 1 /123/ /456/ Will match and modify 123 anywhere in the pattern: router#test voice translation-rule 1 123 Matched with rule 1 Original number: 123 Translated number: 456 router#test voice translation-rule 1 1234 Matched with rule 1 Original number: 1234 Translated number: 4564 router#test voice translation-rule 1 6123 Matched with rule 1 Original number: 6123 Translated number: 6456 router#test voice translation-rule 1 6123123 Matched with rule 1 Original number: 6123123 Translated number: 6456123 Example 2: voice translation-rule 1 rule 1 /^123/ /456/ Will match only if the pattern start with 123 because carrot '^' is the starting character router#test voice translation-rule 1 123 Matched with rule 1 Original number: 123 Translated number: 456 router#test voice translation-rule 1 1234 Matched with rule 1 Original number: 1234 Translated number: 4564 router#test voice translation-rule 1 6123 6123 Didn't match with any of rules Example 3: voice translation-rule 1 rule 1 /^123$/ /456/ Will only match if the pattern starts if its 123 exacly. Nothing after, nothing before. router#test voice translation-rule 1 123 Matched with rule 1 Original number: 123 Translated number: 456 router#test voice translation-rule 1 1234 1234 Didn't match with any of rules router#test voice translation-rule 1 6123 6123 Didn't match with any of rules Example 4: voice translation-rule 1 rule 1 /^40.../ /6666000/ Will match pattern starting with 40 and any 3 digits afterwards router#test voice translation-rule 1 40123 Matched with rule 1 Original number: 40123 Translated number: 6666000 Example 5: voice translation-rule 2 rule 1 /.*/ /5554000/ Will replace any pattern with 555400 router#test voice translation-rule 2 123 Matched with rule 1 Original number: 123 Translated number: 5554000 router#test voice translation-rule 2 86573 Matched with rule 1 Original number: 86573 Translated number: 5554000 router#test voice translation-rule 2 "" Matched with rule 1 Original number: Translated number: 5554000 Example 6: voice translation-rule 1 rule 1 /^\(12\)3\(45\)$/ /6\1\2/ Set 1: 12 Set 2: 45 Ignore: 3 router#test voice translation-rule 1 12345 Matched with rule 1 Original number: 12345 Translated number: 61245 Example 7: voice translation-rule 10 rule 1 /\(32..\)$/ /416555\1/ Will replace 32xx to 41655532xx (used for outbound caller ID) router#test voice translation-rule 10 3200 Matched with rule 10 Original number: 3200 Translated number: 4165553200 Example 8: voice translation-rule 10 rule 1 /^416555\(32..\)$/ /\1/ Will replace 4165553211 to 3211 (used for inbound caller ID) router#test voice translation-rule 10 4165553211 Matched with rule 10 Original number: 4165553211 Translated number: 3211 Example 9: voice translation-rule 7 rule 1 /^4/ /904/ type national national rule 2 /^4/ /9004/ type international international If number starts with 4 and type is National, it would be prefixed 90 and type will remain National If number starts with 4 and type is International, it would be prefixed 900 and type remain International router#test voice translation-rule 7 493456567 type national Matched with rule 1 Original number: 493456567 Translated number: 90493456567 Original number type: national Translated number type: national Original number plan: none Translated number plan: none router#test voice translation-rule 7 493456567 type international Matched with rule 2 Original number: 493456567 Translated number: 900493456567 Original number type: international Translated number type: international Original number plan: none Translated number plan: none Example 10: voice translation-rule 8 rule 1 /^2\(...$\)/ /01779345\1/ type unknown national plan unknown isdn This rule matches any four-digit number that starts with "2". The rule removes the "2", adds the number "01779345" as a prefix, and sets the plan to "isdn" and the type to "national". router#test voice translation-rule 8 2001 type unknown plan unknown Matched with rule 1 Original number: 2001 Translated number: 01779345001 Original number type: unknown Translated number type: national Original number plan: unknown Translated number plan: isdn POTS Dial-Peers --------------- dial-peer 911 pots destination-pattern 911$ !Anything that is explicitly matched on POTS dial-peer is removed. This isn't true for VOIP. VOIP Dial-peer doesn't remove anything thats explicity matched. no digit strip <OR> prefix 911 <OR> forward-digits 3 port 0/0/0:23 dial-peer 9 pots destination-pattern 9[2-9]XX[2-9]XXXXXX$ port 0/0/0:23 ! no need for any prefix or any forward digits as only number explicitly matched is 9 which we want removed as its our PSTN code. dial-peer 91 pots destination-pattern 91[2-9]XX[2-9]XXXXXX$ prefix 1 <OR> forward-digits 11 ! 1 is being explicitly matched and we want it to go out as its our long distance code used by the PSTN. port 0/0/0:23 dial-peer 9011 pots destination-pattern 9011T ! no need for #. It would be automatically matched because of the next dial-peer. prefix 011 ! can't use forward-digits as we don't know the extension length that would be dialed. port 0/0/0:23 dial-peer terminator # ! Its a default command and any call with # is already a terminator for interdigit timeout, unless its changed by someone. Note: On CUCM, in Service Parameters "Strip # Sign from Called Party Number" is "True" by Default - Meaning it would remove # as the trailing number. dial-peer 1 pots incoming called-number . ! will match incoming calls dial-peer 2 voip destination-pattern 2...$ session target ipv4:10.1.1.2 ! CUCM IP dtmf-relay h245-signal dial-peer 3 voip incoming called-number . Overlap Sending <-- SCCP works this way - one digit at a time. En-Bloc <-- CUCM works this way. A good document which I consulted when working on this post: http://www.cisco.com/c/en/us/support/docs/voice/call-routing-dial-plans/61083-voice-transla-rules.html
2 Comments
11/25/2019 09:26:57 pm
I really don't want to accept that I am sick because of a gift from a friend. I wish it's not true. I don't really want to give this away because it's given to me but if I am feeling sick from this, maybe I have no choice. I think I will not tell my friend anymore that I got sick. Maybe it's the right thing to do. She still needs to feel special and helpful. She might worry if I tell her that her gift made me sick. I am glad I am having this conversation with myself today. I am happy I realise things.
Reply
1/18/2020 01:49:16 am
I am a musician. Nothing can take this away from me. Not any lover or any new hobby. Music had fallen in love with me even before I was born. I am not saying I don't love music but between music and me, music loves me more. It's hard to explain this using words. Anyone who heard me sing or play by ear will have a small idea what I am talking about. Anyone who had been with me long enough to be exposed to all the things I choose to only give exclusively to those who really thought they can't live without it will not even find a need for any further explanation.
Reply
Leave a Reply. |
AuthorSaad is a Senior Collaboration Engineer. He is CCIE x 3 (Collaboration, R&S and Data Center) Categories
All
Archives
May 2022
|