Basic Digit Manipulation
Several different digit manipulation techniques exist, each of which controls telephone numbers in a different way and can be applied at specific points in the call flow. Table 10-1 summarizes the techniques covered in this chapter, where they are applied, and where their effect is felt.
Technique |
Where You Apply It |
When Action Is Taken |
What Can Be Manipulated |
---|---|---|---|
Digit stripping (default router action) |
To POTS[1] dial peer |
After outbound dial peer is matched, but before digits are sent out |
Called number only |
Forward digits |
To dial peer |
After outbound dial peer is matched, but before digits are sent out |
Called number only |
Prefix digits |
To dial peer |
After outbound dial peer is matched, but before digits are sent out |
Called number only |
Number expansion |
Globally, applies to all calls |
Before outbound dial peer is matched |
Called number only |
CLID |
To dial peer |
After outbound dial peer is matched, but before digits are sent out |
Calling numbers, calling name |
Voice translation profiles |
To dial peer, voice port, trunk group, all incoming VoIP[2] calls, Source IP group, or NFAS[3] interface |
Can translate before incoming dial peer is matched, before outgoing dial peer is matched, or before call is set up |
Calling, called, and redirecting numbers; numbering plan; numbering type; and calls |
[1] POTS = Plain old telephone service
[2] VoIP = Voice over IP
[3] NFAS = Non-Facility Associated Signaling
You can perform digit manipulation only on H.323 and SIP gateways; on MGCP gateways, the call agent must perform any manipulation because it controls the calls. Cisco CallManager Express and routers that are using Survivable Remote Site Telephony (SRST) offer some additional manipulation options to those discussed in this chapter, such as dial plan patterns. CallManager Express techniques are beyond the scope of this book. Chapter 13, "SRST and MGCP Gateway Fallback," discusses SRST digit manipulation in greater detail. You can also use Toolkit Command Language (Tcl) scripts to manipulate the called and calling numbers, as described in Chapter 15, "Using TCL Scripts and VoiceXML."
Digit Stripping
VoIP dial peers transmit all digits in the called number by default; however, POTS dial peers remove, or strip, any outbound digits that explicitly match their destination pattern. For instance, given a destination pattern of 55512.. the called number transmitted to the PSTN would contain just the last two digits. The first five digits, 55512, would be stripped. Only explicitly matched digits are stripped. Given a destination pattern of 555[2-9].. and a digit string of 555422, only the 555 would be stripped. If all the digits in a called number are removed, the caller hears only a reorder tone.
Digit stripping is the default behavior of POTS dial peers. It can work to your advantage, as long as you understand its effect. For instance, if users dial 9 to reach an outside number, you would not want the number 9 sent to the PSTN as part of the called number. When you configure the destination pattern of a POTS dial peer as 9T, the 9 is matched, so it is stripped. The remaining digits are transmitted. However, suppose that you have a dial peer for an emergency number, such as 911 in the United States. In that case, you would not want any of those digits removed, so you must disable the default behavior for that dial peer.
You can disable digit stripping with the command no digit-strip under POTS dial-peer configuration mode. Re-enable it with the command digit-strip. The relevant command syntax is as follows:
dial-peer voice 1 pots [no]digit-strip
Forward Digits
You can achieve more precise control over the number of digits in the called number that are transmitted to the PSTN with the following command, which applies only to POTS dial peers:
forward-digits [number | all | extra]
where
- number gives the number of digits to be forwarded.
- all means to forward all digits.
- extra tells the gateway to forward any digits that are longer than the length of the destination pattern.
This command lets you specify the exact number of digits to be forwarded. If the number of digits presented exceeds the number allowed, the rightmost digits are sent. One place this can be useful is when you must dial a code (such as 9) to reach an outside number, and there is an emergency situation. The previous section showed how to ensure that the entire emergency number (such as 911) is sent. In an emergency, a person might be confused about whether to dial the outside code. That is why dial peers are typically set up to match both the emergency number, and that number plus the code number. If the destination pattern of a dial peer is 9911, you should send only 911. You can use the forward-digits command to transmit only the last three digits, 911, to the PSTN.
The following examples show what digits are sent when you dial the number 111-222-3333 and use various options of the forward-digits command.
For this first case, the rightmost seven digits, 222-3333, are sent.
Miami(config)#dial-peer voice 111 pots Miami(config-dial-peer)#destination-pattern 111222.... Miami(config-dial-peer)#forward-digits 7
With the configuration that follows, the entire number, 111-222-3333, is sent. This is an alternative to using the no digit-strip command shown in the previous section.
Miami(config)#dial-peer voice 111 pots Miami(config-dial-peer)#destination-pattern 111222.... Miami(config-dial-peer)#forward-digits all
Finally, with the final configuration that follows, because the destination pattern is now six digits long and the dialed number is ten digits, the "extra" digits3333are sent.
Miami(config)#dial-peer voice 111 pots Miami(config-dial-peer)#destination-pattern 111222 Miami(config-dial-peer)#forward-digits extra
Prefix Digits
In some cases, you might need to transmit more than the dialed digits of a called number. For example, perhaps a call that would normally go across your VoIP network needs to be rerouted through the PSTN, requiring the addition of the appropriate area code and prefix. Or, a destination pattern might specify the first six digits of the number, with wildcards for the other digits. By default, those six digits are stripped. You can use the prefix string command to replace some of those digits. This command is given under dial-peer configuration mode, and it is only for POTS dial peers. The prefixed string can be any number from 0 to 9 and a comma that inserts a one-second pause. The gateway prefixes digits after the outgoing dial peer is matched and after any digits are stripped, but before it sends out the call.
In Example 10-1, long-distance calls need to go to a particular carrier and must have a separate dial peer from external local calls. The destination pattern is 91 to capture long-distance traffic; however, the PSTN needs the number 1 transmitted as part of the called number to route the call properly. Thus, the prefix command is added to replace that digit.
Miami(config)#dial-peer voice 91 pots Miami(config-dial-peer)#destination-pattern 91T Miami(config-dial-peer)#prefix 1 Miami(config-dial-peer)#port 1/0:23 |
When a user dials the outside long-distance number 9-1-111-222-3333, the digits are manipulated before being sent to the PSTN. The original digits 9 and 1 are stripped, and a 1 is prefixed to the remaining number. Thus, the PSTN receives the number 1-111-222-3333.