服务器上安装一个 Digium 卡,并安装好驱动
所需要的软件包下载地址
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驱动
#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=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
给系统分配电话号码 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=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, 进入控制台,重新加载
*CLI> reload
*CLI> iax2 reload #只重新加载iax2
*CLI> sip reload #只重新加载sip
8,我这边直接用安卓zoiper 连接到sip服务器
*CLI> sip show peers #可以看到已经注册上来的号码
中国足彩网信息请查看IT技术专栏