Voice Adaptation Rules and Profiles

Voice Adaptation Rules and Profiles

Number adaptation occurs several times during the alarm acquisition process. In both the originating

and absolute gateways, the admission alarm is translated afore an entering dial

peer is matched, afore an outbound punch associate is matched, and afore a alarm appeal is set

up. Your punch plan should annual for these adaptation accomplish back adaptation rules are

defined.

Digit adaptation is a two-step agreement process. First, the adaptation aphorism is defined

at the all-around level. Then, the aphorism is activated at the dial-peer akin either as entering or outbound

translation on either the alleged or calling number. Adaptation rules additionally catechumen a

telephone cardinal into a altered cardinal afore the alarm is akin to an entering dial

peer or afore the outbound punch associate assiduously the call. For example, an agent might

dial a five-digit addendum to ability addition agent of the aforementioned aggregation at another

site. If the alarm is baffled through the PSTN to ability the added site, the basic gateway

might use adaptation rules to catechumen the five-digit addendum into the ten-digit format

that is accustomed by the axial appointment (CO) switch.

A adaptation aphorism ability dispense a calling affair cardinal (Automatic Number

Identification (ANI)) or a alleged affair cardinal (DNIS) for incoming, outgoing, and redirected

calls aural voice-enabled gateways.

You can additionally use adaptation rules to change the calculation blazon for a call. For example,

some gateways ability tag a cardinal with added than 11 digits as an all-embracing number,

even back the user charge punch 9 to ability an alfresco line. In this case, the cardinal that is

tagged as an all-embracing cardinal needs to be translated into a civic number, without

the 9, afore it is beatific to the PSTN.

Voice-translation rules ability ascertain up to 15 rules that accommodate Stream EDitor (SED)-like

expressions (that is, agnate to expressions acclimated with the UNIX Stream EDitor utility) for

processing the alarm translation. A best of 128 adaptation rules are supported. These

translation rules are aggregate into profiles that are referenced by block groups, punch peers,

source IP groups, articulation ports, and interfaces.

The articulation adaptation rules are associated with a articulation adaptation profile, which can reference

up to three articulation adaptation rules:

■ A articulation adaptation aphorism that is acclimated to dispense the alleged cardinal (that is, the

DNIS)

■ A articulation adaptation aphorism that is acclimated to dispense the calling cardinal (that is, the

ANI)

■ A articulation adaptation aphorism that is acclimated to dispense the redirected alleged cardinal (that

is, the Redirected Dialed Cardinal Identification Account (RDNIS))

The consistent voice-translation contour can be absorbed to these:

■ VoIP punch peers

■ Articulation ports

■ Any entering VoIP call

■ A specific ambit of antecedent IP addresses in VoIP calls

■ A block group

■ A T1/E1 ambassador that is acclimated for Nonfacility Associated Signaling (NFAS) trunks

■ Survivable Remote Armpit Telephony (SRST)

Each of these can advertence two articulation adaptation profiles: one for admission calls and one

for approachable calls. You can use the articulation translation-rule command to actualize the definition

of a adaptation rule.

Figure 7-9 illustrates the abstraction of articulation adaptation profiles and rules. Anniversary articulation translation

rule can accept up to 15 alone subrules. The articulation adaptation aphorism is again referenced

by a articulation adaptation contour for called, calling, and redirected alleged number. Note

that the aforementioned articulation adaptation aphorism can be referenced by assorted articulation adaptation profiles.

Up to 128 articulation adaptation rules are accurate in a Cisco IOS gateway.

Chapter 7: Configuring Advanced Punch Plans 381

Profile

Called Rule

1 2 3 4 5

6 7 8 9 10

11 12 13 14 15

Rule

1 2 3 4 5

6 7 8 9 10

11 12 13 14 15

Rule

1 2 3 4 5

6 7 8 9 10

11 12 13 14 15

Calling

Redirected

Called

Incoming

Outgoing

VoIP Punch Peer

Voice Port

VoIP Incoming

Source IP Group

Trunk Group

NFAS

SRST

Figure 7-9 Articulation Adaptation Rules and Profiles

Note Although you can accept up to 15 subrules aural a articulation adaptation rule, the first

matching aphorism will be applied, and no added subrules will be considered.

Voice adaptation rules use approved expressions for match-and-replace operations. The

syntax is actual agnate to the UNIX SED tool. Table 7-1 describes the best important regular

expressions available.

Table 7-1 Approved Expressions for Articulation Adaptation Rules

Voice Translation

Rule Appearance Description

^ Bout the announcement at the alpha of a line.

$ Bout the announcement at the end of the line.

