系统相关
首页 > 系统相关> > centos 7+安装freeswitch,亲测有用

centos 7+安装freeswitch,亲测有用

作者:互联网

1、导入依赖包
yum install -y git alsa-lib-devel autoconf automake bison broadvoice-devel bzip2 curl-devel libdb4-devel e2fsprogs-devel erlang flite-devel g722_1-devel gcc-c++ gdbm-devel gnutls-devel ilbc2-devel ldns-devel libcodec2-devel libcurl-devel libedit-devel libidn-devel libjpeg-devel libmemcached-devel libogg-devel libsilk-devel libsndfile-devel libtheora-devel libtiff-devel libtool libuuid-devel libvorbis-devel libxml2-devel lua-devel lzo-devel mongo-c-driver-devel ncurses-devel net-snmp-devel openssl-devel opus-devel pcre-devel perl perl-ExtUtils-Embed pkgconfig portaudio-devel postgresql-devel python-devel python-devel soundtouch-devel speex-devel sqlite-devel unbound-devel unixODBC-devel wget which yasm zlib-devel libshout-devel libmpg123-devel lame-devel unzip libatomic unixODBC unixODBC-devel mysql-connector-odbc libaio

2、安装freeswitch
tar xzvf freeswitch-1.8.5.tar.gz
cd freeswitch-1.8.5

#支持数据库链接
./configure --enable-core-odbc-support
cd src/mod/codecs/mod_opus
sed -i “s/install: error/#install: error/g” Makefile 将install: error 替换为 #install: error
sed -i “s/all: error/#all: error/g” Makefile 将all: error 替换为 #all: error
cd /usr/local/freeswitch-1.8.5
make -j2 #根据CPU核数加快编译速度
#如果遇到libtool: Version mismatch error. 解决方法 运行 autoreconf -ivf 即可。
make install

3、配置freeswitch 客户端登录密码
/usr/local/freeswitch/conf/autoload_configs
vim event_socket.conf.xml
修改以下内容









4、测试客户端登录
cd /usr/local/freeswitch/bin/
执行命令
./fs_cli -H 127.0.0.1 -P 8021 -p test@123

5、安装boost
Boost简介:库是一个可移植、提供源代码的C++库,作为标准库的后备,是C++标准化进程的开发引擎之一,是为C++语言标准库提供扩展的一些C++程序库的总称。 Boost库由C++标准委员会库工作组成员发起,其中有些内容有望成为下一代C++标准库内容。在C++社区中影响甚大,是不折不扣的“准”标准库。Boost由于其对跨平台的强调,对标准C++的强调,与编写平台无关。大部分boost库功能的使用只需包括相应头文件即可,少数(如正则表达式库,文件系统库等)需要链接库。但Boost中也有很多是实验性质的东西,在实际的开发中使用需要谨慎

cd /usr/local/
tar xzvf boost_1_70_0.tar.gz
cd boost_1_70_0
./bootstrap.sh
./b2 install

