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配置)

如下图设置

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

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

相关文章
|
5月前
|
人工智能 Ubuntu 前端开发
Dify部署全栈指南:AI从Ubuntu配置到HTTPS自动化的10倍秘籍
本文档介绍如何部署Dify后端服务及前端界面,涵盖系统环境要求、依赖安装、代码拉取、环境变量配置、服务启动、数据库管理及常见问题解决方案,适用于开发与生产环境部署。
1228 1
|
9月前
|
应用服务中间件 Linux 网络安全
Centos 8.0中Nginx配置文件和https正书添加配置
这是一份Nginx配置文件,包含HTTP与HTTPS服务设置。主要功能如下:1) 将HTTP(80端口)请求重定向至HTTPS(443端口),增强安全性;2) 配置SSL证书,支持TLSv1.1至TLSv1.3协议;3) 使用uWSGI与后端应用通信(如Django);4) 静态文件托管路径设为`/root/code/static/`;5) 定制错误页面(404、50x)。适用于Web应用部署场景。
890 87
|
4月前
|
网络安全 开发工具 git
在GitLab CI中同步HTTPS仓库地址的yaml配置
最后,提交并推送 `.gitlab-ci.yml`文件到您的GitLab仓库。GitLab CI/CD将自动识别这个文件,并在每次推送到 `master`分支时执行定义的同步任务。
239 16
|
9月前
|
SQL Java 关系型数据库
Dataphin功能Tips系列(53)-离线集成任务如何合理配置JVM资源
本文探讨了将MySQL数据同步至Hive时出现OOM问题的解决方案。
229 5
|
9月前
|
JSON JavaScript API
MCP 实战:用配置与真实代码玩转 GitHub 集成
MCP 实战:用配置与真实代码玩转 GitHub 集成
1918 4
|
10月前
|
缓存 前端开发 API
(网页系统集成CAD功能)在线CAD中配置属性的使用教程
本文介绍了Mxcad SDK在线预览和编辑CAD图纸的功能及配置方法。通过Vite、CDN或Webpack实现集成,用户可自定义设置以满足项目需求。主要内容包括:1)`createMxCad()`方法的初始属性配置,如画布ID、WASM文件路径、字体加载路径等;2)`MxFun.setIniset()`方法提供的更多CAD初始配置;3)`McObject`对象API用于动态调整视图背景色、浏览模式等。此外,还提供了在线Demo(https://demo2.mxdraw3d.com:3000/mxcad/)供用户测试实时效果。
|
9月前
|
安全 网络协议 Linux
Linux网络应用层协议展示:HTTP与HTTPS
此外,必须注意,从HTTP迁移到HTTPS是一项重要且必要的任务,因为这不仅关乎用户信息的安全,也有利于你的网站评级和粉丝的信心。在网络世界中,信息的安全就是一切,选择HTTPS,让您的网站更加安全,使您的用户满意,也使您感到满意。
261 18
|
9月前
|
网络安全 开发者
如何解决HTTPS协议在WordPress升级后对网站不兼容的问题
以上就是解决WordPress升级后HTTPS协议对网站的不兼容问题的方法。希望能把这个棘手的问题看成是学校的管理问题一样来应对,将复杂的技术问题变得更加有趣和形象,并寻觅出解决问题的方式。希望你的网站能在新的学期得到更好的发展!
251 19
|
9月前
|
JSON 安全 网络协议
HTTP/HTTPS协议(请求响应模型、状态码)
本文简要介绍了HTTP与HTTPS协议的基础知识。HTTP是一种无状态的超文本传输协议,基于TCP/IP,常用80端口,通过请求-响应模型实现客户端与服务器间的通信;HTTPS为HTTP的安全版本,基于SSL/TLS加密技术,使用443端口,确保数据传输的安全性。文中还详细描述了HTTP请求方法(如GET、POST)、请求与响应头字段、状态码分类及意义,并对比了两者在请求-响应模型中的安全性差异。
887 20
|
9月前
|
安全 网络协议 算法
HTTP/HTTPS与SOCKS5协议在隧道代理中的兼容性设计解析
本文系统探讨了构建企业级双协议隧道代理系统的挑战与实现。首先对比HTTP/HTTPS和SOCKS5协议特性,分析其在工作模型、连接管理和加密方式上的差异。接着提出兼容性架构设计,包括双协议接入层与统一隧道内核,通过协议识别模块和分层设计实现高效转换。关键技术部分深入解析协议转换引擎、连接管理策略及加密传输方案,并从性能优化、安全增强到典型应用场景全面展开。最后指出未来发展趋势将更高效、安全与智能。
389 1

热门文章

最新文章