本帖最後由 角色 於 2014-2-1 12:02 編輯
说明:
假如我的HKBN 2b Account为 33661234, 而密码是password。
用指令register,去告诉HKBN 2b系统,如果有打入33661234电话,然后叫HKBN 2b系统把电话转到我的Asterisk系统。
当电话转到了Asterisk系统,然后去哪儿?那么Asterisk系统会根据HKBN 2b的sip.conf, [hkbn2b]里的context label是什么?现在是在[hkbn2b]下的context=from-hkbn。
然后在extensions.conf,找出[from-hkbn], 打入的电话就会从那里帅选。打入来的callerID,在Asterisk script怎样体现呢?就是用{CALLERID(num)}来体现。在Asterisk script里当然还有其他指令,大家要学会怎样用他们,那么只能看手册。
sip.conf- ;hkbn 2b
- register => 33661234hk:password@s2hkbntel.net:5060/33661234
- [hkbn2b]
- type=peer
- username=33661234hk
- secret=password
- port=5060
- host=s2hkbntel.net
- fromuser=33661234hk
- fromdomain=s2hkbntel.net
- canreinvite=no
- canredirect = no
- insecure=port,invite
- dtmfmode=auto
- context=from-hkbn
複製代碼 extensions.conf- ;hkbn 2b dial-in
- [from-hkbn]
- exten => 33661234,1,GotoIf($[${CALLERID(num)} = 99881234]?Mary-call)
- exten => 33661234,n,GotoIf($[${CALLERID(num)} = 22331234]?John-call)
- exten => 33661234,n,GotoIf($[${CALLERID(num)} = anonymous]?Anonymous-call)
- exten => 33661234,n,GotoIf($[${CALLERID(num)} = 33441234]?Anonymous-call)
- exten => 33661234,n,Dial(SIP/2005,,r)
- exten => 33661234,n,Hangup()
- exten => 33661234,n(Mary-call),GoTo(internal-Mary,1130,1)
- exten => 33661234,n(John-call),Goto(internal-John,1130,1)
- exten => 33661234,n(Anonymous-call),Answer()
- exten => 33661234,n(Anonymous-call),Playback(tt-monkeys)
- exten => 33661234,n(Anonymous-call),Hangup()
- [internal-Mary]
- ;MACAU gateway, country code = 853
- include => trunk-macao-pstn
- ;China dateway 0086 superdial
- include => trunk-superdial-china-0086
- ;IVR
- exten => 1130,1,Answer
- exten => 1130,n,Wait(3)
- exten => 1130,n,Background(vm-enter-num-to-call)
- exten => 1130,n,WaitExten
- exten => 1130,n,Playback(vm-goodbye)
- exten => 1130,n,Hangup
- exten => i,1,Playback(pbx-invalid)
- exten => i,2,Goto(1130,1)
- exten => t,1,Playback(vm-goodbye)
- exten => t,2,n,Hangup
複製代碼 |