/ Delimiter that marks the alpha and end of both the analogous and replacement

strings.

\\ Escape the adapted acceptation of the abutting character.

- Indicates a ambit back not in the first/last position. Acclimated with the “[” and

“]” characters.

[list] Bout a distinct appearance in a list.

[^list] Do not bout a distinct appearance authentic in the list.

. Bout any distinct character.

* Repeat the antecedent approved announcement (regex) aught or added times.

+ Repeat the antecedent approved announcement one or added times.

? Repeat the antecedent approved announcement aught or one time (use CTRL-V to

enter in Cisco IOS, because Cisco IOS interprets a “?” appearance as a

request for context-sensitive help).

() Groups approved expressions.

Understanding Approved Expressions in Adaptation Rules

It is important that you accept how approved expressions are acclimated in adaptation rules.

When the router evaluates a adaptation rule, it is absolutely alone assuming a “match this”

and “change to this” operation on the regex.

Consider the afterward example, as illustrated in Figure 7-10.

382 Authorized Self-Study Guide Cisco Articulation over IP (CVOICE)

Figure 7-10 Approved Expressions in Adaptation Rules

To added allegorize the agreement of adaptation rules, accede the following:

■ This aphorism will be acclimated to change the approachable DNIS to a ten-digit cardinal for routing

across the PSTN. The aphorism will be activated approachable on an interface, port, or punch peer.

Router(config)#voice translation-rule PSTN-out

Router(config)#rule 1 /1.../ /4085551.../

■ This aphorism will be acclimated to change the admission ANI to a four-digit cardinal afterwards routing

across the PSTN. The aphorism will be activated admission on an interface, port, or dial

peer.

Router(config)#voice translation-rule PSTN-in

Router(config)#rule 1 /4085551... / /1.../

Table 7-2 illustrates the bout and alter rules for these rules.

Table 7-2 Bout and Alter Table

Rule Bout This Change To

/1.../ /4085551.../ 1... 4085551...

/408553.../ /1.../ /4085551.../ /1.../

What if you bare to prepend a 9 to all approachable calls? It would not be achievable to use

individual adaptation rules for anniversary cardinal because of the cardinal of rules needed. For

example:

rule 1 /4085550100/ /95125550100/

rule 2 /4085550101/ /95125550101/

rule 3 /4085550102/ /95125550102/

Chapter 7: Configuring Advanced Punch Plans 383

This regex aphorism 1 /1…//4085551…/ says

match 1… and change to 4085551…

User dials 1001 to

reach a San Jose

extension but has

to go through the PSTN.

1XXX

PSTN-Out

V V

PSTN

Austin San Jose

WAN

PSTN-In

The band-aid would be application variables, as apparent in Figure 7-11. Adaptation aphorism expressions

can be disconnected into sections by application an escape appearance to actualize variables. The

regex escape appearance is the “\\” symbol.

384 Authorized Self-Study Guide Cisco Articulation over IP (CVOICE)

User dials

512 555-0101 to reach

a PSTN phone.

V

PSTN

512...

rule 1 / \\(^[2-9].........\\)//9\\1/

\\ = Escape Character

\\1

Gateway needs to

add a 9 to route

through the PSTN.

Figure 7-11 Prepending Digits

You ability use the afterward adaptation aphorism to prepend a 9 to approachable calls for routing

through the PSTN:

rule 1 /\\(^[2-9].........\\)/ /9\\1/

This aphorism would prepend a 9 to whatever was akin in the aboriginal set of departure (\\1);

in added words, alter \\1 with ^[2-9]......... and add a 9 to the beginning.

Search and Alter with Articulation Adaptation Rules Example

Table 7-3 shows how articulation adaptation rules accomplish search-and-replace operations that

use articulation adaptation rules.

Table 7-3 Examples of Articulation Adaptation Rules

Rule Ascribe Cord Output String

/^9/ // 914085550123 14085550123

/^2001/ /3001/ 2001 3001

/^[23]…/ /4000/ 2025 or 3051 4000

/^2…/ /801&/ 2001 8012001

/^2…/ /801\\0/ 2001 8012001

/\\(9\\)\\([^10].*\\)/ /\\11408\\2/ 95551234 914085551234

/.*/ /91&/ blazon civic civic 3125552001 blazon civic 913125552001 blazon national

The archetype illustrated in Figure 7-12 shows a circuitous search-and-replace operation in

which this aphorism is configured:

rule 1 /\\(9\\)\\([^10].*\\)/ /\\11408\\2/

Chapter 7: Configuring Advanced Punch Plans 385

\\(9\\) \\([^01].*\\) \\1 1408 \\2

