This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@v2:~# cat /etc/asterisk/extensions.conf | |
;================================== | |
; extensions.conf - the Asterisk dial plan | |
; | |
[general] | |
static=no | |
writeprotect=no | |
autofallthrough=yes | |
clearglobalvars=no | |
priorityjumping=no | |
[globals] | |
gtimeout=50 ; timeout value | |
;定义两个电话客户端PHONE00和PHONE01 | |
PHONE00=SIP/8000 | |
PHONE01=SIP/8001 | |
;下面定义了内线电话的拨号规则,当电话拨打80开头的4为号码(_80XX)就转接到PHONE(前面有定义)开头的电话上去,至于是PHONE00还是PHONE01则是将80XX的前两位去掉( EXTEN:2) | |
[internal] | |
exten => _80XX,1,Dial(${PHONE${EXTEN:2}},${gtimeout},tr) | |
exten => _80XX,n,Hangup() | |
;下面这一段则是定义当公司或者朋友拨打联通wo-call号码时,转接到哪个内线上 | |
;更高阶的做法是做一个轮循弄成call center | |
[sip] | |
exten => s,1,Dial(${PHONE00},${gtimeout},tr) ;consistent with the line of register in sip.conf | |
exten => s,n,Hangup() | |
[phone] | |
include => internal | |
include => sip | |
include => voipms-outbound | |
include => messages | |
;下面定义拨打啥号码时才使用外线联通号码拨出 | |
;这里我是定义了当拨打任意7位以上(注意XX后面有个小数点. 它代表无限长度) | |
;voipms就是在sip.conf中定义的 | |
[voipms-outbound] | |
exten => _XXXXXXX.,1,Dial(SIP/voipms/${EXTEN},60) | |
exten => _XXXXXXX.,n,Hangup() | |
[messages] | |
exten => _80XX.,1,Set(ACTUALTO=${CUT(MESSAGE(<),@,5)}) | |
exten => _80XX.,n,MessageSend(${ACTUALTO},${MESSAGE(from)}) | |
exten => _80XX.,n,NoOp(Send status is ${MESSAGE_SEND_STATUS}) | |
exten => _80XX.,n,GotoIf($["${MESSAGE_SEND_STATUS}" != "SUCCESS"]?sendfailedmsg) | |
exten => _80XX.,n,Hangup() | |
; | |
; Handle failed messaging | |
exten => _X.,n(sendfailedmsg),Set(MESSAGE(body)="[${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)}] | |
Your message to ${EXTEN} has failed. Retry later.") | |
exten => _X.,n,Set(ME_1=${CUT(MESSAGE(from),<,2)}) | |
exten => _X.,n,Set(ACTUALFROM=${CUT(ME_1,@,1)}) | |
exten => _X.,n,MessageSend(${ACTUALFROM},ServiceCenter) | |
exten => _X.,n,Hangup() | |
;========end of extensions.conf============ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment