您只能在H.323和SIP网关进行数字处理;在MGCP网关,因为它控制了电话呼叫代理必须执行任何操作。的Cisco CallManager Express和路由器使用的远程电话(SRST)提供了一些额外的操作选项,这些本章讨论,如拨号计划模式。CallManager的快速技术超出了本书的范围。第13章,“SRST和MGCP网关回退,”中详细讨论了SRST位操作。您还可以使用工具箱命令语言(TCL)脚本来操纵被叫和主叫号码,如第15章所描述的,“使用TCL脚本和VoiceXML。”
表10-1数字操作技巧
| 技术 | 您应用它 | 当采取行动 | 什么可以被操纵 |
| Digit stripping (default router action) | To POTS1dial peer | 出站后拨同行是匹配的,但数字发送出去之前 | 只有被叫号码 |
| 正向数字 | 要拨打同行 | 出站后拨同行是匹配的,但数字发送出去之前 | 只有被叫号码 |
| 前缀数字 | 要拨打同行 | 出站后拨同行是匹配的,但数字发送出去之前 | 只有被叫号码 |
| 数量扩张 | 全球范围内,适用于所有通话 | 之前传出拨号对等匹配 | 只有被叫号码 |
| CLID | 要拨打同行 | 出站后拨同行是匹配的,但数字发送出去之前 | 主叫号码,主叫名字 |
| 语音翻译型材 | 要拨打同行,语音端口,中继群,所有进入VoIP2电话,源IP组,或NFAS3接口 | Can translate before incoming dial peer is matched, before outgoing dial peer is matched, or before call is set up | 调用,调用,并重定向号码;编号计划;编号类型;并呼吁 |
1POTS = Plain old telephone service 2VoIP =基于IP语音 3NFAS =与设备无关的信令 |
|||
数字剥线
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 of55512。。传送到PSTN被叫号码将只包含的最后两位数字。前五个数字,55512, would be stripped. Only explicitly matched digits are stripped. Given a destination pattern of555 [2-9] ..and a digit string of555422, 只有555would 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 dial9到达外线号码,你就不会要的号码9sent to the PSTN as part of the called number. When you configure the destination pattern of a POTS dial peer as9T中,9匹配,因此它被剥离。剩下的数字传输。但是,假设你有一个紧急号码的拨号对等体,如911在美国。雷竞技比分在这种情况下,你不希望任何的去除那些数字,所以你必须禁用该拨号对等的默认行为。
您可以禁用位与命令剥离无位条under POTS dial-peer configuration mode. Re-enable it with the command位条。相关的命令语法如下:
拨号端声音1个盆[no]位条
正向位数
可以实现对在被叫号码被发送到PSTN用下面的命令,该命令只适用于POTS拨号点的位数更精确的控制:
前位数[数|all|extra]
哪里
数gives the number of digits to be forwarded.
all手段来转发所有的数字。
extra告诉网关来转发比目的地图案的长度长的任何数字。
该命令允许您指定要转发的数字的确切人数。如果给出的位数超过了允许的数量,最右边的数字将发送。一个地方,这可能是有用的,当你要拨打的代码(如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 as911) 已发送。在紧急情况下,一个人可能会搞不清楚是否要拨打外部的代码。这就是为什么拨号点通常设置同时匹配紧急号码,而且这个数字加上代号。如果一个拨号对等体的目的地模式9911,你应该只发911。您可以使用前位数命令仅发送3个数字,911到PSTN的。
下面的例子表明,当你拨打的号码是什么数字将发送111-222-3333并使用的各种选项前位数命令。
对于第一种情况下,最右边的七位数,222-3333,发送。
Miami(config)#拨号端声音111个盆Miami(config-dial-peer)#目标模式111222。。。。Miami(config-dial-peer)#前位数7
用下面的结构中,整个号码,111-222-3333, 已发送。这是使用一种替代无位条前一节中所示命令。
Miami(config)#拨号端声音111个盆Miami(config-dial-peer)#目标模式111222。。。。Miami(config-dial-peer)#前位数所有
最后,最后的配置, because the destination pattern is now six digits long and the dialed number is ten digits, the "extra" digits—3333-are发送。
Miami(config)#拨号端声音111个盆Miami(config-dial-peer)#目标模式111222Miami(config-dial-peer)#前位数extra
Prefix Digits
在某些情况下,你可能需要传输多于被叫号码的拨号数字。例如,也许一个电话,将在你的VoIP网络的需求通常去可以通过PSTN重新路由,需要增加相应的区号和前缀。或者,目标模式可能指定号码的前六位数字,用通配符为其他数字。默认情况下,这些六位被剥离。您可以使用字首串命令替换其中的一些数字。该命令下拨号对等体配置模式给出的,并且它仅用于POTS拨号对等体。的前缀字符串可以是从0到9的任何数量和逗号进行的插入一秒钟的暂停。即将离任的拨号对等后,网关前缀数字匹配和之后的任何数字被剥离,但它发出的呼叫之前。
在例10-1,长途电话需要到特定的载体,并且必须从外部拨打本地电话的单独拨号对等。目标模式是91以捕捉长途贩运;然而,PSTN需要数1transmitted as part of the called number to route the call properly. Thus, the字首命令被添加到替换数字。
实施例10-1加前缀数字来的去话呼叫
Miami(config)#dial-peer voice 91 potsMiami(config-dial-peer)#目标模式91TMiami(config-dial-peer)#1字头Miami(config-dial-peer)#端口1/0:23
当用户拨打外部长途号码9-1-111-222-3333中,数字被发送到PSTN之前操纵。原来的数字9and1被剥离,以及1作为前缀的剩余数量。因此,PSTN接收数1-111-222-3333。
数量扩张
数量扩张is another way to add digits to an outgoing called number; however, number expansion is applied to the gateway as a whole, and acts on all calls, not just those matching a designated dial peer. As with the previous three techniques, this manipulates only the called number. Number expansion manipulation occurs before any outbound dial peer is matched. Thus, you must configure outbound dial peers to match the expanded numbers, not the original ones.
对数扩展的命令是num-exp原数扩展数在全局配置模式进行配置。虽然它被称为数量扩张中,manipulated number can contain fewer digits than the original, or it can contain more.
Example 10-2 shows two instances of number expansion configured. The first expands any four-number extension beginning with1到七位数年初5551。第二个改变任何七位数年初5551到四位分机。
例10-2号扩展
Miami(config)#num-exp 1... 5551...Miami(config)#NUM-EXP 5551 ... 1 ...!!验证第一数量扩张迈阿密#显示拨号方案号1111宏精通:5551111!!验证第二个数字扩展迈阿密#显示拨号方案号码5551098宏精通:1098
在的结果show dialplan number命令,通知,虽然在命令中输入的号码是原来的号码,路由器寻找匹配的数量有所增加。该show dialplan number命令也用于验证您有一个拨号对等相匹配的扩展许多有用的。
语音翻译规则和配置文件
您可以使用语音翻译的配置文件,其中包含语音转换规则实现更精确,精细操作。先前已描述了该技术可仅改变被叫号码,或拨号码的识别业务(DNIS),数字。翻译型材功能更加强大。他们可以同时更改DNIS和主叫号码或自动号码识别(ANI),数字加重定向数。随着翻译的配置文件,您可以调整编号类型和计划,拒绝根据规则匹配不必要的电话,并删除特定的数字(如连字符)。
一个称为传统技术转换规则(without thevoice) can manipulate ANI and DNIS numbers. This technique is still supported, but the recommended method is to use voice translation rules and voice translation profiles.
使用语音翻译型材位操作需要三个步骤:
Create one or more voice translation rules and a prioritized list of translations associated with each rule. A maximum of 128 rules is supported, with 15 translations per rule.
创建一个或多个语音翻译型材和翻译规则的配置文件关联。您可以定义多达1000个档案,每个都有自己独特的名字。在配置文件,您可以应用一个声音转换规则主叫号码,一个被叫号码,一到重定向被叫号码。
应用语音翻译的个人资料给所有的VoIP呼叫全球,一个拨号对等体,一个语音端口,中继群,源IP组,或接口。
创建语音转换规则
要创建一个语音转换规则,使用命令语音翻译规则tagin global configuration mode. Then create an ordered list of one or more rules with the following command:
规则precedence/匹配模式/ /replace pattern/[type {匹配类型替换型}[计划{匹配类型替换型}]]
您可以输入任何顺序规则;该precedence value determines the order in which the rules are executed. You can configure up to 15 rules.
A basic voice translation rule replaces one group of digits with another. Each group is delineated with//(frontslash) characters. In Example 10-3, voice translation Rule 1 replaces 111 with 222, and 333 with 444. A test of the translations shows that they are carried out as specified.
例10-3使用基本语音转换规则
Boise(config)#语音翻译规则1Boise(cfg-translation-rule)#排除111分之1/ / 222 /Boise(cfg-translation-rule)#规则2/333 / / 444 /博伊西#测试语音翻译规则1 111匹配与规则1原始数:111翻译号码:222原始号码类型:无翻译号码类型:无原始编号计划:无翻译号码计划:无博伊西#测试语音翻译规则1 13335Matched with rule 2 Original number: 13335 Translated number: 14445 Original number type: none Translated number type: none Original number plan: none Translated number plan: none
当数1335is tested, notice that the number patterns are translated no matter where they appear in the string. Notice also that any digits that are not expressly matched—the numbers 1 and 5 in this example—are simply carried through. For more precise control, you can use some special characters and wildcards to build regular expressions, as shown in the next section.
建立正则表达式
A regular expression is a text-parsing tool that combines a string of literal characters and special characters, called元字符。语音翻译规则可以使用正则表达式来查找匹配的数字字符串,并用不同的字符串替换匹配。表10-2列出了一些常用的特殊字符及其含义。
表10-2正则表达式中的特殊字符
| Character | 含义 |
| 。 | 匹配任何单个字符 |
| [] | Matches one number within the brackets; for example, the expression [234] would match either 2, 3, or 4 |
| [^] | 相匹配的号码以外的托架内的一个 |
| - | 括号内使用时表示数字的范围 |
| ^ | 当一个字符串之前使用,表示字符串的开头 |
| $ | 表示字符串的结尾 |
| * | 匹配0次或多次出现以前表达的 |
| + | Matches 1 or more occurrences of the previous expression |
| ? | 匹配0或1个发生前一表达式(使用CTRL-V?在IOS进入) |
| () | 组数字为集 |
| \ | 更改以下字符的含义 |
| & | Brings all the matched digits into the replacement string |
Previously in Example 10-3, the string333被匹配,即使它在列表的中间。如果你想匹配333只有当它出现在一个字符串的开头,你可以使用脱字符:
规则2 / ^ 333 / / 444 /
To match a string containing only333,在结尾处加上美元符号,在开始处插入符号:
规则2 / ^ $ 333 / / 444 /