asterisk很强大很好使,亲测可用,首先执行下面的操作:
For this install I am using Asterisk 11.0.1 and will be compiling from source on Ubuntu 12.04.1.
注意,这里的含有&&都可以分步做,更好哦。
Before you begin the install process you will want to be sure that your server OS is up to date. When the update completes the server will reboot.
apt-get update && apt-get upgrade -y && reboot
Next you will want to resolve basic dependencies
apt-get install build-essential wget libssl-dev libncurses5-dev libnewt-dev libxml2-dev linux-headers-$(uname -r) libsqlite3-dev
Download the source tarballs. These commands will get the current version of DAHDI, libpri and Asterisk.
cd /usr/src/wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gzwget http://downloads.asterisk.org/pub/telephony/libpri/libpri-1.4-current.tar.gzwget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-11-current.tar.gz
Extract the files from the tarballs
tar zxvf dahdi-linux-complete*tar zxvf libpri*tar zxvf asterisk*
Install DAHDI
cd /usr/src/dahdi-linux-complete*make && make install && make config
Install libpri
NOTE: libpri 1.4.13 won’t compile on Ubuntu 12.04 due to a bug (https://issues.asterisk.org/jira/browse/PRI-145). See the video for how to apply a patch to fix the bug. (Edit: libpri 1.4.14 has been released with this bug fix included. If you are a using 1.4.14 or later you should not encounter this bug.)
cd /usr/src/libpri*make && make install
Install Asterisk. Select your options when the menuselect command runs. Then select “Save & Exit” and the install will continue.
接下来这步会弹出菜单,上下左右键盘操作,回车选择或取消,
建议选上所有Application的组件和尽可能多的CORE支持,但注意单选和不要选择测试模式文件。
cd /usr/src/asterisk*./configure && make menuselect && make && make install && make config && make samples
Start DAHDI
/etc/init.d/dahdi start
Start Asterisk and connect to the CLI
/etc/init.d/asterisk startasterisk -rvvv
Verify your installation by checking for the DAHDI and libpri versions on the Asterisk CLI
*CLI> dahdi show versionDAHDI Version: 2.6.1 Echo Canceller: HWEC*CLI> pri show versionlibpri version: 1.4.13
Congratulations! You now have Asterisk 11 running on Ubuntu 12.04. To continue configuring Asterisk check out the quick start guide or take a look at the official Digium online training.
上面做完了,Asterisk就完事了,下面安装Asterisk-Gui。
2. 去http://downloads.asterisk.org/pub/telephony/asterisk-gui/releases/下载最新的Asterisk GUI
本人使用的是:http://downloads.asterisk.org/pub/telephony/asterisk-gui/releases/asterisk-gui-2.1.0-rc1.tar.gz而且没有出现后面说到的警告循环问题,警告一次后即完成文件生成。
3. 下载并解压缩
wget http://downloads.asterisk.org/pub/telephony/asterisk-gui/releases/asterisk-gui-2.1.0-rc1.tar.gz
tar zxvf asterisk-gui-2.1.0-rc1.tar.gz
4. 安装Asterisk GUI
$ ./configure
$ make
$ sudo make install
完成之后,可每执行一次下面的步骤,便运行make checkconfig进行配置完成检查,注意保持路径,也可以不执行下面的第5步,而直接执行配置检查,根据报错逐个修改,最后根据提示修改文件,创建用户名密码。
5. 修改/etc/asterisk/http.conf
enabled=yes
bindaddr=0.0.0.0 #0.0.0.0表示本机的所有IP都可以访问
bindport=8088
enablestatic=yes
修改/etc/asterisk/manager.conf
[general]
enabled = yes
webenabled = yes
port = 5038
bindaddr = 0.0.0.0
[admin] #登录时的账户名称
secret=admin #登录时的账户密码
read = system,call,log,verbose,command,agent,config,read,write,originate
write = system,call,log,verbose,command,agent,config,read,write,originate
6. 复制文件及创建连接 (这一步很重要,网上的很多教程都没有这一步,可能会导致”404 not found”, 权限不够等问题)
$ sudo cp -Rfv /var/lib/asterisk/* /usr/share/asterisk/
$ sudo mv /var/lib/asterisk /var/lib/asterisk_original
$ sudo ln -s /usr/share/asterisk /var/lib/asterisk
$ sudo chmod 777 /usr/share/asterisk/* -R
7. 重启asterisk服务
此处务必要使用root, 否则虽然能启动asterisk,但是http server会总是disabled的状态。
同时asterisk -r是也需要root,否则会出现错误:Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)
$ sudo /etc/init.d/asterisk restart
$ sudo asterisk -r
进入asterisk操作界面后运行运行”http show status “可以查看Http服务状态
看到如下状态则成功了。
royn-VGN-Z690J*CLI> http show status
HTTP Server Status:
Prefix:
Server Enabled and Bound to 0.0.0.0:8088
Enabled URI’s:
/httpstatus => Asterisk HTTP General Status
/phoneprov/… => Asterisk HTTP Phone Provisioning Tool
/amanager => HTML Manager Event Interface w/Digest authentication
/arawman => Raw HTTP Manager Event Interface w/Digest authentication
/manager => HTML Manager Event Interface
/rawman => Raw HTTP Manager Event Interface
/static/… => Asterisk HTTP Static Delivery
/amxml => XML Manager Event Interface w/Digest authentication
/mxml => XML Manager Event Interface
Enabled Redirects:
None.
8. 登陆页面
http://localhost:8088/static/config/index.html
注意,修改完成配置文件manager.conf后,直接登录GUI将显示用户名或密码不正确,此时应该重新启动系统,然后登录,接着会看到一个配置更新的警告界面,之后再次登录,即可使用。
ID:admin Password: admin
这里还有要注意的,GUI的设置并不会立即生效,需要重新启动ASTERISK服务才能生效!
——–相关解决说明:
此时页面会陷入死循环,不断刷新,显示:
Your configuration will now be upgraded to work with the latest version of GUI.
这是asterisk-gui和asterisk 1.8不兼容导致的。
修改 /var/lib/asterisk/static-http/config/js/index.js重新登陆即可。
if ( resp_lower.contains(“branches/1.6″) || resp_lower.contains(“asterisk/1.6″) || resp_lower.contains(“svn-branch-1.6″) || resp_lower.contains(“svn-trunk-”) )
..
改为
replace:
if ( resp_lower.contains(“branches/1.6″) || resp_lower.contains(“asterisk/1.6″) || resp_lower.contains(“svn-branch-1.6″) || resp_lower.contains(“svn-trunk-”) || resp_lower.contains(“asterisk/1.8″) )