freeswitch使用sip集成网页电话,nginx配置https协议

简介: 文章目录网页集成软电话配置freeswitch开启wssnginx配置自签名https域名页面集成软电话开发网页集成软电话网页集成软电话需要使用https协议,页面与freeswitch平台建立websocket长连接。使用jssip库进行相关开发

文章目录 网页集成软电话 配置freeswitch开启wss nginx配置自签名https域名 页面集成软电话开发 网页集成软电话 网页集成软电话需要使用https协议,页面与freeswitch平台建立websocket长连接。使用jssip库进行相关开发

生成https自签名证书 下载ssl.ca-0.1.tar.gz wget files.freeswitch.org/downloads/s…1 解压ssl.ca-0.1.tar.gz tar zxfv ssl.ca-0.1.tar.gz 1 执行以下命令 [root@localhost ~]# cd ssl.ca-0.1/ [root@localhost ssl.ca-0.1]# perl -i -pe 's/md5/sha1/g' *.sh [root@localhost ssl.ca-0.1]# perl -i -pe 's/2048/2048/g' *.sh 1 2 3 生成根证书 [root@localhost ssl.ca-0.1]# ./new-root-ca.sh No Root CA key round. Generating one Generating RSA private key, 1024 bit long modulus .....................++++++ ...............................................................++++++ e is 65537 (0x10001) Enter pass phrase for ca.key:  根证书密码 Verifying - Enter pass phrase for ca.key: Self-sign the root CA... Enter pass phrase for ca.key:  根证书密码 You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank.
Country Name (2 letter code) [MY]:CN  国籍 State or Province Name (full name) [Perak]:bj 省份 Locality Name (eg, city) [Sitiawan]:bj  市 Organization Name (eg, company) [My Directory Sdn Bhd]:qd 公司名称 Organizational Unit Name (eg, section) [Certification Services Division]:ts 组织名称 Common Name (eg, MD Root CA) []:su 常用名 Email Address []:su@163.com  邮箱地址 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 执行完毕后,会在当前目录生成ca.key和ca.crt两个文件 为服务器生成一个证书 [root@localhost ssl.ca-0.1]# ./new-server-cert.sh  server Fill in certificate data You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank.
Country Name (2 letter code) [MY]:CN State or Province Name (full name) [Perak]:bj Locality Name (eg, city) [Sitiawan]:bj Organization Name (eg, company) [My Directory Sdn Bhd]:qd Organizational Unit Name (eg, section) [Secure Web Server]:ts Common Name (eg, www.domain.com) []:www.fstest.com 此处须域名 Email Address []:su@163.comYou may now run ./sign-server-cert.sh to get it signed 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 执行完毕后,生成了server.csr和server.key这两个文件 签署证书使证书生效 [root@localhost ssl.ca-0.1]# ./sign-server-cert.sh server CA signing: server.csr -> server.crt: Using configuration from ca.config Enter pass phrase for ./ca.key: Check that the request matches the signature Signature ok The Subject's Distinguished Name is as follows countryName           :PRINTABLE:'CN' stateOrProvinceName   :PRINTABLE:'bj' localityName          :PRINTABLE:'bj' organizationName      :PRINTABLE:'qd' organizationalUnitName:PRINTABLE:'ts' commonName            :PRINTABLE:'www.fstest.com' emailAddress          :IA5STRING:'su@163.com' Certificate is to be certified until Nov  9 06:26:54 2019 GMT (365 days) Sign the certificate? [y/n]:y 1 out of 1 certificate requests certified, commit? [y/n]y Write out database with 1 new entries Data Base Updated CA verifying: server.crt <-> CA cert server.crt: OK 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 出现:/etc/pki/CA/index.txt: No such file or directory
执行命令: touch /etc/pki/CA/index.txt
出现:/etc/pki/CA/serial: No such file or directory
执行命令: echo 00 > /etc/pki/CA/serial
执行完毕后,生成了server.crt文件
配置freeswitch开启wss 生成wss.pem [root@localhost ssl.ca-0.1]# cat server.crt server.key > wss.pem 1 替换(备份)freeswitch证书文件 [root@localhost certs]# cd /usr/local/freeswitch/certs/ [root@localhost certs]# ls dtls-srtp.pem  tls.pem  wss.crt  wss.pem 删除已有的dtls-srtp.pem,FS重启后会自动生成! [root@localhost certs]# rm -rf dtls-srtp.pem wss.pem [root@localhost certs]# cp /usr/local/freeswitch/certs/wss.pem ./ [root@localhost certs]# ls tls.pem  wss.crt  wss.pem [root@localhost certs]# freeswitch -stop Killing: 26732 [root@localhost certs]# freeswitch -nc 29868 Backgrounding. 1 2 3 4 5 6 7 8 9 10 11 12 修改freeswitch配置文件
修改internal.xml [root@254 ssl.ca-0.1]# vim /usr/local/freeswitch/conf/sip_profiles/internal.xml 设置wss-binding,默认为7443,可修改

