此文完整记录了利用官网提供的rpm包搭建opensips+rtpproxy服务,实现视频通话全过程,留下记号,自我总结一下,方便日后查阅。
系统环境:CentOS7 x64 软件版本: opensips :v2.2.3-1 rtpproxy : v2.0.0 mysql : 5.6.35
上述获取的opensips rpm包中未包含mysql模块,需手动下载对应opensips版本模块安装,模块汇总下载地址为:http://yum.opensips.org/browse.php
wget http://yum.opensips.org/2.2/releases/el/7/x86_64/opensips-db_mysql-2.2.3-1.el7.x86_64.rpm rpm -ivh opensips-db_mysql-2.2.3-1.el7.x86_64.rpm执行如下命令:
yum install rtpproxy启动rtpproxy
rtpproxy -F//权限配置
chown -R root:root /var/lib/mysql service mysqld restart mysql -u root//root密码修改及分配权限
update user set password=password('123456') where user='root'; GRANT ALL ON *.* TO root@'%' IDENTIFIED BY '123456'; SET GLOBAL sql_mode = ''; //此处设置避免opensips创建opensips数据库出错 FLUSH PRIVILEGES; exit将对应字段的内容修改如下
SIP_DOMAIN=192.168.2.73 //此处改为你服务器本机IP DBENGINE=MYSQL DBHOST=localhost DBNAME=opensips DBRWUSER=opensips DBRWPW="opensipsrw" USERCOL="username" ETCDIR="/etc/opensips"成功会生成提示 /usr/etc/opensips/opensips_residential_2017-3-8_10:45:27.cfg = SUCCESS 如若失败,则手动创建 /usr/etc/opensips目录,mkdir /usr/etc/opensips
//备份旧配置文件
cp /etc/opensips/opensips.cfg /etc/opensips/opensips.cfg.origin//移动上述产生的配置文件并重命名
mv /usr/etc/opensips/opensips_residential_2017-3-8_10:45:27.cfg /etc/opensips/opensips.cfg//修改opensips.cfg
vi /etc/opensips/opensips.cfg//监听地址改为本机服务器IP
listen=udp:192.168.2.73:5060 # CUSTOMIZE ME listen=tcp:192.168.2.73:5060 # CUSTOMIZE ME//rtpproxy模块配置
modparam("rtpproxy", "rtpproxy_sock", "unix:/var/run/rtpproxy.sock")//创建账号
opensipsctl add test01 test01 opensipsctl add test02 test02添加的账号在数据库subscriber表中,下载sip客户端测试,PC端建议使用X-lite或Linphone,手机端使用linphone测试,Domain填写opensips服务器IP,账号/密码填写上述创建的即可注册、呼叫测试。
//查看在线用户
opensipsctl ul show opensipsctl online============================================================== 至此,已全部完成opensips服务及rtpproxy代理服务搭建,正常情况下可以实现视频通话。
参考解决链接:http://www.111cn.net/sys/CentOS/109189.htm
ERROR: could not load the script in /usr/lib64/opensips/opensipsctl/opensipsdbctl.mysql for database engine MYSQL ERROR: database engine not loaded - tried ‘MYSQL’ 解决办法:rpm包未包含mysql模块,需访问官网下载提供的对应安装版本的db_mysql rpm包安装即可
ERROR 1101 (42000) at line 2: BLOB/TEXT column ‘extra_hdrs’ can’t have a def 解决办法:mysql> SET GLOBAL sql_mode = ”;
/usr/etc/opensips/opensips_residential_2017-2-28_9:39:49.cfg = FAILED 解决办法:创建/usr/etc/opensips/目录
ERROR: PID file /var/run/opensips.pid does not exist – OpenSIPS start failed 解决办法:修改opensips.cfg文件中的db_url地址,大多数为权限问题 “mysql://opensips:opensips@localhost/opensips”) # CUSTOMIZE ME
将opensips.cfg文件中listen=udp:127.0.0.1:5060 # CUSTOMIZE ME 修改为:listen=udp:192.168.2.73:5060 #这里的的IP以本机实际IP为准
解决办法: 将opensips.cfg文件中 if ( isflagset(NAT) ) rtpproxy_answer(“ro”); 修改为: if ( isflagset(NAT) && has_body(“application/sdp”) ) rtpproxy_answer(“ro”);
注:使用过程中,出现错误,日志记录在/var/log/messages,查看日志解决问题。
1.安装epel:http://blog.csdn.net/yasi_xi/article/details/11746255 2.opensips官网: http://yum.opensips.org/packages.php?v=2.2 http://yum.opensips.org/browse.php 3.安装mysql:http://www.mamicode.com/info-detail-503994.html 4.rtpproxy: http://www.rtpproxy.org/post/v2release/ http://blog.csdn.net/forest_world/article/details/51647108 5.配置参考链接: http://blog.chinaunix.net/uid-26118446-id-5615983.html http://blog.csdn.net/cazicaquw/article/details/7376026 http://www.cnblogs.com/bjzhanghao/archive/2013/02/13/2910903.html https://yq.aliyun.com/articles/44437 6.centos7 防火墙配置:http://www.linuxidc.com/Linux/2015-05/117473.htm