0408.WebRTC通信

由 jafucong 发布

WebRTC 直接从更好的 Web 浏览器和设备提供实时通信,无需 Adob​​e Flash 或 Silverlight 等插件。WebRTC始终在安全模式下运行。FreeSWITCH 为其公共会议桥提供了一个WebRTC 门户,以展示通过网页处理电话的可能性;加入我们的每周电话会议。

无论是用于经典 WebRTC 还是 FreeSWITCH Verto 端点,使用 WSS 证书配置 FreeSWITCH 的过程都是相同的。

Debian 7

最小化安装 Debian 7。

mkdir -p /usr/local/freeswitch/certs
 
edit /usr/local/freeswitch/conf/sip_profiles/internal.xml
# Set these params and save the file:
<param name="tls-cert-dir" value="/usr/local/freeswitch/certs"/>
<param name="wss-binding" value=":7443"/>

如果在 NAT 之后,请确保将 vars.xml 中的ext-sip-ip和ext-rtp-ip设置为 FreeSWITCH 的公共 IP 地址。

如果与 NAT 内外的客户端通信,您必须设置local-network-aclrfc1918.auto,并将ext-sip-ipext-rtp-ip前缀为autonat:XXXX

安装证书

/usr/local/freeswitch/certs/wss.pem的布局:

Cert, Key and Chain(s) are all contained in a single file in this order:
  
-----BEGIN CERTIFICATE-----
<cert>
-----END CERTIFICATE-----
-----BEGIN RSA PRIVATE KEY-----
<key>
-----END RSA PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
<chain>
-----END CERTIFICATE-----

启动 FreeSWITCH

其他方法

# Create certificates:
 
wget http://files.freeswitch.org/downloads/ssl.ca-0.1.tar.gz
tar zxfv ssl.ca-0.1.tar.gz
cd ssl.ca-0.1/
perl -i -pe 's/md5/sha256/g' *.sh
perl -i -pe 's/1024/4096/g' *.sh
./new-root-ca.sh
./new-server-cert.sh self.bkw.org
./sign-server-cert.sh self.bkw.org
cat self.bkw.org.crt self.bkw.org.key > /usr/local/freeswitch/certs/wss.pem
 
# Setup Apache:
 
# default-ssl:
 
SSLCertificateFile    /usr/local/freeswitch/certs/wss.pem
SSLCertificateKeyFile /usr/local/freeswitch/certs/wss.pem
SSLCertificateChainFile /usr/local/freeswitch/certs/wss.pem
 
# Setup Sofia TLS:
 
cat self.bkw.org.crt self.bkw.org.key > /usr/local/freeswitch/certs/agent.pem
cat ca.crt > /usr/local/freeswitch/certs/cafile.pem
 
# vars.xml:
 
<X-PRE-PROCESS cmd="set" data="internal_ssl_enable=true"/>
<X-PRE-PROCESS cmd="set" data="external_ssl_enable=true"/>
 
# Restart FreeSWITCH.
 
## Now make sure your system has ca.crt imported so it will trust your new found hotness.
 
# TEST:
 
openssl s_client -connect self.bkw.org:443
openssl s_client -connect self.bkw.org:5061
openssl s_client -connect self.bkw.org:5081
openssl s_client -connect self.bkw.org:8082
 
 
# Depending on what you've setup you'll see:
 
subject=/C=US/ST=Oklahoma/L=McAlester/O=Tonka Truck/OU=Secure Web Server/CN=self.bkw.org/emailAddress=brian@bkw.org
issuer=/C=US/ST=Oklahoma/L=McAlester/O=Whizzzzzzy Bang Bang/OU=Certification Services Division/CN=WBB Root CA/emailAddress=brian@bkw.org
 
# Or there abouts.

最新版本的 Freeswitch 应该会自动生成自签名证书。但是,自签名证书通常不能很好地工作,因为您需要诱导提示以允许使用不受信任的证书。您应该使用受信任的证书,就像使用您的网站一样。如果您使用 WebRTC url,例如 wss://foo.bar.com:7443并将其更改为https://foo.bar.com:7443,您可以在浏览器中访问它并给它一个永久例外。在 macOS 和 Windows 上,您可以将 ca.crt 导入您的信任库。


暂无评论

发表评论