標籤:
伺服器上安裝一個 Digium 卡,並安裝好驅動
所需要的軟體包
http://downloads.asterisk.org/pub/telephonyasterisk-11.17.1.tar.gzlibpri-1.4.15.tar.gzdahdi-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驅動
#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 #進入控制台
4,配置asterisk -- sip.conf
#cd /etc/asterisk.conf#cp -pa sip.conf sip.conf.bak#> sip.conf#vi sip.conf[general]allowguest=yesallowoverlap=yesbindport=5060bindaddr=0.0.0.0srvlookup=yesdtfmode=rfc2833disallow=allallow=g729allow=gsm[sip](!)type=friendhost=dynamicnat=nocanreinvite=nocontext=demo99[9901](sip)username=9901secret=123456[9902](sip)username=9902secret=123456
5, 配置asterisk -- iax.conf
#cp -pa iax.conf iax.conf.bak#> iax.conf#vi iax.conf[general]bindport=4569bindaddr=0.0.0.0bandwidth=lowdisallow=allallow=gsmallow=g729jitterbuffer=noforcejitterbuffer=noautokill=yes[iax](!)type=friendport=4569host=dynamiccontext=demo99qualify=yes;transfer=no;auth=md5[6601](iax)username=6601secret=123456[6602](iax)username=6602secret=123456
6, 配置extension.conf
給系統分配電話號碼 1)如果要打外線需要先撥 9;2)如果從電話上(連在 Asterisk
伺服器上的那個電話)接電話的話,Dial(dahdi/g1,20,rt);3)想把 incoming 電話轉接到手機上(電話號碼是
990x)的話,Dial(SIP/990x,20):
#cp -pa extension.conf extension.conf.bak#> extension.conf#vi extension.conf[general]static=yeswriteprotect=noautofallthrough=noclearglobalvars=nopriorityjumping=no[globals]CONSOLE=Console/dsp ; Console interface for demoIAXINFO=guest ; IAXtel username/passwordTRUNK=DAHDI/G2 ; Trunk interfaceTRUNKMSD=1 ; MSD digits to strip (usually 1 or 0)[demo99]exten => _99.,1,Dial(SIP/${EXTEN},,r) #$EXTEN 為匹配註冊的號碼,如9901,這裡匹配的就是9901exten => _99.,2,Hangupexten => _66.,1,Dial(IAX2/${EXTEN},20,r)exten => _66.,2,Hangupexten => 99999,1,Dial(dahdi/g1,20,rt)exten => 99999,2,Hangupexten => _9.,1,Dial(dahdi/g2/${EXTEN:1})[incoming]exten => s,1,Answer()exten => s,2,Dial(dahdi/g1,20,rt)
7, 進入控制台,重新載入
*CLI> reload*CLI> iax2 reload #只重新載入iax2*CLI> sip reload #只重新載入sip
8,我這邊直接用安卓zoiper 串連到sip伺服器
*CLI> sip show peers #可以看到已經註冊上來的號碼
Centos 5.4 下安裝和配置 Asterisk 和 Digium 卡