服務(wù)器上安裝一個 Digium 卡,并安裝好驅(qū)動
所需要的軟件包下載地址
asterisk-11.17.1.tar.gz
libpri-1.4.15.tar.gz
dahdi-linux-complete-current.tar.gz
1,安裝依賴包
yum -y install libtermcap-devel libxml2-devel zlib-devel zib sqlite-devel openssl-devel ncurses-devel ncurses kernel-devel
2,安裝dahdi驅(qū)動
#tar zxf dahdi-linux-complete-current.tar.gz && cd dahdi-linux-complete-current
#cd linux
#make && make install
#cd ../tools
#./configure
#make && make install
#make config #生成啟動文件
2,安裝libpri
#tar zxf libpri-1.4.15.tar.gz && cd libpri-1.4.15 #需要安裝到dahdi后面,才行
#make && make install
3, 安裝asterisk
#tar zxf asterisk-11.17.1.tar.gz && cd asterisk-11.17.1
#./configure
#make
#make install
#make samples #生成asterisk 示例配置文件
#make config #生成啟動文件
#/etc/init.d/asterisk start
#asterisk -crvvvv #進(jìn)入控制臺
4,配置asterisk -- sip.conf
#cd /etc/asterisk.conf
#cp -pa sip.conf sip.conf.bak
#> sip.conf
#vi sip.conf
[general]
allowguest=yes
allowoverlap=yes
bindport=5060
bindaddr=0.0.0.0
srvlookup=yes
dtfmode=rfc2833
disallow=all
allow=g729
allow=gsm
[sip](!)
type=friend
host=dynamic
nat=no
canreinvite=no
context=demo99
[9901](sip)
username=9901
secret=123456
[9902](sip)
username=9902
secret=123456
5, 配置asterisk -- iax.conf
#cp -pa iax.conf iax.conf.bak
#> iax.conf
#vi iax.conf
[general]
bindport=4569
bindaddr=0.0.0.0
bandwidth=low
disallow=all
allow=gsm
allow=g729
jitterbuffer=no
forcejitterbuffer=no
autokill=yes
[iax](!)
type=friend
port=4569
host=dynamic
context=demo99
qualify=yes
;transfer=no
;auth=md5
[6601](iax)
username=6601
secret=123456
[6602](iax)
username=6602
secret=123456
6, 配置extension.conf
給系統(tǒng)分配電話號碼 1)如果要打外線需要先撥 9;2)如果從電話上(連在 Asterisk
服務(wù)器上的那個電話)接電話的話,Dial(dahdi/g1,20,rt);3)想把 incoming 電話轉(zhuǎn)接到手機上(電話號碼是
990x)的話,Dial(SIP/990x,20):
#cp -pa extension.conf extension.conf.bak
#> extension.conf
#vi extension.conf
[general]
static=yes
writeprotect=no
autofallthrough=no
clearglobalvars=no
priorityjumping=no
[globals]
CONSOLE=Console/dsp ; Console interface for demo
IAXINFO=guest ; IAXtel username/password
TRUNK=DAHDI/G2 ; Trunk interface
TRUNKMSD=1 ; MSD digits to strip (usually 1 or 0)
[demo99]
exten => _99.,1,Dial(SIP/${EXTEN},,r) #$EXTEN 為匹配注冊的號碼,如9901,這里匹配的就是9901
exten => _99.,2,Hangup
exten => _66.,1,Dial(IAX2/${EXTEN},20,r)
exten => _66.,2,Hangup
exten => 99999,1,Dial(dahdi/g1,20,rt)
exten => 99999,2,Hangup
exten => _9.,1,Dial(dahdi/g2/${EXTEN:1})
[incoming]
exten => s,1,Answer()
exten => s,2,Dial(dahdi/g1,20,rt)
7, 進(jìn)入控制臺,重新加載
*CLI> reload
*CLI> iax2 reload #只重新加載iax2
*CLI> sip reload #只重新加載sip
8,我這邊直接用安卓zoiper 連接到sip服務(wù)器
*CLI> sip show peers #可以看到已經(jīng)注冊上來的號碼
更多信息請查看IT技術(shù)專欄