6、安装MySQL
参考 linux下安装mysql
—创建用户ctp_db
create user ‘ctp_db’@’%’ identified by ‘ctp_db1234!@#;mysqluctpdbp;createdatabasectpdb;usectpdb;createtablecallerprofile(callervarchar(32)primarykey,profilevarchar(64));createtableconvertrules(profilevarchar(64),typevarchar(16),numbervarchar(32),convlenint(8),convnumbervarchar(32));altertableconvertrulesadduniqueindexptn(profile,type,number);createtableglobals(idint(8)primarykey,ctplistenportint(8)NOTNULL,ctplistenipvarchar(64)NOTNULL,eslinboundportint(8)NOTNULL,eslinboundipvarchar(64)NOTNULL,ctpnotifyportoint(8)NOTNULL,ctpnotifyipovarchar(64)NOTNULL,esloutboundportint(8)NOTNULL,esloutboundipvarchar(64)NOTNULL,loglevelint(8)NOTNULL,logfilevarchar(256),ctpnotifyportiint(8)NOTNULL,ctpnotifyipivarchar(64)NOTNULL);insertintoglobalsvalues(0,9930,localhost,8021,localhost,9970,localhost,8040,localhost,6,/usr/local/ctplog.txt,9980,localhost);freeswitchcreateuserfreeswitch@'; mysql -u ctp_db -p; create database ctp_db; use ctp_db; create table caller_profile(caller varchar(32) primary key, profile varchar(64)); create table convert_rules(profile varchar(64), type varchar(16), number varchar(32), conv_len int(8), conv_number varchar(32)); alter table convert_rules add unique index ptn(profile, type, number); create table globals(id int(8) primary key, ctp_listen_port int(8) NOT NULL, ctp_listen_ip varchar(64) NOT NULL, esl_inbound_port int(8) NOT NULL, esl_inbound_ip varchar(64) NOT NULL, ctp_notify_port_o int(8) NOT NULL, ctp_notify_ip_o varchar(64) NOT NULL, esl_outbound_port int(8) NOT NULL, esl_outbound_ip varchar(64) NOT NULL, log_level int(8) NOT NULL, log_file varchar(256), ctp_notify_port_i int(8) NOT NULL, ctp_notify_ip_i varchar(64) NOT NULL); insert into globals values(0,9930,'localhost',8021,'localhost',9970,'localhost',8040,'localhost',6,'/usr/local/ctp_log.txt',9980,'localhost'); ---创建freeswitch create user 'freeswitch'@'%' identified by 'freeswitch@1234!@#′;mysql−uctpd​b−p;createdatabasectpd​b;usectpd​b;createtablecallerp​rofile(callervarchar(32)primarykey,profilevarchar(64));createtableconvertr​ules(profilevarchar(64),typevarchar(16),numbervarchar(32),convl​enint(8),convn​umbervarchar(32));altertableconvertr​ulesadduniqueindexptn(profile,type,number);createtableglobals(idint(8)primarykey,ctpl​istenp​ortint(8)NOTNULL,ctpl​isteni​pvarchar(64)NOTNULL,esli​nboundp​ortint(8)NOTNULL,esli​nboundi​pvarchar(64)NOTNULL,ctpn​otifyp​orto​int(8)NOTNULL,ctpn​otifyi​po​varchar(64)NOTNULL,eslo​utboundp​ortint(8)NOTNULL,eslo​utboundi​pvarchar(64)NOTNULL,logl​evelint(8)NOTNULL,logf​ilevarchar(256),ctpn​otifyp​orti​int(8)NOTNULL,ctpn​otifyi​pi​varchar(64)NOTNULL);insertintoglobalsvalues(0,9930,′localhost′,8021,′localhost′,9970,′localhost′,8040,′localhost′,6,′/usr/local/ctpl​og.txt′,9980,′localhost′);−−−创建freeswitchcreateuser′freeswitch′@′’;
mysql -u freeswitch -p;
create database freeswitch;
use freeswitch;
创建表(参考 freeswitch.sql)

7、配置odbc
----(如果没有)拷贝一份 odbc.ini 到/etc/
----编辑odbc.ini
[freeswitch]
Driver = /usr/lib64/libmyodbc5.so
SERVER = 192.168.1.1 本机IP(内网或外网都行)
PORT = 3306
DATABASE = freeswitch
OPTION = 67108864
USER = freeswitch
PASSWORD = freeswitch@1234!@#$
-----测试数据库链接
isql -v freeswitch

8、修改freeswitch配置文件
----修改/usr/local/freeswitch/conf/autoload_configs中的db.conf.xml文件




----修改/usr/local/freeswitch/conf/autoload_configs中的switch.conf.xml

----修改修改/usr/local/freeswitch/conf/autoload_configs中的voicemail.conf.xml

----修改/usr/local/freeswitch/conf/autoload_configs中的callcenter.conf.xml

----修改/usr/local/freeswitch/conf/sip_profiles中的internal.xml 和 external.xml(只需修改internal.xml 内容即可)

—进入到/usr/local/freeswitch/conf/autoload_configs目录下,编辑lua.conf.xml文件 在标签下添加如下的代码

----拷贝gen_dir_user_xml.lua、config_gateway.lua 到/usr/local/freeswitch/scripts(文件在网普ctp下)

----编辑/usr/local/freeswitch/conf/directory/default.xml 删除如下代码(注释掉即可)

----修改拨号计划 编辑/usr/local/freeswitch/conf/dialplan/default.xml,添加如下代码




<extension name="Local_Extension2">
<condition field="destination_number" expression="^([1-3][0-9][0-9][0-9])$">
	<action application="export" data="dialed_extension=$1"/>
	<action application="set" data="call_timeout=10"/>
	<action application="set" data="hangup_after_bridge=true"/>
	<action application="set" data="continue_on_fail=false"/>
	<action application="bridge" data="user/${dialed_extension}@${domain_name}"/>
</condition>
</extension>

------修改internal.xml和external.xml以下内容

标签:centos,devel,&#,64,NOTNULL,freeswitch,x27,亲测
来源: https://blog.csdn.net/weixin_41187227/article/details/100899412