Share this page : facebooktwitterlinkedinmailfacebooktwitterlinkedinmail

To integrate VoIP networks into existing voice networks, you should have the skills and knowledge to implement call routing and design an appropriate numbering plan.

A numbering plan is a numbering scheme used in telecommunications to allocate telephone number ranges to countries, regions, areas, and exchanges, and to nonfixed telephone networks such as mobile phone networks. A numbering plan defines rules for assigning numbers to a device.

Configuring the Router to Route the Calls


This section explains how a Cisco IOS gateway is configured as a CallManager H323 gateway.

On the gateway router POTS dial peer that points to the PSTN ports, use a destination pattern of ‘0’ to match the leading digit (access code) of the dialed digits that come from the CallManager. This explicit match on the ‘0’ will cause the dial peer to strip off the leading 0, hence the rest of the called number is sent out. This is shown in the configuration segment below.

dial-peer voice 100 pots

!-- DID for incoming calls

 destination-pattern 0

!-- 0 is stripped when call is placed

 port 1/0:15

!-- Direct the call to the PRI port 1/0


You do not need any other POTS dial peers unless there are multiple POTS ports that will go into a hunt group. For example, if you had two FXO ports, the dial peers would look like this:

dial-peer voice 100 pots 
 destination-pattern 0 
 port 1/0/0
dial-peer voice 101 pots 
 destination-pattern 0 
 port 1/0/1 

The calls will then cycle through these two configured voice ports.

Dial Plan ( call routing)

Call routing can be compared with IP routing in below table to help understand it.

The entries that define where to forward calls are the dial peers. All dial peers together build the dial plan, which is equivalent to the IP routing table. The dial peers are static in nature.  There are no dynamic routing protocols for E.164 telephony addresses. VoIP dial plans are statically configured on gateway and gatekeeper platforms.

IP routing Call routing
Static or dynamic Static only
IP routing table Dial Plan
IP route Dial Peer
Hop-by-hop routing, where each router makes an independent decision Inbound and outbound call legs. The gateway negotiates VoIP parameters with preceding and next gateways before a call is forwarded
Destination-based routing Called number, matched by destinationpattern, is one of many selection criteria.
Most explicit match rule The most explicit match rule for destinationpattern exists, but other criteria are also considered.
Equal paths Preference can be applied to equal dial peers. If all criteria are the same, a random selection is made.
Default route Possible. Often points at external gateway or gatekeeper.


A call-routing decision is the selection of the outbound dial peer. This selection is commonly based on the called number, when the destination-pattern command is used. The selection might be based on other information, and that other criteria might have higher precedence than the called number. When the called number is matched to find the outbound dial peer, the longest match rule applies.

Dial plan is the central part of any telephony solution and defines how calls are routed and interconnected.


Digit manipulation


Translation rules

Your dial plan should account for these translation steps when translation rules are defined.
Digit translation is a two-step configuration process.

  • First, the translation rule is defined at the global level.
  • Then, the rule is applied at the dial-peer level either as inbound or outbound translation on either the called or calling number.

Each voice translation rules might define up to 15 individual subrules that include Stream Editor (SED)-like expressions (that is, similar to expressions used with the UNIX SED utility) for processing the call translation.

A maximum of 128 translation rules are supported. These translation rules are grouped into profiles that are referenced by trunk groups, dial peers, source IP groups, voice ports, and interfaces.

The voice translation rules are associated with a voice translation profile, which can reference up to three voice translation rules:

■ A voice translation rule that is used to manipulate the called number (that is, the DNIS)
■ A voice translation rule that is used to manipulate the calling number (that is, the ANI)
■ A voice translation rule that is used to manipulate the redirected called number (that is, the Redirected Dialed Number Identification Service [RDNIS])

Note that the same voice translation rule can be referenced by multiple voice translation profiles.

The resulting voice translation profile can be attached to these:

■ VoIP dial peers
■ Voice ports
■ Any inbound VoIP call
■ A specific range of source IP addresses in VoIP calls
■ A trunk group
■ A T1/E1 controller that is used for Nonfacility Associated Signaling (NFAS) trunks
■ Survivable Remote Site Telephony (SRST)

Note that like ACL in IP network, each of these can reference two voice translation profiles: one for incoming calls and one for outgoing calls.

Understand translation rule

When the router evaluates a translation rule, it is really only performing a “match this” and “change to this” operation on the regex

Regular expression for voice translation rule:

^  Match the expression at the start of the line.
$  Match the expression at the end of the line.
/  Delimiter that marks the start and end of both the matching and replacement strings.
\  Escape the special meaning of the next character.
–  Indicate a range when not in the first/last position. Used with the [ and ] characters.
[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 regular expression (regex) 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 to enter in Cisco IOS, because Cisco IOS interprets a ? character as a request for context-sensitive help).
()  Group regular expressions.
T  Any number of digits (0-32)
DP-9T   Anything up to 32

