https://quantum6.blog.csdn.net/article/details/106031371

在这一篇文章中,没有登录成功,自然也无法呼叫。经过痛苦的过程,终于找到了正确办法:

  • freeswitch需要wss证书。

参考:

  • 正确填写登录信息

端口不要改,使用默认的。

  • 查看登录结果

  • 登录代码

不知道从哪里复制来的,非常感谢。确实登录成功。

<!DOCTYPE html>
<html>
<head><title>JsSIP + WebRTC + freeSWITCH</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta name="Author" content="foruok" /><meta name="description" content="JsSIP based example web application." /><script src="jssip-3.4.4.min.js" type="text/javascript"></script><style type="text/css"></style>
</head><body><div id="login-page" style="width: 424px; height: 260px; background-color: #f2f4f4; border: 1px solid grey; padding-top: 4px"><table border="0" frame="void" width="418px"><tr><td class="td_label" width="160px" align="right"><label for="sip_uri">SIP URI:</label></td><td width="258px"><input style="width:250px" id="sip_uri" type="text" placeholder="SIP URI (i.e: sip:alice@example.com)" value="sip:1011@192.168.1.111:5060" /></td></tr><tr><td class="td_label"  align="right"><label for="sip_password">SIP Password:</label></td><td><input style="width:250px" id="sip_password" type="password" placeholder="SIP password"value="1234" /></td></tr><tr><td class="td_label" align="right"><label for="ws_uri">WSS URI:</label></td><td><input style="width:250px" id="ws_uri" class="last unset" type="text" placeholder="WSS URI (i.e: wss://example.com)"value="wss://192.168.1.111:7443" /></td></tr><tr><td class="td_label"  align="right"><label class="input_label" for="sip_phone_number">SIP Phone Info:</label></td><td><input style="width:250px" id="sip_phone_number" type="text" placeholder="sip:3000@192.168.40.96:5060"value="sip:1001@192.168.1.111:5060" ></td></tr><tr><td colspan="2" align="center"><button onclick="testStart()"> Initialize </button></td></tr><tr><td colspan="2" align="center"><button onclick="testCall()"> Call </button></td></tr><tr><td  colspan="2" align="center"><button onclick="captureLocalMedia()"> Capture Local Media</button></td></tr></table></div><div style="width: 424px; height: 324px;background-color: #333333; border: 2px solid blue; padding:0px; margin-top: 4px;"><video id="videoView" width="420px" height="320px" autoplay ></video></div></body><script type="text/javascript">var outgoingSession = null;var incomingSession = null;var currentSession = null;var videoView = document.getElementById('videoView');var constraints = {audio: true,video: true,     mandatory: {maxWidth: 640,maxHeight: 360}};URL = window.URL || window.webkitURL;var localStream = null;var userAgent = null;function gotLocalMedia(stream) {console.info('Received local media stream');localStream = stream;videoView.src = URL.createObjectURL(stream);}function captureLocalMedia() {console.info('Requesting local video & audio');navigator.webkitGetUserMedia(constraints, gotLocalMedia, function(e){alert('getUserMedia() error: ' + e.name);});}function testStart(){var sip_uri_ = document.getElementById("sip_uri").value.toString();var sip_password_ = document.getElementById("sip_password").value.toString();var ws_uri_ = document.getElementById("ws_uri").value.toString();console.info("get input info: sip_uri = ", sip_uri_, " sip_password = ", sip_password_, " ws_uri = ", ws_uri_);var socket = new JsSIP.WebSocketInterface(ws_uri_);var configuration = {sockets: [ socket ],outbound_proxy_set: ws_uri_,uri: sip_uri_,password: sip_password_,register: true,session_timers: false};userAgent = new JsSIP.UA(configuration);userAgent.on('registered', function(data){console.info("registered: ", data.response.status_code, ",", data.response.reason_phrase);});userAgent.on('registrationFailed', function(data){console.log("registrationFailed, ", data);//console.warn("registrationFailed, ", data.response.status_code, ",", data.response.reason_phrase, " cause - ", data.cause);});userAgent.on('registrationExpiring', function(){console.warn("registrationExpiring");});userAgent.on('newRTCSession', function(data){console.info('onNewRTCSession: ', data);if(data.originator == 'remote'){ //incoming callconsole.info("incomingSession, answer the call");incomingSession = data.session;data.session.answer({'mediaConstraints' : { 'audio': true, 'video': true,       mandatory: { maxWidth: 640, maxHeight: 360 } }, 'mediaStream': localStream});}else{console.info("outgoingSession");outgoingSession = data.session;outgoingSession.on('connecting', function(data){console.info('onConnecting - ', data.request);currentSession = outgoingSession;outgoingSession = null;});}data.session.on('accepted', function(data){console.info('onAccepted - ', data);if(data.originator == 'remote' && currentSession == null){currentSession = incomingSession;incomingSession = null;console.info("setCurrentSession - ", currentSession);}});data.session.on('confirmed', function(data){console.info('onConfirmed - ', data);if(data.originator == 'remote' && currentSession == null){currentSession = incomingSession;incomingSession = null;console.info("setCurrentSession - ", currentSession);}          });data.session.on('sdp', function(data){console.info('onSDP, type - ', data.type, ' sdp - ', data.sdp);//data.sdp = data.sdp.replace('UDP/TLS/RTP/SAVPF', 'RTP/SAVPF');//console.info('onSDP, changed sdp - ', data.sdp);});data.session.on('progress', function(data){console.info('onProgress - ', data.originator);if(data.originator == 'remote'){console.info('onProgress, response - ', data.response);}});data.session.on('peerconnection', function(data){console.info('onPeerconnection - ', data.peerconnection);data.peerconnection.onaddstream = function(ev){console.info('onaddstream from remote - ', ev);videoView.src = URL.createObjectURL(ev.stream);};});});userAgent.on('newMessage', function(data){if(data.originator == 'local'){console.info('onNewMessage , OutgoingRequest - ', data.request);}else{console.info('onNewMessage , IncomingRequest - ', data.request);}});console.info("call register");userAgent.start();}// Register callbacks to desired call eventsvar eventHandlers = {'progress': function(e) {console.log('call is in progress');},'failed': function(e) {console.log('call failed: ', e);},'ended': function(e) {console.log('call ended : ', e);},'confirmed': function(e) {console.log('call confirmed');}};function testCall(){var sip_phone_number_ = document.getElementById("sip_phone_number").value.toString();var options = {'eventHandlers'    : eventHandlers,'mediaConstraints' : { 'audio': true, 'video': true , mandatory: { maxWidth: 640, maxHeight: 360 }},'mediaStream': localStream};//outgoingSession = userAgent.call('sip:3000@192.168.40.96:5060', options);outgoingSession = userAgent.call(sip_phone_number_, options);}</script>
</html>

webRTC:jssip登录freeswitch的正确办法及代码相关推荐

  1. freeswitch + webRtc +jssip 实现web端语音通话

    版权声明:本文为CSDN博主「foruok」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明. 原文链接:https://blog.csdn.net/foruok/ ...

  2. mysql 无法登陆_MySQL root用户无法登录原因及解决办法

    MySQL root密码正确,却怎么也bai无法du从本地登录MySQL登录提示ERROR 1045 (28000): Access denied for user 'root'@'localhost ...

  3. MSN登录不了解决办法总结

    MSN登录不了解决办法总结   解决0x81000370不能登录MSN|MSN登录时提示错误代码: 0001836E或80072EFD错误 解决0x81000370不能登录MSN 可能有许多原因导致不 ...

  4. 有道云笔记网页剪报无法登录、无法使用的办法

    有道云笔记网页剪报无法登录.无法使用的办法 Chrome更新频繁,对各种扩展提出了更多要求,很多扩展都无法使用报,有道云笔记网页剪报也受到影响. google应用市场里的扩展程序无法使用. 看到网友说 ...

  5. 梦幻西游三维版显示服务器未开启,梦幻西游三维版登录不进去怎么办-梦幻西游三维版登录不进去解决办法介绍_斗蟹游戏网...

    [斗蟹攻略]梦幻西游三维版登录不进去怎么办?有很多小伙伴们都不知道,那么下面就由斗蟹小编为大家带来梦幻西游三维版登录不进去解决办法介绍,希望能够帮助到大家. 梦幻西游三维版登录不进去解决办法介绍 提示 ...

  6. php keep user login,php5.4安装dedecms登录后台空白解决办法(session_register函数已废弃)...

    本地安装dedecms5.7登录后台空白,找了原因,原来是session_register函数已经被php5.4废弃的原因. ------------------------------------- ...

  7. 计算机屏保后无法进入登录界面,Win10锁屏界面无法登录卡在登录状态的应对办法...

    使用win10系统过程中,在锁屏界面输入密码后一直卡在登录状态,约 20~30 秒系统又自动锁屏并重复这个过程,Win10锁屏界面无法登录卡在登录状态怎么办?现小编介绍Win10锁屏界面无法登录卡在登 ...

  8. 关于在win10登录界面输入正确密码不能登入

    关于在win10登录界面输入正确密码不能登入 问题描述 解决方法流程 写在最后 参考网页网址 问题描述 ---- 在win10登录界面输入正确密码,然而登录界面在短时间等待之后"黑" ...

  9. 忘记Win2000登录密码的解决办法

    忘记Win2000登录密码的解决办法 昨天公司一位领导将自己装了Win2000 professional的电脑的登录密码给忘记了,让我给解决一下,以前没有弄过,于是在baidu.com上搜了一下,结果 ...

  10. 无限法则登录超时中的服务器错误,网友吐槽《无限法则》游戏无法登录 其实解决的办法很简单!...

    原标题:网友吐槽<无限法则>游戏无法登录 其实解决的办法很简单! 距离<无限法则>开启免费测试已经过了两天,在这两天的测试中,也是收获了大批玩家的好评,在Steam的评价中,一 ...

最新文章

  1. 计算上月、下月、上周、下周..日期范围
  2. Hadoop/Spark生态圈里的新气象
  3. android开发版本,Android开发之版本统一规范
  4. leetcode 37. 解数独 思考分析
  5. 1.3 编程基础之算术表达式与顺序执行 13 反向输出一个三位数(C++ Scratch)
  6. OJ1040:(递推思想高阶)数列求和1
  7. Zeppelin 可视化操作spark sql
  8. volatile的正确使用姿势
  9. FTP和TCP、UDP
  10. Apache WEB 服务器企业实战
  11. ubuntu 15.10 升级 到Ubuntu 16.04.3 LTS
  12. Mail_Android_Video_SW_DDK_Intergration_Guide_And_Codec_User_Manual中文翻译【chapter1】
  13. linux 查看内存大小命令,Linux查看命令:CPU型号,内存大小,硬盘空间
  14. 假货泛滥是淘宝的毒瘤
  15. 2-AltiumDesigner原理图设计
  16. Android性能优化之页面优化
  17. leetcode_Restore IP Addresses
  18. curl命令发送Post请求
  19. [蓝桥杯2015决赛]穿越雷区
  20. 如何将计算机声音改成音乐,win7系统把MP3音频转换成WAV格式的图文教程

热门文章

  1. 根据pid查端口_PID控制原理:看完这几个故事你就明白了
  2. 为什么打印出来的文件右边有阴影_怎样将十几几十页的长文件文档打印成A4纸对折的小册子?...
  3. 接口监控_从零开始入门 K8s | 可观测性:监控与日志
  4. Android 微信分享与QQ分享功能
  5. 删缓存,数据库更新谁先执行,及延时双删
  6. 秒杀系统的核心点都在这里,快来取
  7. GET /favicon.ico HTTP/1.1 404
  8. Android四大组件每个组件的作用?它们都可以开启多进程吗?
  9. 【转载】合理规划您的硬盘分区
  10. PHP与MySQL设计模式:代理模式