Configuring Digit Manipulation
Implementing Dial Plans on Voice Gateways
© 2008 Cisco Systems, Inc. All rights reserved.
CVOICE v6.0—4-1
Digit Manipulation Various mechanisms for digit manipulations: Simple digit manipulation for dial peers: – digit-strip – forward-digits – prefix – clid Number expansion to globally inflate or deflate numbers: – num-exp – Global command – Typically used for short dials and site codes Voice translation rules and profiles: – Powerful and complex digit manipulation using regular expressions – Digit translation rules used to manipulate the calling number digits (ANI), the called number digits (DNIS), or the redirect number digits for a voice call
© 2008 Cisco Systems, Inc. All rights reserved.
CVOICE v6.0—4-2
Digit Manipulation (Cont.) POTS 1.
Incoming Call
2. 3. 4. 5.
Inbound voice-port translation profile Number expansion Match inbound dial peer CLID Dial-peer voice translation profile
VoIP 1. 2.
Match outbound dial peer Dial-peer voice translation profile CLID
3.
VoIP 1. 2. 3. 4. 5.
Global voice translation profiles Number expansion Match inbound dial peer CLID Dial peer voice translation profile
© 2008 Cisco Systems, Inc. All rights reserved.
POTS 1. 2. 3. 4. 5. 6.
Match outbound dial peer Dial-peer voice translation profile CLID Digit strip Prefix digits Forward digits
CVOICE v6.0—4-3
Digit Consumption and Forwarding POTS dial peers: – By default, the router consumes the left-justified digits that explicitly match the destination pattern and forwards the remaining digits. – Use the no digit-strip command to disable the automatic digitstripping function. VoIP dial peers: By default, the router forwards all digits collected. Example 1: Dialed digits 5550124
Example 2: Dialed digits 5550124
dial-peer voice 1 pots destination-pattern 555.... port 0/1:1
dial-peer voice 1 pots destination-pattern 555.... no digit-strip port 0/1:1
Explicitly matched digits 555 are consumed and 0124 is forwarded. © 2008 Cisco Systems, Inc. All rights reserved.
Digits 555 0124 are forwarded. CVOICE v6.0—4-4
Digit Collection 1. The router collects digits, one at a time, until it can match an outbound dial peer. 2. After a match is made, the router immediately places the call. 3. No further digits are collected. Example 1: Dialed digits 5550124
Example 2: Dialed digits 5550124
dial-peer voice 1 voip destination-pattern 555 session target ipv4:10.18.0.1
dial-peer voice 1 pots destination-pattern 555.... session target ipv4:10.18.0.1
dial-peer voice 2 voip destination-pattern 5550124 session target ipv4:10.18.0.2
dial-peer voice 2 voip destination-pattern 5550124 session target ipv4:10.18.0.2
Dial peer 1 will match first. Only the collected digits of 555 will be forwarded.
© 2008 Cisco Systems, Inc. All rights reserved.
Dial peer 2 will match first. The collected digits of 5550124 will be forwarded.
CVOICE v6.0—4-5
Digit Stripping dial-peer voice 9 pots destination-pattern 9T Dialed number: 92815551234
Transmitted number: 2815551234
PSTN Dialed number: 911
Transmitted number: None!
dial-peer voice 911 pots destination-pattern 911 Dialed number: 911
Reorder tone
Transmitted number: 911
dial-peer voice 911 pots destination-pattern 911 no digit-strip © 2008 Cisco Systems, Inc. All rights reserved.
CVOICE v6.0—4-6
Digit Forwarding dial-peer voice 1000 pots destination-pattern 1… Transmitted number: 234
Ext.1234
Dialed number: 1234
PBX Transmitted number: 1234
Dialed number: 1234
dial-peer voice 1000 pots destination-pattern 1… forward-digits 4
© 2008 Cisco Systems, Inc. All rights reserved.
CVOICE v6.0—4-7
Digit Prefixing dial-peer voice 2001 pots destination-pattern 2… preference 1 prefix 5125552 er: b port 0/1:23 um n d
PSTN
itte 23 m ns 5521 a Tr 25 51 1 0/
WAN is down!
Dialed number: 2123
WAN
10.1.1.1
512-555-2123
dial-peer voice 2000 voip destination-pattern 2… session target ipv4:10.1.1.1
© 2008 Cisco Systems, Inc. All rights reserved.
CVOICE v6.0—4-8
Number Expansion
Dialed number: 5551234
Transmitted number: 2815551234
PSTN num-exp 5551... 2815551... dial-peer voice 2000 pots destination-pattern 2815551... no digit-strip port 0/1:23
© 2008 Cisco Systems, Inc. All rights reserved.
281-555-1234
CVOICE v6.0—4-9
Simple Digit Manipulation for POTS Dial Peer
User dials 913125550123.
dial-peer voice 9 pots destination-pattern 9T
PSTN Phone1-1 2001
H.323 Gateway DID: 4085552XXX
3125550123
Command
DNIS
no digit-strip
913125550123
digit-strip (default)
13125550123
forward-digits 4 prefix 9 and digit-strip
0123 913125550123
© 2008 Cisco Systems, Inc. All rights reserved.
CVOICE v6.0—4-10
Digit Manipulation with Number Expansion num-exp 1... 913125550... dial-peer voice 9 pots destination-pattern 9T Gateway
PSTN 2001
1 User dials 0123.
© 2008 Cisco Systems, Inc. All rights reserved.
13125550123
2 Number is expanded to 13125550123 and routed to PSTN.
3 Phone rings.
CVOICE v6.0—4-11
Caller ID Number Manipulation The clid command is used to modify the calling number: clid network-number number [second-number strip] – Configures a network number in the router for CLID clid second-number strip – Prevents the second network number from being sent in the CLID information clid restrict – Prevents the calling party number from being presented clid strip [name] – Removes the calling party number or name information from the CLID information and prevents the calling party number from being presented © 2008 Cisco Systems, Inc. All rights reserved.
CVOICE v6.0—4-12
Caller ID Number Manipulation (Cont.)
FXS Port
0/0/0
WAN
voice-port 0/0/0 station-id name HQ Fax station-id number 7135551003
© 2008 Cisco Systems, Inc. All rights reserved.
CVOICE v6.0—4-13
Caller ID Information router# show dialplan number 914085551234 Macro Exp.: 914085551234 VoiceEncapPeer91 peer type = voice, information type = voice, description = `', tag = 91, destination-pattern = `91..........', answer-address = `', preference=0, CLID Restriction = None CLID Network Number = `' CLID Second Number sent CLID Override RDNIS = disabled, source carrier-id = `', target carrier-id = `', source trunk-group-label = `', target trunk-group-label = `', numbering Type = `unknown'
© 2008 Cisco Systems, Inc. All rights reserved.
CVOICE v6.0—4-14
Caller ID Information (Cont.) router(config-dial-peer)# clid network-number 5551234 router# show dialplan number 914085551234 Macro Exp.: 914085551234 VoiceEncapPeer91 peer type = voice, information type = voice, description = `', tag = 91, destination-pattern = `91..........', answer-address = `', preference=0, CLID Restriction = None CLID Network Number = `5551234' CLID Second Number sent CLID Override RDNIS = disabled, source carrier-id = `', target carrier-id = `', source trunk-group-label = `', target trunk-group-label = `', numbering Type = `unknown'
© 2008 Cisco Systems, Inc. All rights reserved.
CVOICE v6.0—4-15
Caller ID Information (Cont.) router(config-dial-peer)# clid strip router# show dialplan number 914085551234 Macro Exp.: 914085551234 VoiceEncapPeer91 peer type = voice, information type = voice, description = `', tag = 91, destination-pattern = `91..........', answer-address = `', preference=0, CLID Restriction = clid strip CLID Network Number = `' CLID Second Number sent CLID Override RDNIS = disabled, source carrier-id = `', target carrier-id = `', source trunk-group-label = `', numbering Type = `unknown'
© 2008 Cisco Systems, Inc. All rights reserved.
target trunk-group-label = `',
CVOICE v6.0—4-16
Voice Translation Rules and Profiles Voice translation rules define up to 15 subrules to manipulate digits, TONs, and numbering plans. Voice translation profiles reference up to three rules: – Called: Translation rule for the called number – Calling: Translation rule for the calling number – Redirect-called: Translation rule for the redirect number Voice translation profiles can be referenced by – VoIP dial peers, voice ports, any inbound VoIP call, specific range of source IP addresses in VoIP calls, trunk groups, NFAS controllers, or SRST
© 2008 Cisco Systems, Inc. All rights reserved.
CVOICE v6.0—4-17
Voice Translation Rules and Profiles (Cont.) Profile
Called
VoIP Dial Peer
Rule
Voice Port VoIP Incoming Incoming Source IP Group Outgoing
Calling
Rule
Trunk Group NFAS SRST
© 2008 Cisco Systems, Inc. All rights reserved.
Redirected Called
Rule
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
CVOICE v6.0—4-18
Voice Translation Rules and Profiles (Cont.) Char
Description
^
Match the expression at the start of a 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.
-
Indicates a range when used within brackets.
[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 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. Use \1-9 to refer to matched groups.
&
Match the substring (matched string). You may also use \0.
© 2008 Cisco Systems, Inc. All rights reserved.
CVOICE v6.0—4-19
Regular Expressions in Translation Rules This regex match
rule 1 /1…/ /4085551…/
and change to
1…
Austin
says 4085551…
San Jose PSTN-Out
PSTN PSTN-In
User dials “1001” to reach a San Jose extension but has to go through the PSTN
© 2008 Cisco Systems, Inc. All rights reserved.
WAN 3XXX
CVOICE v6.0—4-20
Prepending Digits \1 \ = escape character
rule 1 /\(^[2-9].........\)/ /9\1/ 5125550101
PSTN User dials 5125550101 to reach a PSTN phone.
© 2008 Cisco Systems, Inc. All rights reserved.
Gateway needs to add a 9 to route through the PSTN.
CVOICE v6.0—4-21
Voice Translation Rule Search-andReplace Examples You may use “&” or “\0” to replace with the original digits input. Rule
Input String
Output String
/^9/ //
914085550123
14085550123
/^2001/ /3001/ /^[23]…/ /4000/ /^2…/ /801&/ /^2…/ /801\0/ /.*/ /91&/ type national national
2001 2025 or 3051 2001 2001 3125552001 type national
3001 4000 8012001 8012001 913125552001 type national
© 2008 Cisco Systems, Inc. All rights reserved.
CVOICE v6.0—4-22
Voice Translation Rule Search-andReplace Examples (Cont.) Translation Rule: /\(9\)\([^01].*\)/ /\11408\2/ Replace
Search
/ \(9\) \([^01].*\)
/
/
\1
Input
9
5550134
© 2008 Cisco Systems, Inc. All rights reserved.
1408
\2
/
Output
9
1408
5550134
CVOICE v6.0—4-23
Voice Translation Profiles
Attribute
Description
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 redirectcalled number.
© 2008 Cisco Systems, Inc. All rights reserved.
CVOICE v6.0—4-24
Translation Profile Order Processing Order Applied Inbound
Outbound
Voice Port/NFAS
1
4
Trunk Group/Source IP
2
3
Global
3
1
Dial Peer
4
2
© 2008 Cisco Systems, Inc. All rights reserved.
CVOICE v6.0—4-25
Voice Translation Profile Search-andReplace Example PSTN-IN Called
Calling
Redirected Called
© 2008 Cisco Systems, Inc. All rights reserved.
Rule 1
Rule 2
1
/^4085552/ /2/
1
/^.*/ /9&/ type subscriber subscriber
2
/^.*/ /91&/ type national national
3
/^.*/ /9011&/ type international international
voice translation-rule 1 rule 1 /^4085552/ /2/ voice translation-rule 2 rule 1 /^.*/ /9&/ type subscriber subscriber rule 2 /^.*/ /91&/ type national national rule 3 /^.*/ /9011&/ type international international voice translation-profile pstn-in translate called 1 translate calling 2
CVOICE v6.0—4-26
Voice Translation Profile Call Blocking Example BLOCK Called
Calling
Rule 1
1
reject /^408555/
Redirected Called voice translation-rule 1 rule 1 reject /^408555/ voice translation profile block translate calling 1 dial-peer voice 111 pots call-block translation-profile incoming block call-block disconnect-cause incoming invalid_number
© 2008 Cisco Systems, Inc. All rights reserved.
CVOICE v6.0—4-27
Voice Translation Profiles vs. dialplan-pattern dialplan-pattern for Cisco Unified Communications Manager Express and Cisco Unified SRST: Creates another dial peer for every ephone-dn: – Destination pattern = DID number of the directory number – Also used for outbound PSTN calls for correct ANI – Can be used to register the DID number with a gatekeeper Problem: – Increases the number of dial peers and works only for ephone-dn Solution: – Use voice translation profiles on the voice port
© 2008 Cisco Systems, Inc. All rights reserved.
CVOICE v6.0—4-28
Cisco Unified Communications Manager Express with dialplan-pattern telephony-service dialplan-pattern 1 4085552... extension-length 4 dial-peer voice 2001 pots destination-pattern 2001 port 1/0/0
Easy to deploy, with some caveats on dial peers that are not ephone-dn.
X PSTN Analog Phone1-1 2001
3 Analog phone will not ring.
1/0/0 Cisco Unified CME DID: 4085552XXX
2
13125550123
1 No match on 4085552001
User dials 14085552001.
*Cisco Unified CME = Cisco Unified Communications Manager Express © 2008 Cisco Systems, Inc. All rights reserved.
CVOICE v6.0—4-29
Cisco Unified Communications Manager Express with Voice Translation Profiles Replaces the dial plan pattern and covers inbound and outbound routing of any dial peers
voice translation-rule 1 rule 1 /^4085552/ /2/ voice translation-profile pstn-in translate called 1 voice-port 0/0/0:23 translation-profile incoming pstn-in dial-peer voice 2001 pots destination-pattern 2001 port 1/0/0
PSTN FXS Phone1-1 Cisco Unified CME DID: 4085552XXX 2001
3
2 Phone rings.
© 2008 Cisco Systems, Inc. All rights reserved.
Profile modifies DNIS to 2001
13125550123
1
User dials 14085552001.
CVOICE v6.0—4-30
Verifying Translation Rules and Profiles
router# test voice translation-rule 5 2015550101 Matched with rule 5 Original number:2015550101 Original number type: none Original number plan: none
Translated number:1025550101 Translated number type: none Translated number plan: none
router# test voice translation-rule 6 2015550101 Error: Ruleset 6 not found router# test voice translation-rule 5 2125550101 2125550101 Didn't match with any rules
© 2008 Cisco Systems, Inc. All rights reserved.
CVOICE v6.0—4-31
Verifying Translation Rules and Profiles (Cont.) router# show voice translation-rule 1 Translation-rule tag: 1 Rule 1: Match pattern: ^555\(....\) Replace pattern: 444\1 Match type: none Match plan: none
Replace type: none Replace plan: none
Rule 2: Match pattern: 777 Replace pattern: 888 Match type: national Match plan: any
Replace type: unknown Replace plan: isdn
router# show voice translation-profile Translation Profile: mytranslation Rule for Calling number: Rule for Called number: 1 Rule for Redirect number:
© 2008 Cisco Systems, Inc. All rights reserved.
CVOICE v6.0—4-32
Configuring Basic Digit Manipulation WAN
San Jose 1XXX
dial-peer voice 3000 pots destination-pattern 3… forward-digits 4 port 0/0:23
408555XXXX
281555XXXX 0/0
10.10.0.1
0/0
0/1
num-exp 4… 7135554… dial-peer voice 4000 pots destination-pattern 7135554… forward-digits all port0/1:23 dial-peer voice 3000 voip destination-pattern 3… session target ipv4:10.10.0.1 dial-peer voice 3001 pots destination-pattern 3… prefix 12815553 preference 1 port 0/1:23 dial-peer voice 911 pots destination-pattern 911 no digit-strip port 0/1:23 © 2008 Cisco Systems, Inc. All rights reserved.
3XXX
PSTN
2XXX 713555XXXX
5125551234
4XXX
Houston
CVOICE v6.0—4-33
Configuring Translation Rules voice translation-rule 1 rule 1 /^4085552/ /2/ voice translation-profile pstn-in translate called 1 voice-port 0/1:23 translation-profile incoming pstn-in dial-peer voice 2001 pots destination-pattern 2001 port 1/0/0
Dials: 4085552001
PSTN
0/1
1/0/0
DID: 4085552XXX
© 2008 Cisco Systems, Inc. All rights reserved.
FXS Phone1-1 2001
CVOICE v6.0—4-34
Summary Digit manipulation is the task of adding or subtracting digits from the original dialed number to accommodate user dialing habits or gateway needs. Digit stripping strips off any outbound digits that explicitly match the destination pattern of a particular dial peer. Digit forwarding specifies the number of digits that must be forwarded to the telephony interface. Digit prefixing adds digits to the front of the dial string before it is forwarded to the telephony interface. Number expansion is applied globally to all calls, not just to calls matching a single designated dial peer.
© 2008 Cisco Systems, Inc. All rights reserved.
CVOICE v6.0—4-35
Summary (Cont.) By default, when the terminating router matches a dial string to an outbound POTS dial peer, the router strips off the left-justified digits that explicitly match the destination pattern. You can use the clid command to modify caller ID information. Digit translation is a two-step configuration process. You can use voice translation profiles to replace the Cisco Unified Communications Manager Express dialplan-pattern. Configuring digit manipulation may require the use of basic commands as well as voice translation rules and profiles.
© 2008 Cisco Systems, Inc. All rights reserved.
CVOICE v6.0—4-36
© 2008 Cisco Systems, Inc. All rights reserved.
CVOICE v6.0—4-37