9 5550134 9 1408 5550134

/ / / /

Search Replace

Input Output

Translation Rule: / \\(9\\)\\([^01].*\\)/ / \\11408\\2/

Figure 7-12 Articulation Adaptation Aphorism Search-and-Replace

This archetype would be acceptable for prepending a continued ambit 1 and an breadth cipher to a

dialed cardinal departure the arrangement via the PSTN and accessing a long-distance subscriber.

The user would be dialing a 9 additional seven digits to admission alfresco numbers.

This is how the operation gain if the ascribe cord 95550134 is used:

■ The 9 is reinserted application the \\1.

■ It is followed by the digits 1408.

■ Again 5550134 follows, which is referenced by the \\2.

■ The consistent cord is 914085550134.

Note The aboriginal set of departure is referenced as \\1 and the additional set as \\2.

Voice Adaptation Profiles

Voice adaptation profiles acquaint a new arrangement to construe numbers. The earlier translation

rules are to be gradually phased out of Cisco IOS. Cisco acerb recommends you

use alone one arrangement of adaptation rules. If you mix the old and new schemes, you can

have abrupt results. Axial to the new arrangement is the adequacy to accomplish regular

expression matches and alter substrings. The SED account is acclimated to construe numbers.

You can ascertain these types of alarm numbers in a adaptation profile:

■ called: Defines the adaptation contour aphorism for the alleged number

■ calling: Defines the adaptation contour aphorism for the calling number

■ redirect-called: Defines the adaptation contour aphorism for the redirect-called number

Each blazon of alarm cardinal in the contour can accept altered adaptation rules.

After a adaptation contour is defined, it can be referenced by the following:

■ Block group: Two altered adaptation profiles can be authentic in a block accumulation to

perform cardinal adaptation for admission and approachable POTS calls. If an outgoing

translation contour is authentic in a block group, the cardinal adaptation is done while

the approachable alarm is set up.

■ Antecedent IP group: A adaptation contour can be authentic in a antecedent IP accumulation to perform

number adaptation for admission VoIP calls.

■ Punch peer: Two altered adaptation profiles can be authentic in a punch associate to perform

number adaptation for admission and approachable calls.

■ Articulation port: The adaptation contour can be authentic in a articulation anchorage to accomplish number

translation for admission and approachable POTS calls. If a articulation anchorage is additionally a trunk

group member, the admission adaptation contour of a articulation anchorage overrides the translation

profile of a block group.

■ NFAS interface: The adaptation contour can be authentic for an NFAS interface

through the translation-profile command from the all-around articulation account pots configuration

to accomplish the cardinal adaptation for admission and approachable NFAS calls. This

translation contour has a college antecedence than the adaptation contour of a articulation port

and block accumulation in case a approach additionally belongs to a articulation anchorage and/or block group

with the adaptation contour defined.

■ VoIP incoming: The adaptation contour can be authentic globally for all admission VoIP

(H.323/SIP) calls to accomplish cardinal translation. If an admission H.323/SIP alarm is

associated with a antecedent IP accumulation with a adaptation contour defined, the translation

profile of the antecedent IP accumulation overrides the all-around adaptation contour for incoming

VoIP calls.

Translation Contour Processing

The adjustment in which adaptation profiles are candy depends on area the contour is

applied. Table 7-4 indicates the adjustment in which articulation adaptation profiles will be

processed.

Table 7-4 Adaptation Contour Order

Applied Processing Order

Inbound Outbound

Voice port/NFAS 1 4

Trunk group/Source IP 2 3

Global 3 1

Dial associate 4 2

386 Authorized Self-Study Guide Cisco Articulation over IP (CVOICE)

Voice Adaptation Contour Search-and-Replace Example

The archetype illustrated in Figure 7-13 shows a search-and-replace articulation translation

profile.

Chapter 7: Configuring Advanced Punch Plans 387

PSTN-IN

Called Aphorism 1

Calling Aphorism 2

Redirected

Called

1 /^4085552/ /2/

3 /^.*/ /9011&/ blazon all-embracing international

2 /^.*/ /91&/ blazon civic national

1 /^.*/ /9&/ blazon subscriber subscriber

Figure 7-13 Articulation Adaptation Contour Search-and-Replace Example

A articulation adaptation contour is adapted to accomplish these manipulations:

■ The admission DNIS 4085552XXX should be adapted to 2XXX.

■ The admission ANI should be prefixed with the adapted PSTN admission cipher and

identifier:

■ Local calls: Prefix 9

■ Civic calls: Prefix 91

■ All-embracing calls: Prefix 9011

