因为所在部分主要负责公司客服业务,需要了解freeswich相关内容,所以这里将学习内容记录下。
freeswich是一个实现了软交换协议的开源软件,可以对对接运营上的通话线路,实现拨打电话。
yum install -y https://files.freeswitch.org/repo/yum/centos-release/freeswitch-release-repo-0-1.noarch.rpm epel-release
yum install -y yum-utils --enablerepo=extras
yum install -y yum-plugin-ovl centos-release-scl rpmdevtools yum-utils git wget vim devtoolset-7-gcc* devtoolset-7 libtiff-devel cmake3 libatomic unixODBC unixODBC-devel.x86_64 postgresql-libs postgresql-devel libpqxx-devel
yum install -y gcc-c++ autoconf automake libtool ncurses-devel zlib-devel libjpeg-devel openssl-devel e2fsprogs-devel sqlite-devel libcurl-devel pcre-devel speex-devel ldns-devel libedit-devel libxml2-devel libyuv-devel libvpx-devel libvpx2* libdb4* libidn-devel unbound-devel libuuid-devel lua-devel libsndfile-devel yasm-devel
cd /data
git clone -b v1.10.7 https://github.com/signalwire/freeswitch
cd /data/freeswitch
git clone https://github.com/freeswitch/spandsp.git
git clone https://github.com/freeswitch/sofia-sip.git
#编译spandsp
cd /data/freeswitch/spandsp
./bootstrap.sh
./configure
make
make install
#编译sofia-sip
cd /data/freeswitch/sofia-sip
./bootstrap.sh
./configure
make
make install
#添加库的路径到系统
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:${PKG_CONFIG_PATH}
ldconfig
# 编译fs
cd /data/freeswitch
./bootstrap.sh
./configure --enable-portable-binary --prefix=/usr/local/freeswitch --with-gnu-ld --with-python --with-openssl --enable-core-odbc-support --enable-zrtp
make
make install
注意:如果报错,找到modules.conf文件,将报错的模块注释掉即可。如
#applications/mod_signalwire #applications/mod_av
,具体根据当时的情况看吧,谁报错就注释掉谁。
[root@localhost bin]# pwd
/usr/local/freeswitch/bin
[root@localhost bin]# ./freeswitch -nonat
2023-11-07 17:14:18.156329 0.00% [INFO] switch_event.c:713 Activate Eventing Engine.
...
2023-11-07 17:14:20.946405 0.00% [CONSOLE] switch_core.c:2544
.=============================================================.
| _____ ______ _____ _____ ____ _ _ |
| | ___| __ ___ ___/ ___\ \ / /_ _|_ _/ ___| | | | |
| | |_ | '__/ _ \/ _ \___ \\ \ /\ / / | | | || | | |_| | |
| | _|| | | __/ __/___) |\ V V / | | | || |___| _ | |
| |_| |_| \___|\___|____/ \_/\_/ |___| |_| \____|_| |_| |
| |
.=============================================================.
| Anthony Minessale II, Michael Jerris, Brian West, Others |
| FreeSWITCH (http://www.freeswitch.org) |
| Paypal Donations Appreciated: [email protected] |
| Brought to you by ClueCon http://www.cluecon.com/ |
.=============================================================.
.=======================================================================================================.
| _ _ ____ _ ____ |
| / \ _ __ _ __ _ _ __ _| | / ___| |_ _ ___ / ___|___ _ __ |
| / _ \ | '_ \| '_ \| | | |/ _` | | | | | | | | |/ _ \ | / _ \| '_ \ |
| / ___ \| | | | | | | |_| | (_| | | | |___| | |_| | __/ |__| (_) | | | | |
| /_/ \_\_| |_|_| |_|\__,_|\__,_|_| \____|_|\__,_|\___|\____\___/|_| |_| |
| |
| ____ _____ ____ ____ __ |
| | _ \_ _/ ___| / ___|___ _ __ / _| ___ _ __ ___ _ __ ___ ___ |
| | |_) || || | | | / _ \| '_ \| |_ / _ \ '__/ _ \ '_ \ / __/ _ \ |
| | _ < | || |___ | |__| (_) | | | | _| __/ | | __/ | | | (_| __/ |
| |_| \_\|_| \____| \____\___/|_| |_|_| \___|_| \___|_| |_|\___\___| |
| |
| ____ _ ____ |
| / ___| |_ _ ___ / ___|___ _ __ ___ ___ _ __ ___ |
| | | | | | | |/ _ \ | / _ \| '_ \ / __/ _ \| '_ ` _ \ |
| | |___| | |_| | __/ |__| (_) | | | | _ | (_| (_) | | | | | | |
| \____|_|\__,_|\___|\____\___/|_| |_| (_) \___\___/|_| |_| |_| |
| |
.=======================================================================================================.
2023-11-07 17:14:20.946482 0.00% [INFO] switch_core.c:2553
停止命令 ./freeswich -stop
会启动好几个端口,各有各的作用。
[root@localhost bin]# netstat -nlp|grep frees
tcp 0 0 192.168.192.128:7443 0.0.0.0:* LISTEN 118580/./freeswitch
tcp 0 0 192.168.192.128:5080 0.0.0.0:* LISTEN 118580/./freeswitch
tcp 0 0 192.168.192.128:5060 0.0.0.0:* LISTEN 118580/./freeswitch
tcp 0 0 192.168.192.128:5066 0.0.0.0:* LISTEN 118580/./freeswitch
tcp6 0 0 :::8021 :::* LISTEN 118580/./freeswitch
tcp6 0 0 ::1:5080 :::* LISTEN 118580/./freeswitch
tcp6 0 0 ::1:5060 :::* LISTEN 118580/./freeswitch
udp 0 0 192.168.192.128:5060 0.0.0.0:* 118580/./freeswitch
udp 0 0 192.168.192.128:5080 0.0.0.0:* 118580/./freeswitch
udp6 0 0 ::1:5060 :::* 118580/./freeswitch
udp6 0 0 ::1:5080 :::* 118580/./freeswitch
模拟真实的电话,客服使用的就是这玩意,从这里 下载,下载后,按照如下配置注意ip改成你自己的
:
变为下图就成功了:
此时我们就可以通过freeswich呼叫软电话了通过fs提供的fs_cli工具和originate命令
:
[root@localhost bin]# ./fs_cli -H 127.0.0.1 -p ClueCon
.=======================================================.
| _____ ____ ____ _ ___ |
| | ___/ ___| / ___| | |_ _| |
| | |_ \___ \ | | | | | | |
| | _| ___) | | |___| |___ | | |
| |_| |____/ \____|_____|___| |
| |
.=======================================================.
| Anthony Minessale II, Ken Rice, |
| Michael Jerris, Travis Cross |
| FreeSWITCH (http://www.freeswitch.org) |
| Paypal Donations Appreciated: [email protected] |
| Brought to you by ClueCon http://www.cluecon.com/ |
.=======================================================.
.=======================================================================================================.
| _ _ ____ _ ____ |
| / \ _ __ _ __ _ _ __ _| | / ___| |_ _ ___ / ___|___ _ __ |
| / _ \ | '_ \| '_ \| | | |/ _` | | | | | | | | |/ _ \ | / _ \| '_ \ |
| / ___ \| | | | | | | |_| | (_| | | | |___| | |_| | __/ |__| (_) | | | | |
| /_/ \_\_| |_|_| |_|\__,_|\__,_|_| \____|_|\__,_|\___|\____\___/|_| |_| |
| |
| ____ _____ ____ ____ __ |
| | _ \_ _/ ___| / ___|___ _ __ / _| ___ _ __ ___ _ __ ___ ___ |
| | |_) || || | | | / _ \| '_ \| |_ / _ \ '__/ _ \ '_ \ / __/ _ \ |
| | _ < | || |___ | |__| (_) | | | | _| __/ | | __/ | | | (_| __/ |
| |_| \_\|_| \____| \____\___/|_| |_|_| \___|_| \___|_| |_|\___\___| |
| |
| ____ _ ____ |
| / ___| |_ _ ___ / ___|___ _ __ ___ ___ _ __ ___ |
| | | | | | | |/ _ \ | / _ \| '_ \ / __/ _ \| '_ ` _ \ |
| | |___| | |_| | __/ |__| (_) | | | | _ | (_| (_) | | | | | | |
| \____|_|\__,_|\___|\____\___/|_| |_| (_) \___\___/|_| |_| |_| |
| |
.=======================================================================================================.
Type /help to see a list of commands
+OK log level [7]
[email protected]> originate user/1000 &echo
...
【FreeSwitch开发实践】centos7下编译安装freeswitch及常见编译问题的解决 。
【FreeSwitch开发实践】使用SIP客户端Yate连接FreeSwitch进行VoIP通话 。