- 1. ทบทวนกันก่อน
จากตอนที่ 5 และ ตอนที่ 8 เรามี settings ดังนี้
Debian 8 + Asterisk 11
– 2 SIP extensions (2000, 2001)
– 1 SIP trunk (voip)
– 4 FXO ports
มี sip.conf ดังนี้
============
[general]register=adventekvoip:[email protected] ; Register to provider
port=5060 ; Port to bind to (SIP is 5060)
bindaddr=0.0.0.0 ; Address to bind to (all addresses on machine)
allow=all ; Allow all codecs
match_auth_username=yes
defaultuser=adventekvoip ; Username that you get from provider
type=friend
secret=xxxxxxx ; Password
nat=force_rport,comedia
host=77.72.174.128
fromuser=adventekvoip ; Username that you get from provider
fromdomain=77.72.174.128 ; SIP server
dtmfmode=rfc2833
disallow=all
defaultexpirey=20
canreinvite=no
qualify=yes
allow=g729
allow=ulaw
allow=alaw
type=friend ; This device takes and makes calls
defaultuser=2000 ; Username on device
qualify=yes
secret=1234 ; Password for device
host=dynamic
context=from-sip
mailbox=100@default ; Define voicemail for extension 2000
type=friend
defaultuser=2001
qualify=yes
secret=1234
host=dynamic
context=from-sip
mailbox=101@default
มี chan_dahdi.conf ดังนี้
=====================
[trunkgroups] [channels] context = from-pstnsignalling=fxs_ks
usecallerid=yes
hidecallerid=no
callwaiting=yes
usecallingpres=yes
callwaitingcallerid=yes
threewaycalling=yes
transfer=yes
canpark=yes
cancallforward=yes
callreturn=yes
echocancel=yes
echocancelwhenbridged=no
faxdetect=incoming
echotraining=800
rxgain=0.0
txgain=0.0
callgroup=1
pickupgroup=1
;Uncomment these lines if you have problems with the disconection of your analog lines
busydetect=yes
busycount=3
immediate=no
#include dahdi-channels.conf
มี dahdi-channels ดังนี้
==================
; Span 1: WCTDM/0 “Wildcard TDM410P” (MASTER)
;;; line=”1 WCTDM/0/0″
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 1
callerid=
group=
context=default
;;; line=”2 WCTDM/0/1″
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 2
callerid=
group=
context=default
;;; line=”3 WCTDM/0/2″
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 3
callerid=
group=
group=
context=default
;;; line=”4 WCTDM/0/3″
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 4
callerid=
group=
context=default
มี extensions.conf ดังนี้
=====================
[general]static=yes ; These two lines prevent the command-line interface
writeprotect=yes ; from overwriting the config file. Leave them here.
exten => s,1,Dial(SIP/2000,30)
exten => s,2,Hangup();
; If the number dialed by the calling party was “2000”, then
; Dial the user “2000” via the SIP channel driver. Let the number
; ring for 20 seconds, and if no answer, proceed to priority 2.
;
exten => 2000,1,Dial(SIP/2000,20)
exten => 2000,2,Voicemail(100@default)
exten => 2000,3,PlayBack(vm-goodbye)
exten => 2000,4,Hangup
;
; Now, what if the number dialed was “2001”?
;
exten => 2001,1,Dial(SIP/2001,20)
exten => 2001,2,Voicemail(101@default)
exten => 2001,3,PlayBack(vm-goodbye)
exten => 2001,4,Hangup
;
; Define a way so that users can dial a number to reach
; voicemail. Call the VoicemailMain application with the
; number of the caller already passed as a variable, so
; all the user needs to do is type in the password.
;
exten => 2999,1,VoicemailMain()
;
; According to SIP in sip.conf – sip outbound to mm
;
; โทรออกผ่าน SIP trunk
exten => _02XXXXXXX,1,Dial(DAHDI/g0/${EXTEN},30) ; โทร 02 ผ่าน DAHDI trunk
exten => _02XXXXXXX,2,Hangup
exten => _0[689]XXXXXXXX,1,Dial(SIP/voip/${EXTEN},30) ; โทรหามือถือผ่าน SIP trunk
exten => _0[689]XXXXXXXX,2,Hangup
exten => _0[3457]XXXXXXX,1,Dial(SIP/voip/${EXTEN},30) ; โทรต่างจังหวัดผ่าน SIP trunk
exten => _0[3457]XXXXXXX,2,Hangup
- สรุป
ในตอนนี้เราได้ config SIP และ DAHDI trunk รวมทั้งสร้าง dial plan ที่สามารถเลือก trunk
ตามเบอร์ปลายทางที่เราโทรไป แต่ยังไม่ได้รวม special services เช่น 191 (emergency)
181 (เทียบเวลา) 1150 (พิซซ่า) ลองเพิ่มเติมดูได้ครับ
ทิ้งคำตอบไว้
คุณต้องเข้าสู่ระบบ เพื่อจะพิมพ์ความเห็น