Cisco VoIP配置中translation-rule命令的用法
Cisco VoIP配置中translation-rule命令的用法
一、概述
Translation-rule用于增加、移除和替换VoIP中dial-peer拨号对等体inbound和outbound号码。它有以下几种应用:
1、 应用于所有inbound call legs。
2、 应用于特定voice-port的所有inbound call legs。
3、 应用于特定dial-peer的所有outbound call legs。
二、命令格式
Translation-rule在全局模式侠有以下两种命令配置方式:
1、 (config)translation-rule rule_tag
(config-rule)rule <0-10> match pattern replacement pattern
应用translation-rule:
1) 所有inbound call legs
(config) voip-incoming translation-rule rule_tag {called/calling}
2) 特定voice-port的所有inbound call legs
(config)voice-port 0/0/0
(config-voiceport)translate {called/calling} rule_tag
3) 特定dial-peer的所有outbound call legs
(config)dial-peer voice 10 pots
(config-dial-peer)translate-outgoing {called/calling} rule_tag
2、 (config)voice translation-rule rule_tag
(config-rule)rule <1-15> /match pattern/ /replacement pattern/
应用voice translation-rule:
1) 创建voice translation-profile
(config) voice translation−profile profile_name
(cfg-translation-profile) translate {called/calling} rule_tag
2) 特定的dial-peer所有incoming和outgoing call legs
(config)dial-peer voice 10 pots
(config-dial-peer)translation-profile {incoming/outgoing} profile_name
三、通配符
1、 数字通配符
2、其他符号:
四、用法示例
1、将40开头的5位号码替换为号码"6666000":
voice translation−rule 1
rule 1 /^40.../ /6666000/
router#test voice translation−rule 1 40123
Matched with rule 1
Original number: 40123 Translated number: 6666000
2、将所有号码替换为 "5554000":
voice translation−rule 2
rule 1 /.*/ /5554000/
router#test voice translation−rule 2 123
Matched with rule 1
Original number: 123 Translated number: 5554000
router#test voice translation−rule 2 86573
Matched with rule 1
Original number: 86573 Translated number: 5554000
router#test voice translation−rule 2 ""
Matched with rule 1
Original number: Translated number: 5554000
3、将所有非空号码替换为 "5554000".
voice translation−rule 2
rule 1 /.+/ /5554000/
router#test voice translation−rule 2 123
Matched with rule 1
Original number: 123 Translated number: 5554000
router#test voice translation−rule 2 ""
Didn't match with any of rules
4、保留最后3位号码至5554开头的后3位:
voice translation−rule 2
rule 1 /^....(...\)/ /5554\1/
router#test voice translation−rule 2 1234567
Matched with rule 1
Original number: 1234567 Translated number: 5554567
router#test voice translation−rule 2 123456
Didn't match with any of rules