Following are the accomplish you booty to configure the adaptation profile:

Step 1. Actualize a adaptation aphorism to dispense the alleged (DNIS) number.

Router(config)#voice translation-rule 1

Router(config-translation-rule)#rule 1 /^4085552/ /2/

Step 2. Actualize a adaptation aphorism to dispense the calling (ANI) number.

Router(config)#voice translation-rule 2

Router(config-translation-rule)#rule 1 /^.*/ /9&/ blazon subscriber

subscriber

Router(config-translation-rule)#rule 2 /^.*/ /91&/ blazon national

national

Router(config-translation-rule)#rule 3 /^.*/ /9011&/ blazon international

international

Step 3. Apply the rules to a adaptation profile.

Router(config)#voice translation-profile pstn-in

Router(cfg-translation-profile)#translate alleged 1

Router(cfg-translation-profile)#translate calling 2

Step 4. Accommodate the adaptation contour aural a dial-peer definition.

Router(config)#dial-peer articulation 111 POTS

Router(config-dial-peer)#translation-profile admission pstn-in

Example 7-11 shows the complete configuration, which was ahead described.

Example 7-11 Articulation Contour Example

388 Authorized Self-Study Guide Cisco Articulation over IP (CVOICE)

Router(config)#voice translation-rule 1

Router(config-translation-rule)#rule 1 /^4085552/ /2/

Router(config-translation-rule)#exit

Router(config)#voice translation-rule 2

Router(config-translation-rule)#rule 1 /^.*/ /9&/ blazon subscriber subscriber

Router(config-translation-rule)#rule 2 /^.*/ /91&/ blazon civic national

Router(config-translation-rule)#rule 3 /^.*/ /9011&/ blazon international

international

Router(config-translation-rule)#exit

Router(config)#voice translation-profile pstn-in

Router(cfg-translation-profile)#translate alleged 1

Router(cfg-translation-profile)#translate calling 2

The afterward action describes an entering PSTN alarm example:

1. A PSTN user dials 1 408 555-2001 from 312 555-0123.

2. The aperture accepts the alarm and modifies the DNIS and ANI. The rule

/^4085552/ /2/ modifies the DNIS to 2001, and the aphorism /^.*/ /91&/ blazon national

national modifies the ANI to 913125550123.

3. The buzz rings.

Voice Adaptation Contour Alarm Blocking Example

The afterward example, as illustrated in Figure 7-14, shows a articulation adaptation profile

used for alarm blocking.

The alone advantage for alarm blocking is in the admission direction. From the angle of

the gateway, the admission administration can be either of these:

■ Admission from a telephony accessory anon absorbed to a articulation anchorage on the gateway

toward the aperture itself

■ Admission by way of an entering VoIP alarm from a associate gateway

Following are the accomplish you booty to configure alarm blocking:

Step 1. Ascertain a adaptation aphorism with a adios keyword.

Router(config)#voice translation-rule 1

Router(config-translation-rule)#rule 1 adios /408555*/

Figure 7-14 Articulation Adaptation Contour Call-Blocking Example

Step 2. Apply the aphorism to a adaptation contour for calling numbers.

Router(config)#voice adaptation contour block

Router(cfg-translation-profile)#translate calling 1

Step 3. Accommodate the adaptation contour aural a dial-peer definition.

Router(config)#dial-peer articulation 111 POTS

Router(config-dial-peer)#call-block translation-profile admission block

Router(config-dial-peer)#call-block disconnect-cause admission invalidnumber

In this call-blocking example, the aperture blocks any admission alarm that successfully

matches entering dial-peer 111 and has a calling cardinal that starts with 408555. A component

of the alarm block command is the adequacy to acknowledgment a abstract cause. These

values accommodate call-reject, invalid-number, unassigned-number, and user-busy. When

dial-peer 111 matches a dialed cord starting with 408555, it will adios the alarm and

return a abstract account of “invalid number” to the antecedent of the call.

Example 7-12 shows the complete configuration, which was ahead described.

Example 7-12 Alarm Block Example

Chapter 7: Configuring Advanced Punch Plans 389

BLOCK

Called

Calling Aphorism 1

Redirected

Called

1 adios /408555*

Router(config)#voice translation-rule 1

Router(config-translation-rule)#rule 1 adios /408555*/

Router(config-translation-rule)#exit

Router(config)#voice adaptation contour block

Router(cfg-translation-profile)#translate calling 1

Router(cfg-translation-profile)#exit

Router(config)#dial-peer articulation 111 pots

Router(config-dial-peer)#call-block translation-profile admission block

Router(config-dial-peer)#call-block disconnect-cause admission invalid-number