安装说明
yum install -y http://files.freeswitch.org/freeswitch-release-1-6.noarch.rpm epel-release
yum install -y git alsa-lib-devel autoconf automake bison broadvoice-devel bzip2 curl-devel db-devel e2fsprogs-devel 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 python26-devel python-devel soundtouch-devel speex-devel sqlite-devel unbound-devel unixODBC-devel wget which yasm zlib-devel
cd /usr/local/src
git clone -b v1.6 https://freeswitch.org/stash/scm/fs/freeswitch.git freeswitch
cd /usr/local/src/freeswitch
./bootstrap.sh -j
./configure -C
make
make -j install
make -j cd-sounds-install
make -j cd-moh-install
安装mod_shout
yum install libshout-devel lame-devel libmpg123-devel
修改 modules.conf
修改配置文件
1.fs_cli连接
cd /usr/local/freeswitch/conf/autoload_configs
vi event_socket.conf.xml
<configuration name="event_socket.conf" description="Socket Client">
<settings>
<param name="nat-map" value="false"/>
<param name="listen-ip" value="127.0.0.1"/> ###修改为127.0.0.1,启动fs_cli
<param name="listen-port" value="8021"/>
<param name="password" value="ClueCon"/>
<!--<param name="apply-inbound-acl" value="loopback.auto"/>-->
<!--<param name="stop-on-bind-error" value="true"/>-->
</settings>
</configuration>
2.webrtc配置
cd /usr/local/freeswitch/conf/sip_profiles
vi internal.xml ###打开注释
<param name="ws-binding" value=":5066"/>
检查5066端口是否打开
fs_5066.png
3.SIPJS使用
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>sipjs-webphone</title>
<script src="./js/sip-0.11.6.min.js"></script>
<script>
var config = {
uri: '1000@10.10.10.199',
displayName: 'tianyu',
registrarServer: 'sip:10.10.10.199:5066',
authorizationUser: '1000',
password: '1234',
transportOptions: {
wsServers: ['ws://10.10.10.199:5066'],
traceSip: true
},
log: {
level: "debug"
},
register: true
};
var ua = new SIP.UA(config);
</script>
</head>
<body>
</body>
</html>
REGISTER sip:10.10.10.199:5066 SIP/2.0
Via: SIP/2.0/WS s5i42ue4okl7.invalid;branch=z9hG4bK162830
Max-Forwards: 70
To: "tianyu" <sip:1000@10.10.10.199>
From: "tianyu" <sip:1000@10.10.10.199>;tag=v6rd74h85t
Call-ID: 47poq38kmunnt70cm38q6j
CSeq: 4187 REGISTER
Contact: <sip:a5esadna@s5i42ue4okl7.invalid;transport=ws>;reg-id=1;+sip.instance="<urn:uuid:b2c411ec-ae4c-4efe-86b5-3b7cde06b2f3>";expires=600
Allow: ACK,CANCEL,INVITE,MESSAGE,BYE,OPTIONS,INFO,NOTIFY,REFER
Supported: path, gruu, outbound
User-Agent: SIP.js/0.11.6
Content-Length: 0
SIP/2.0 401 Unauthorized
Via: SIP/2.0/WS s5i42ue4okl7.invalid;branch=z9hG4bK162830;received=10.10.10.239;rport=57056
From: "tianyu" <sip:1000@10.10.10.199>;tag=v6rd74h85t
To: "tianyu" <sip:1000@10.10.10.199>;tag=1tvNrDtF19Hre
Call-ID: 47poq38kmunnt70cm38q6j
CSeq: 4187 REGISTER
User-Agent: FreeSWITCH-mod_sofia/1.6.20+git~20180507T185611Z~43a9feb7f8~64bit
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
WWW-Authenticate: Digest realm="10.10.10.199", nonce="172ad673-9c5b-46f5-8fea-dbfd6b1160e7", algorithm=MD5, qop="auth"
Content-Length: 0
REGISTER sip:10.10.10.199:5066 SIP/2.0
Via: SIP/2.0/WS s5i42ue4okl7.invalid;branch=z9hG4bK4108439
Max-Forwards: 70
To: "tianyu" <sip:1000@10.10.10.199>
From: "tianyu" <sip:1000@10.10.10.199>;tag=v6rd74h85t
Call-ID: 47poq38kmunnt70cm38q6j
CSeq: 4188 REGISTER
Authorization: Digest algorithm=MD5, username="1000", realm="10.10.10.199", nonce="172ad673-9c5b-46f5-8fea-dbfd6b1160e7", uri="sip:10.10.10.199:5066", response="635242442fa82d499423b02d4296e528", qop=auth, cnonce="6f1757jocgu8", nc=00000001
Contact: <sip:a5esadna@s5i42ue4okl7.invalid;transport=ws>;reg-id=1;+sip.instance="<urn:uuid:b2c411ec-ae4c-4efe-86b5-3b7cde06b2f3>";expires=600
Allow: ACK,CANCEL,INVITE,MESSAGE,BYE,OPTIONS,INFO,NOTIFY,REFER
Supported: path, gruu, outbound
User-Agent: SIP.js/0.11.6
Content-Length: 0
SIP/2.0 200 OK
Via: SIP/2.0/WS s5i42ue4okl7.invalid;branch=z9hG4bK4108439;received=10.10.10.239;rport=57056
From: "tianyu" <sip:1000@10.10.10.199>;tag=v6rd74h85t
To: "tianyu" <sip:1000@10.10.10.199>;tag=23Net8aKyj8aa
Call-ID: 47poq38kmunnt70cm38q6j
CSeq: 4188 REGISTER
Contact: <sip:a5esadna@s5i42ue4okl7.invalid;transport=ws>;expires=600
Date: Wed, 05 Dec 2018 04:25:37 GMT
User-Agent: FreeSWITCH-mod_sofia/1.6.20+git~20180507T185611Z~43a9feb7f8~64bit
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
Content-Length: 0
### webrtc注册成功。
网友评论