1 2 3 修改vars.xml [root@254 ssl.ca-0.1]# vim /usr/local/freeswitch/conf/vars.xml 设置以下参数 1 2 3 4 如果是局域网使用,得做一个 ACL 配置,否则不通 conf/autoload_configs/acl.conf.xml 中,加入下面配置: 然后,conf/sip_profiles/internal.xml 中加入下列配置: 1 2 3 4 5 6 检查是否成功

执行此命令可以看到wss所绑定的端口 [root@254 ssl.ca-0.1]# fs_cli -x 'sofia status profile internal' | grep WSS-BIND-URL WSS-BIND-URL     sips:mod_sofia@192.168.0.254:7443;transport=wss 1 2 3 最后再次重启或F6重新加载配置

nginx配置自签名https域名 确定nginx已经安装,且支持https [root@localhost ~]# nginx  -V nginx version: nginx/1.9.1 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) built with OpenSSL 1.0.2k-fips  26 Jan 2017 TLS SNI support enabled configure arguments: --prefix=/data/nginx --with-http_ssl_module 1 2 3 4 5 6 一定确保出现:--with-http_ssl_module 否则需要自行安装 配置nginx.conf文件 vim /data/nginx/conf/nginx.conf #user  nobody; worker_processes  1; events { worker_connections  1024; } http { include       mime.types; default_type  application/octet-stream;

sendfile        on; #tcp_nopush     on; #keepalive_timeout  0; keepalive_timeout  65; #gzip  on; # HTTPS server server { listen    443 ssl; server_name  fstest.com  www.fstest.com; ssl on; ## server.crt 和server.key 是上面生成的证书文件 ssl_certificate     /root/ssl.ca-0.1/server.crt; ssl_certificate_key  /root/ssl.ca-0.1/server.key;

#    ssl_session_cache    shared:SSL:1m; ssl_session_timeout  50m; #    ssl_ciphers  HIGH:!aNULL:!MD5; #    ssl_prefer_server_ciphers  on;

location / {
    root /data/demo/;  #前端编译后的静态页面目录 
       }
}
server {
  listen 80;
  server_name fstest.com  www.fstest.com; #多个域名用空格分开
  #将请求转成https
  rewrite ^(.*)$ https://$host$1 permanent;
   }
复制代码

}

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 页面集成软电话开发 使用jssip类库集成。详情参见jssip官方文档和官方demo或者本篇文章使用的demo(推荐)

测试通话

修改本机hosts文件,以Mac系统为例:

打开命令行窗口 或者 item sudo vi /etc/hosts 输入密码 加入:192.168.1.34 www.fstest.com:wq保存退出 1 2 3 4 5 打开浏览器(chorme)地址栏输入:

chrome://flags/#unsafely-treat-insecure-origin-as-secure 1 如下图设置

网络异常,图片无法展示
|

重启浏览器后地址栏输入:www.fstest.com (结合nginx配置)

如下图设置

网络异常,图片无法展示
|

输入账号,密码,先注册,成功后即可拨打或者接听电话!

