R1----------------------------
clock set 10:16:30 31 mar 2019
ntp master 3
show ntp status
int f0/0
ip add 142.100.64.254 255.255.255.0
no shutdown
telephony-service
max-dn 10
max-ephone 10
ip source 142.100.64.254
create cnf-files
ephone-dn 1 du
number 1001
name BJ Phone 1
ephone-dn 2 du
number 2001
name SH Phone 1
ephone-dn 3 dual-line
number 3001
name NY Phone 1
show ephone reg
ephone 1
mac-address x.x.x.x
type cipc
button 1:1 2:2 3:3
reset
int f0/1
ip add 10.0.0.1 255.255.255.0
no shutdown
R2-------------------------------
int f0/1
ip add 10.0.0.2255.255.255.0
no sh
int f0/0
ip add 142.100.65.254 255.255.255.0
no sh
ntp server 10.0.0.1
telephony-service
max-dn 10
max-ephone 10
ip source 142.100.65.254
create cnf-files
ephone-dn 1 du
number 88881111
name BJ PSTN
ephone-dn 2 du
namber 66661111
name SH PSTN
ephone-dn 3 du
number 5151111
name NY PSTN
ephone-dn 4 du
number 110
name 110
ephone 1
mac-address x.x.x.x
button 1:1 2:2 3:3 4:4
type cipc
reset
show dial-peer voice summary
------------------------------------
外线标识符
9
0
*83
本地加拨9
长途加90,0送运营商
国际加900,00送运营商
紧急号码110,直拨
因为VOIP不吃号,被叫号码需要被转换
主叫号码根据类型转数位
本地4位变8位
长途4位变11位
国际长途E.164全号 3001--0012125153001
-------------------------------------
R1---------------------------------
dial-peer voice 9 voip
destination-pattern 9[^0]T //非0用于避免拨号外号,意思是本地
session target ipv4:10.0.0.2
session protocol sipv2
dtmf-relay rtp-nte sip-kpml sip-notify
no vad
codec g711ulaw
dial-peer voice 90 voip
destination-pattern 90[^0]T //90[1-9]T
session target ipv4:10.0.0.2
session protocol sipv2
dtmf-relay rtp-nte sip-kplm sip-notify
no vad
codec g711ulaw
dial-peer voice 900 voip
destination-pattern 900T
session target ipv4:10.0.0.2
session protocol sipv2
no vad
codec g711ulaw
dtmf-relay rtp-nte sip-kpml sip-notify
dial-peer voice 110 voip
destination-pattern 110
session target ipv4:10.0.0.2
session protocol sipv2
no vad
codec g711ulaw
dtmf-relay rtp-nte sip-kpml sip-notify
//定义转换规则
voice translation-rule 9
rule 1 /^9([^0].*)$/ /1/
test voice translation-rule 9 988881111
voice translation-rule 90
rule 1 /^9(0[^0].*)$/ /1/
voice translation-rule 900
rule 1 /^9(00.*)$/ /1/
//定义转换profile
voice translation-profile out9
translate called 9
voice translation-profile out90
translate called 90
voice translation-profile out900
translate called 900
//调用profile
dial-peer voice 9
translation-profile outgoing out9
telephony-service
timeouts interdigit 3
//考虑主叫的送号
voice translation-rule 2
rule 1 /^1...$/ /8888 /
voice translation-profile out9
translate calling 2
//拨打长途的要求
902166661111
主叫:01088881001 voice translation-rule 3
被叫:02166661111 voice translation-rule 90
voice translation-rule 3
rule 1 /^1...$/ /0108888 /
voice translation-profile out90
translate calling 3
translate called 90
dial-peer voice 90
translation-profile outgoing out90
R2,debug ccsip message
R2模拟运营商-------------------------------------
voice translation-rule 1
rule 1 /^021(66661111)$/ /1/
or
rule 1 /^021(.*)$/ /1/ //建议
voice translation-profile invoip
translate called 1
voip-incoming translation-profile invoip
//拨打国际长途要求
1001--->90012125151111
主叫:1001---->E.164全号 00 86 010 88881001
被叫:90012125151111 去掉9
R1------------------------------------------
voice translation-rule 4
rule 1 /^1...$/ /00860108888 /
voice translation-profile out900
translate calling 4
dial-peer voice 900
translation-profile outgoing out900
R2模拟运营商------------------------------
voice translation-rule 1
rule 2 /^001212(.*)$/ /1/
R1---------------------------------------------
voice translation-profile out110
translate calling 3
dial-peer voice 110
translation-profile outgoing out110