CentOS + Asterisk + FreePBX ——支持蓝牙,AMR-NB audio codec
CentOS + Asterisk + FreePBX
——支持蓝牙,AMR-NB audio codec
配置前的软件包列表以及下载(或者到我个人的百度云网盘下载也可)
网盘地址:http://pan.baidu.com/s/1eQmvb0I
软件 |
版本 |
文件名称 |
备注 |
|||||||||||||||||||||||||||||
CentOS |
6.5 |
CentOS-6.5-i386-bin-DVD1.iso |
||||||||||||||||||||||||||||||
Asterisk |
11.0.1 |
|||||||||||||||||||||||||||||||
Asterisk 运行需求(列表即是按照顺序,可选安装根据个人需求而定)
|
||||||||||||||||||||||||||||||||
VMware |
10 |
有可能无法识别PCI设备 |
说明:本文档中所有黑体均表示CentOS下的相关终端命令。
1. 下载CentOS 6.5
国内高速下载
http://www.centoscn.com/plus/download.php?open=2&id=2196&uhash=4882f31be69e25a9c044f020
2. Windows XP/2003/Win7上用VMware 10安装CentOS 6.5
虚拟机安装部分略过
3. 下载 Asterisk,dahdi,libpri,libsrtp。
切换至文件目录存放目录 /usr/src/
su -
cd /usr/src
4. 下载Asterisk 11.0.1
wget http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-11.0.1.tar.gz
5. 下载dahdi
wget http://downloads.Asterisk.org/pub/telephony/dahdi-linux-complete/releases/dahdi-linux-complete-2.10.0.1+2.10.0.1.tar.gz
6. 下载libpri
wget http://downloads.Asterisk.org/pub/telephony/libpri/releases/libpri-1.4.11.4.tar.gz
7. 下载libsrtp
wget http://sourceforge.net/projects/srtp/files/srtp/1.4.4/srtp-1.4.4.tgz/download
8. 安装相关的依赖软件
yum -y install kernel-devel gcc make gcc-c++ libxml2-devel pkgconfig zlib-devel
yum -y install openssl-devel ncurses-devel autoconf automake libtool zip unzip
yum -y install sqlite-devel sqlite3-ruby
9. tar -xzvf asterisk-11.0.1.tar.gz
10. tar –xzvf dahdi-linux-complete-2.10.0.1+2.10.0.1.tar.gz
11. tar -xzvf libpri-1.4.11.4.tar.gz
12. tar -xzvf srtp-1.4.4.tgz
13. 编译srtp,dahdi,libpri,Asterisk (注意编译的顺序)
------------------------------------------------------------------------------------------------------------------------------------------------
编译srtp
cd /usr/src/srtp
CFLAGS="-Wall-O4 -fexpensive-optimizations -funroll-loops -fPIC"
./configure --prefix=/usr
make
vi /root/.bash_profile
修改PATH=$PATH:$HOME/bin为 PATH=$PATH:$HOME/bin:.
su -
cd/usr/src/srtp
否则make runtest报错:rtpw_test.sh:line 27: rtpw: command not found
makeruntest
makeinstall
make clean
-----------------------------------------------------------------------------------------------------------------------------------------------
编译dahdi
cd ../dahdi-linux-complete-2.5.0.2+2.5.0.2
makeall
连接无法更新解决方案:
sudo fc-cache -fv 2>&1 | grep failed| cut -f1 -d":" | xargs -i sudo touch {} && sudo fc-cache –fv
出错处理:(务必对应当前的CentOS版本)
You do notappear to have the sources for the 2.6.32-431.el6.i686 kernel installed.
uname -r
2.6.32-431.el6.i686
cd /lib/modules/
看到下面有 2.6.32-431.el6.i686 2.6.32-504.1.3.el6.i686(这个是我执行yum update出现的,同样启动菜单里面也会多出这一项内核版本启动选项)
解决办法1:
使用ISO镜像安装对应的rpm安装包,至于如何挂载详解我的另一篇文章:CentOS配置Asterisk + FreePBX + mysql +PHP 一些问题的说明
进入kernel-devel-2.6.32-431.el6.i686.rpm对应的目录,执行以下的命令
rpm -i kernel-devel-2.6.32-431.el6.i686.rpm
解决办法2:
yum -y install kernel-devel-`uname -r`
make install
-----------------------------------------------------------------------------------------------------------------------------------------------
安装dahdi(可以根据dahdi文件下的ReadMe提示进行安装)
make all
make install
make config
屏幕提示:(已安装硬件)
/sbin/chkconfig--add dahdi
DAHDI hasbeen configured.
List ofdetected DAHDI devices:
pci:0000:03:07.0 wctdm24xxp+ d161:8005 Wildcard TDM410P提示检测到硬件Wildcard TDM410P
run'dahdi_genconf modules' to load support for only
the DAHDIhardware installed in this system. By
defaultsupport for all DAHDI hardware is loaded at
DAHDI start.
若出现提示:(未安装硬件)
List of detected DAHDI devices:
No hardware found
则表示需要对应的硬件
-----------------------------------------------------------------------------------------------------------------------------------------------
编译libpri
cd ../libpri-1.4.11.4
make
make install
-----------------------------------------------------------------------------------------------------------------------------------------------
编译Asterisk
make menuconfig前置包安装
yum -y install ncurses-devel
cd asterisk-11.0.1
contrib/scripts/install_prereq install
注意:如要mp3,需要执行下面操作
yum-y install subversion
contrib/scripts/get_mp3_source.sh
注意:如要ilbc codec,需要执行下面操作
contrib/scripts/get_ilbc_source.sh
cdcodec/ilbc/
看到里面只有几个文件
extract-cfile.awkrfc3951.txt
拷贝 http://ilbcfreeware.org/documentation/extract-cfile.txt内容到extract-cfile.awk
awk -f extract-cfile.awk rfc3951.txt
这将在这个目录下面产生几十个文件。
cd ../../
./configure --with-bluetooth
make menuconfig
(add-on 选择chan_mobile, format_mp3, 其余的根据需要自己选择 )
准备工作完成后进入asterisk正式编译步骤
make
make install
make config
make samples
(生成Asterisk相关的例子配置文件位于/etc/Asterisk/文件夹中)
-----------------------------------------------------------------------------------------------------------------------------------------------
14. 启动dahdi
service dahdi restart
15. 启动asterisk
service asterisk restart
16. 查看端口5060使用情况来判定asterisk服务是否已经启动
netstat -na|grep 5060
udp 0 0 0.0.0.0:5060 0.0.0.0:*
17. 添加AMR codec的支持(可选,因为用的1.8.0的版本存在不兼容的情况,目前暂时没有添加该功能)
开始配置Asterisk前,需要添加一些工具。用到工具有ARM-NB codec编码方式支持移动电话从而能得到最好的音质。
先停止Asterisk服务
service asterisk stop
进入/usr/src文件夹,下载Asterisk-amr补丁。
cd /usr/src/
wget http://sourceforge.net/projects/asterisk-amr/files/1.8.0-rc2_asterisk_amr_patch.diff/download
cd asterisk-11.0.1/ && patch -p2< ../1.8.0-rc2_asterisk_amr_patch.diff
cd ../asterisk-11.0.1/codecs/amr/
从3GPP网站下载AMR codec
wget http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-700.zip
unzip -j 26104-700.zip
unzip -j 26104-700_ANSI_C_source_code.zip
回到asterisk-11.0.1目录
cd ../.. /..
wget http://sourceforge.net/projects/asterisk-amr/files/1.8.0-rc2_crypto_offer.diff/download
cd asterisk-11.0.1/&& patch -p2 < ../1.8.0-rc2_crypto_offer.diff 补丁未打成功
切换至asterisk-11.0.1/目录
cd asterisk-11.0.1
重新编译asterisk-11.0.1
make ; make install
启动asterisk
asterisk -rvvvvvvvvvvv
core show codecs
2048 (1<< 11) (0x800) audio g726 (G.726 RFC3551)
4096 (1<< 12) (0x1000) audio g722 (G722)
8192 (1<< 13) (0x2000) audio amr (AMR NB)
-----------------------------------------------------------------------------------------------------------------------------------------------
18. 以下为可选步骤
19. 设置runlevel 3
编辑/etc/inittab(根据需要配置为自己需要的启动方式,我未更改此选项,3表示console)
id:3:initdefault:
20. 安装vncserver
yum -y install vnc
------------------------------------------------------------------------------------------------------------------------------------------------
每小时reboot一次:
cd /etc/cron.hourly/
touch reboot
chmod 777 reboot
#!/bin/sh
/sbin/reboot
------------------------------------------------------------------------------------------------------------------------------------------------
关闭Ubuntu防火墙
# service iptables save
#service iptables stop
#chkconfig iptables off
------------------------------------------------------------------------------------------------------------------------------------------------
21. 启用amr codec(17步成功后设置)
vi sip_general_additional.conf
修改
disallow=all
allow=ulaw
allow=alaw
为
allow=all
可选步骤到此为止
22. 重新启动Asterisk
service asteriskrestart
23. 安装FreePBX-2.11.0
------------------------------------------------------------------------------------------------------------------------------------------------
1) 查看系统中是否缺少以下服务,缺少将用 ”yum install服务名“来安装
安装bind,httpd,sendmail,mysql,mysql-server
yum -y install bind httpdsendmail mysql mysql-server
------------------------------------------------------------------------------------------------------------------------------------------------
2) 禁用Selinux
说明:这个是安全级别和防火墙的东西,启用的话会影响我们的freepbx的安装。
vi /etc/sysconfig/selinux
把 SELINUX=enforcing
改成 SELINUX=disabled
保存:wq
重启
reboot
3) 安装需要的扩展包
yum -y install e2fsprogs-devel keyutils-libs-devel krb5-devel libogg libselinux-devel libsepol-devel libxml2-devel
yum -y install libtiff-devel gmp php-pear php-pear-DB php-gd php-mysql php-pdo php-posix kernel-devel ncurses-devel audiofile-devel
yum -y install libogg-devel openssl-devel mysql-server mysql-devel zlib-devel perl-DateManip sendmail-cf sox
------------------------------------------------------------------------------------------------------------------------------------------------
4) 安装 phpmyadmin(可选)
------------------------------------------------------------------------------------------------------------------------------------------------
① 下载phpMyAdmin-2.11.11.2-english.zip
wget http://jaist.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/2.11.11/phpMyAdmin-2.11.11-english.zip
unzip phpMyAdmin-2.11.11-english.zip
mv phpMyAdmin-2.11.11-english phpmyadmin
chown asterisk:asterisk -R phpmyadmin/
chmod777 -R phpmyadmin/
mv phpmyadmin /var/www/html
cd /var/www/html/phpmyadmin/libraries/
vi config.default.php
$cfg['blowfish_secret']= 'xxxx';
$cfg['Servers'][$i]['password']= 'password';
service mysqld start
mysqladmin -u root password "password"
vi /etc/httpd/conf/httpd.conf
加入 ServerName asterisk1101
修改
User asterisk
Group asterisk
chmod 777 /var/lib/php/session/
chmod 777 -R /var/lib/php/session/* ——有可能提示没有这个目录,不用理会
service mysqld restart
/etc/init.d/httpd restart
在浏览器中输入后面的网址http://asterisk1101/phpmyadmin/测试访问结果(我登录是用http://localhost/ phpmyadmin/,或者是http://你的IP/ phpmyadmin/,似乎ServerName没有解析对)
排错:
Forbidden
You don't have permission toaccess /phpmyadmin/ on this server.
原因1:没有关闭SE Linux,或者关闭了SE Linux配置但是没有reboot Linux
原因2:phpmyadmin的owner不是asterisk,mode不是777
-------------------------------------------------------------------------------------------------------------------------------------------
② 安装lame
wget http://sourceforge.net/projects/lame/files/lame/3.99/lame-3.99.5.tar.gz/download或
wget http://nchc.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar -zxvf lame-3.99.5.tar.gz
cd lame-3.99.5
./configure
make
make install
5) 安装FreePBX
这个必须在asterisk 完全安装后才能装
下载地址:http://www.freepbx.org(官方)
wgethttp://mirror.freepbx.org/freepbx-2.11.0.38.tgz
tar-xvf freepbx-2.11.0.38.tar.gz
cd freepbx-2.11.0.38
./start_asteriskstart
PS:把mysql密码设置为空,方便运行以下命令(建立相关asterisk 数据库)
/etc/init.d/mysqld start
mysql -u root –p password
mysql>set password for root@localhost=password('');
mysql>exit;
mysql -u root (测试可以通过空口令登录)
mysqladmin create asterisk
mysqladmin create asteriskcdrdb
mysql asterisk < SQL/newinstall.sql
mysql asteriskcdrdb < SQL/cdr_mysql_table.sql
mysql –u root
mysql> GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY'password';
mysql> GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'password';
mysql> flush privileges;
mysql> quit;
把mysql密码设置不能为空
mysqladmin -u root password "password"
再运行以下命令
./install_amp --username=root --password=password //这里我的mysql用名为root,密码是password
提示:PEAR must be installed (requires DB.php)
则执行pear install DB即可。
以下是终端的一些输出提示:
Checking for PEAR DB..OK
Checking for PEARConsole::Getopt..OK
Using username: root
Using password: ********
Checking user..OK
Checking if Asterisk isrunning..running with PID: 4173..OK
Checking for/etc/amportal.conf../etc/amportal.conf does not exist, copying defaultCreatingnew /etc/amportal.conf
Enter your USERNAME to connect tothe 'asterisk' database:
[root]Enter your PASSWORDto connect to the 'asterisk' database:
[passw0rd]
Enter the hostname of the 'asterisk' database:
[localhost]
Enter a USERNAME to connect to the Asterisk Manager interface:
[admin]
Enter a PASSWORD to connect to the Asterisk Manager interface:
[amp111]
Enter the path to use for your AMP web root:
[/var/www/html]
Enter the IP ADDRESS or hostname used to access the AMP web-admin:
[xx.xx.xx.xx] asterisk1101
Enter a PASSWORD to perform call transfers with the Flash Operator Panel:
[passw0rd]
Use simple Extensions [extensions] admin or separate Devices and Users[deviceanduser]?
[extensions]
Created /var/lib/asterisk/bin
Enter directory in which to store super-user scripts:
[/usr/local/sbin]
# echo "/usr/local/sbin/amportalstart" >> /etc/rc.local
chkconfig httpd on
chkconfig mysqld on
OK 安装完成重启
reboot
6) 后续一些权限修改
-------------------------------------------------------------------------------------------------------------------------------------------
chmod 777/var/www/html -R
cd/var/lib/asterisk/
chmod 777 bin
chmod -R 777bin/*
chmod 777/var/lib/php/session/
chmod 777 -R/var/lib/php/session/*
-------------------------------------------------------------------------------------------------------------------------------------------
登录至FreePBX测试
http://192.168.x.xxx (你的本机IP地址)
用户名:admin
口令:admin
第一次登陆管理界面,需要进行配置。
现在可以创建SIP号码。
-------------------------------------------------------------------------------------------------------------------------------------------
一些排错信息:
-------------------------------------------------------------------------------------------------------------------------------------------
日志:
tail -f /var/log/httpd/access_log
tail -f /var/log/httpd/error_log
/var/log/mysqld.log
asterisk日志
tail -f /var/log/asterisk/full
tail -f /var/log/asterisk/freepbx.log
-------------------------------------------------------------------------------------------------------------------------------------------
排错:检查数据访问
mysql -h localhost -u root -p password
use asterisk;
-------------------------------------------------------------------------------------------------------------------------------------------
排错:
http://192.168.x.xxx/phpmyadmin/
-------------------------------------------------------------------------------------------------------------------------------------------
提示:
/etc/amportal.conf
控制谁能用amp管理协议访问asterisk服务器
/etc/asterisk/manager.conf
7) FreePBX忘记口令
修改口令为freepbx后,登录FreePBX Administration页面并修改口令。
CentOS + Asterisk + FreePBX ——支持蓝牙,AMR-NB audio codec相关推荐
- 蓝牙技术|AirPods Pro 2 支持蓝牙 LE Audio 技术带来的 5 大好处
在 2020 年,蓝牙 5.2 引入支持新的 LE Audio 音频规范.至少有两名苹果员工被列为 LE Audio 开发的参与者,苹果很可能会采用该规范以用于未来的设备. 根据蓝牙 SIG 数据库中 ...
- asterisk接入手机 +蓝牙+asr ,手机变身 AI机器人.
1,centos安装蓝牙驱动 yum install *bluez* 2,asterisk安装支持chan_mobile,make menuselect 选择chan_mobile 3,手机蓝牙和ce ...
- Android Bluetooth蓝牙开发\蓝牙协议\蓝牙通信例子_Android支持蓝牙4.0版本_BLE开发
一.Android Bluetooth现状 在android官网可以了解到android4.2新增了部分新功能,但是对于BT熟悉的人或许开始头疼了,那就是Android4.2引入了一个新的蓝牙协议栈针 ...
- android 7 蓝牙版本,[Android]Android什么版本开始支持蓝牙4.2?答案:Android 7.0
根据Android 7.0的兼容性文档(https://source.android.com/compatibility/7.0/android-7.0-cdd.pdf) 里面7.3.4 Blueto ...
- CentOS 7虚拟机支持virsh console访问
CentOS 7虚拟机支持virsh console访问方法: 1. 在KVM(客户机)下开机启动并启动服务 systemctl enable serial-getty@ttyS0.service s ...
- 让CentOS 5.3支持ntfs分区
让CentOS 5.3支持ntfs分区 如何让CentOS 5.3支持ntfs分区? 1. 查看自己系统的内核版本 #uname -a #uname –r 2. 找合适自己系统内核和CPU的NTFS模 ...
- 【AI语音】魔百盒M301H-JL代工-3798MV300芯片-支持蓝牙_免费固件包
[AI语音]魔百盒M301H-JL代工-3798MV300芯片-支持蓝牙_免费固件包 固件特点: 1.适用于魔百盒M301H: 2.开放原厂固件屏蔽的市场安装和u盘安装apk: 3.修改dns,三网通 ...
- CentOS各个版本支持周期
CentOS各个版本支持周期 CentOS 版本 发布日期 完全更新 维护更新 3 2004年3月19日 2006年7月20日 2010年10月31日 4 2005年3月9日 2009年3月31日 2 ...
- BLEMotion-Kit 支持蓝牙运动传感评估套件
文章目录 1. 说在最前面 1.1 为什么要做 1.3 民间开发套件 1.2 更新记录 2. BLEMotion-Kit-R1 的颜值 2.1 引脚分配 2.2 CH583 3. 开发环境 3.1 ` ...
最新文章
- Java虚拟机(JVM)
- javascript函数上的prototype属性的理解
- LUA表与函数的深入理解
- httos双向认证配置_HTTPS双向验证,如何设置
- HihoCoder - 1558
- 萨义德与巴伦博依姆关于音乐和文学的对话
- 漫画:什么是字典序算法
- android软件perthbus,Transit
- 今天1024程序猿节啦!一起穿格子衫上班吧
- 诗与远方:无题(六十六)- 清明时节雨纷下
- 使用python在ArcGIS中合并多个图层中的数据
- tableview分割线
- python类中导入库_python导入库的具体方法
- .NET中的加密类(对称加密)
- oracle sql 取最大分组,oracle sql 按某个字段分组然后从每组取出最大的一条纪录...
- 利用电脑玩android版天天连萌刷高分 二,利用计算机玩Android版“天天连萌”刷高分(二)——图像识别...
- 老王的JAVA基础课:序言
- 《诗经·王风·黍离》
- 硬核干货|揭示波士顿动力机器人背后的专利技术(上)
- 打破认知:程序设计=算法+数据结构?
热门文章
- 我改的程序--打豆豆
- 为什么说石英表比机械表走时准?
- STM32学习笔记一一UCOSII(1)
- 数据可视化作业(pivot_wider)(pivot_longer)
- 前端学习记录27-JavaScript-(作用域、预解析、自定义对象)
- Hand-held Monocular SLAM Based on Line Segments
- 北斗/GPS 精度因子DOP
- android嵌入式键盘,嵌入式系统的键盘设计
- 【华为笔试】输入:A={11,13,15},B={12,14,16},R=1
- 基于react的前后端渲染实例讲解