This topic is one that fouls up engineers quite often as it can seem more complicated than it needs to be. However, once you spend some time learning the syntax, you'll see that its actually quite flexible AND powerful. The language is based upon SED and RegExp and may seem familiar to those of you with any Unix scripting or programming experience.
Go to this page if you are looking for examples of voice translation rules.
Let's start by reviewing the various symbols that you'll find used within voice translation rules.
Pattern Matches With Wildcards
|.||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 occurrences|
|.*||Any digit followed by none or more occurrences. This is effectively anything, including null.|
|.+||Any digit followed by one or more occurrences. This is effectively anything, except null.|
|^$||No digits, null|
|\||In the match pattern, indicates where to slice up the number.|
|\||In the replacement pattern, indicates where to copy the sets to keep.|
|( )||Indicates which sets in the matched number to keep.|
|(a\)||Keep expression "a".|
|b\||Ignore expression "b".|
|\1||Copy the first set into the replacement number.|
Voice Translation Rule Characters
|Voice Translation Rule Character||Definition|
|^||Match the expression at the start of a line.|
|$||Match the expression at the end of a line.|
|/||Delimiter that marks the start and end of both the matching and replacement strings.|
|\||Escape the special meaning of the next character.|
|-||Indicates a range when not in the first/last position. Used with the'[' and ']'.|
|[list]||Match a single character in a list.|
|[^list]||Do not match a single character specified in the list.|
|.||Match any single character.|
|*||Repeat the previous regexp zero or more times.|
|+||Repeat the previous regular expression one or more times.|
|?||Repeat the previous regular expression zero or one time (use CTRL-V in order to enter in IOS).|
|( )||Groups regular expressions.|
Typical Voice Translation Rule Usage
Match and Replace:
rule precedence /match-pattern/ /replace-pattern/
rule precedence reject /match-pattern/ [type match-type [plan match-type]]
Voice translation profiles (which reference voice translation rules) are referenced by the following:
- Trunk Group - Two different translation profiles can be defined in a trunk group in order to perform number translation for incoming and outgoing POTS calls. If an outgoing translation profile is defined in a trunk group, the number translation is done while the outgoing call is setup.
- Source IP Group - A translation profile can be defined in a source IP group in order to perform number translation for incoming VoIP calls.
- Dial Peer - Two different translation profiles can be defined in a dial peer in order to perform number translation for incoming and outgoing calls.
- Voice Port - The translation profile can be defined in a voice port in order to perform number translation for incoming and outgoing POTS calls. If a voice port is also a trunk group member, then the incoming translation profile of a voice port overrides the translation profile of a trunk group.
- Non-Facility Associated Signaling (NFAS) Interface - The translation profile can be defined for an NFAS interface through the translation-profile command line from the global voice service pots configuration in order to perform the number translation for incoming and outgoing NFAS calls. This translation profile has a higher precedence than the translation profile of a voice port and trunk group in case a channel also belongs to a voice port and/or trunk group with the translation profile defined.
- VoIP Incoming - The translation profile can be defined globally for all incoming VoIP (h323/sip) calls in order to perform number translation. If an incoming H.323/SIP call is associated with a Source IP Group with a translation profile defined, then the translation profile of the Source IP Group overrides the global translation profile for incoming VoIP calls.
Please find more details here and here.
Configuring Voice Translation Rules in IOS Gateways, Nov 2008, Bob Liggett (requires CCO login)