There are some useful and special expressions you will use often:

Character Usage Description
(a\) Keep expression “a”.
b\ Ignore expression “b”.
\1 Copy the first set in the parentheses into the replacement number.


Wildcard Combination Definition
.* Any digit followed by none or more ocurrences. This is effectively anything, including null.
.+ Any digit followed by one or more ocurrences. This is effectively anything, except null.
^$ No digits, null
.T Dial at least one digit and then wait for timeout.

Anytime the “T” is used, “T” must be preceded by a “.” or digits (“.T” or “555T” for example). If you use “T” alone, the dial peers act improperly and effect how calls are handled by the router.



Router(config)#voice translation-rule 1
Router(cfg-translation-rule)#rule 1 /1.../ /4085551.../

Router(config)#voice translation-rule 2
Router(cfg-translation-rule)#rule 1 /4085551... / /1.../


This regex rule 1 /1…//4085551…/ says: match 1…  and change to 4085551…

Rule 2 do the opposite.

Although in this example, we use a specific number, but in real world, we should avoid this, we use variables instead.

You might use the following translation rule to prepend a 9 to outgoing calls for routing through the PSTN:

rule 1 /\(^[2-9].........\)/ /9\1/
  • First step is find the condition and action parts, which are sitting in two blocks wrapped with //. in this one, condition part is \(^[2-9].........\) and action part is 9\1.  For the condition part, keep in mind any character needs to be prepended with \, which means the real meaning of \( is (.
  • The condition part means if a group of 10 digits numbers start with 2 to 9,  action part means this rule would prepend a 9 to whatever was matched in the first set of parentheses (\1); in other words, replace \1 with ^[2-9]......... and add a 9 to the beginning.

If you dial 2889010112 then output is 92889010112.

Another way is :

/.*/ /9&/

Other examples:

/^2.../ /801&/  2001 -> 8012001
/^2.../ /801\0/ 2001 -> 8012001

Then let’s have a look at a complex one:

rule 1 /\(9\)\([^10].*\)/ /\11408\2/
  • condition part: \(9\)\([^10].*\), action part \11408\2
  • condition part grouped the number into two groups (9) and any number not start with 1 or 0, which is same as [2-9];
  • action part: have a look at the head and tail, \1 means first set of parentheses, \2 means second set of parentheses. Then look at the middle, add 1408 between 9 and whatever the rest of the numbers

If this is applied to a outbound dial peer, and you dial 91004, then the rule will change it into 914081004, and send it out to PSTN

Voice Translation Profiles

Voice translation profiles introduce a new scheme to translate numbers. The older translation rules are to be gradually phased out of Cisco IOS. Cisco strongly recommends you use only one scheme of translation rules. If you mix the old and new schemes, you can have unforeseen results. Central to the new scheme is the capability to perform regular expression matches and replace substrings. The SED utility is used to translate numbers.

You can define these types of call numbers in a translation profile:

■ called: Defines the translation profile rule for the called number

■ calling: Defines the translation profile rule for the calling number

■ redirect-called: Defines the translation profile rule for the redirect-called number


Each type of call number in the profile can have different translation rules.

After a translation profile is defined, it can be referenced by the following:

■ Trunk group: Two different translation profiles can be defined in a trunk group 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 set up.

■ Source IP group: A translation profile can be defined in a source IP group to perform number translation for incoming VoIP calls.

■ Dial peer: Two different translation profiles can be defined in a dial peer to perform number translation for incoming and outgoing calls.

■ Voice port: The translation profile can be defined in a voice port to perform number translation for incoming and outgoing POTS calls. If a voice port is also a trunk group member, the incoming translation profile of a voice port overrides the translation profile of a trunk group.

■ NFAS interface: The translation profile can be defined for an NFAS interface through the translation-profile command from the global voice service pots configuration 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 (H.323/SIP) calls to perform number translation. If an incoming H.323/SIP call is associated with a source IP group with a translation profile defined, the translation profile of the source IP group overrides the global translation profile for incoming VoIP calls.

Translation Profile Processing

The order in which translation profiles are processed depends on where the profile is applied. Table below indicates the order in which voice translation profiles will be processed.

Translation Profile Order


           Processing  Order



Voice port/NFAS



Trunk group/Source IP






Dial peer



Redirect-called vs redirect-target

The “redirect-called” is RDNIS (Redirected Dialed Number Identification Service), and “redirect-target” is the end destination.

To explain this, think of the following example:

User A Phone number: 3000

User B Phone number: 3001

Voicemail: 4000

User A calls user B (3001). User B does not pick up the call, and it is redirected to Voicemail (4000).

User A —> User B (3001 – redirect-called is Sent to Voicemail for
mailbox identification) —> Voicemail (4000) is now call target or

The “redirect-called” is user B’s phone number (3001) which the voicemail system will use to identify the mailbox, and the “redirect-target” is the final destination (4000) of the call or the call “target”.