相关文章
|
6月前
|
编解码 应用服务中间件 Linux
centos配置nginx-rtmp实现ffmpeg转码rtsp为rtmp视频流
centos配置nginx-rtmp实现ffmpeg转码rtsp为rtmp视频流
577 1
|
10月前
|
负载均衡 应用服务中间件 nginx
Nginx配置与命令
Nginx 是一款高性能的 HTTP 和反向代理服务器,其配置文件灵活且功能强大。本文介绍了 Nginx 配置的基础结构和常用指令,包括全局块、Events 块、HTTP 块及 Server 块的配置方法,以及静态资源服务、反向代理、负载均衡、HTTPS 和 URL 重写等功能实现。此外,还提供了常用的 Nginx 命令操作,如启动、停止、重载配置和日志管理等,帮助用户高效管理和优化服务器性能。
974 14
|
6月前
|
Ubuntu 安全 应用服务中间件
详细指南:配置Nginx服务器在Ubuntu平台上
以上步骤涵盖了基本流程:从软件包管理器获取 Ngnix, 设置系统服务, 调整UFW规则, 创建并激活服务器块(也称作虚拟主机), 并进行了初步优化与加固措施。这些操作都是建立在命令行界面上,并假设用户具有必要权限(通常是root用户)来执行这些命令。每个操作都有其特定原因:例如,设置开机启动确保了即使重启后也能自动运行 Ngnix;而编辑server block则定义了如何处理进入特定域名请求等等。
378 18
|
6月前
|
Ubuntu 安全 应用服务中间件
详细指南:配置Nginx服务器在Ubuntu平台上
以上步骤涵盖了基本流程:从软件包管理器获取 Ngnix, 设置系统服务, 调整UFW规则, 创建并激活服务器块(也称作虚拟主机), 并进行了初步优化与加固措施。这些操作都是建立在命令行界面上,并假设用户具有必要权限(通常是root用户)来执行这些命令。每个操作都有其特定原因:例如,设置开机启动确保了即使重启后也能自动运行 Ngnix;而编辑server block则定义了如何处理进入特定域名请求等等。
607 17
|
7月前
|
数据建模 应用服务中间件 PHP
配置nginx容器和php容器协同工作成功,使用ip加端口的方式进行通信
本示例演示如何通过Docker挂载同一宿主目录至Nginx与PHP容器,实现PHP项目运行环境配置。需注意PHP容器中监听地址修改为0.0.0.0:9000,并调整Nginx配置中fastcgi_pass指向正确的IP与端口。同时确保Nginx容器中/var/www/html权限正确,以避免访问问题。
配置nginx容器和php容器协同工作成功,使用ip加端口的方式进行通信
|
8月前
|
应用服务中间件 网络安全 nginx
配置Nginx以支持Websocket连接的方法。
通过上述配置,Nginx将能够理解WebSocket协议的特殊要求,代理Websocket流量到合适的后端服务器。注意,Websocket并不是HTTP,尽管它最初是通过HTTP请求启动的连接升级,因此保证Nginx了解并能够妥善处理这种升级流程是关键。
1863 10
|
7月前
|
Ubuntu 应用服务中间件 Linux
在Ubuntu上配置Nginx实现开机自启功能
至此,Nginx应该已经被正确地设置为开机自启。在Ubuntu中利用 `systemd`对服务进行管理是一种高效的方式,为系统管理员提供了强大的服务管理能力,包括但不限于启动、停止、重启服务,以及配置服务的开机自启动。通过这些简洁的命令,即使是对Linux不太熟悉的用户也能轻松地进行配置。
367 0
|
9月前
|
安全 应用服务中间件 网络安全
Nginx SSL/TLS协议栈中配置深度解析与实践指南-优雅草卓伊凡
Nginx SSL/TLS协议栈中配置深度解析与实践指南-优雅草卓伊凡
679 0
Nginx SSL/TLS协议栈中配置深度解析与实践指南-优雅草卓伊凡
|
10月前
|
安全 网络协议 Linux
Linux网络应用层协议展示:HTTP与HTTPS
此外,必须注意,从HTTP迁移到HTTPS是一项重要且必要的任务,因为这不仅关乎用户信息的安全,也有利于你的网站评级和粉丝的信心。在网络世界中,信息的安全就是一切,选择HTTPS,让您的网站更加安全,使您的用户满意,也使您感到满意。
301 18
|
9月前
|
JSON 前端开发 应用服务中间件
配置Nginx根据IP地址进行流量限制以及返回JSON格式数据的方案
最后,记得在任何生产环境部署之前,进行透彻测试以确保一切运转如预期。遵循这些战术,守卫你的网络城堡不再是难题。
377 3