首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JSSIP/SIP-JS呼叫退出

JSSIP/SIP-JS呼叫退出
EN

Stack Overflow用户
提问于 2014-04-04 12:55:17
回答 1查看 3.3K关注 0票数 0

在使用jssip/sipjs库进行调用时,我遇到了退出。也没有音频。以下是javascript控制台中显示的内容。

代码语言:javascript
复制
====
Fri Apr 04 2014 10:14:30 GMT+0530 (IST) | sip.sanitycheck | Via sent-by in the response does not match UA Via host value. Dropping the response sip-0.5.0.js:170
Fri Apr 04 2014 10:14:34 GMT+0530 (IST) | sip.sanitycheck | Via sent-by in the response does not match UA Via host value. Dropping the response sip-0.5.0.js:170
Fri Apr 04 2014 10:14:38 GMT+0530 (IST) | sip.sanitycheck | Via sent-by in the response does not match UA Via host value. Dropping the response sip-0.5.0.js:170
Fri Apr 04 2014 10:14:42 GMT+0530 (IST) | sip.sanitycheck | Via sent-by in the response does not match UA Via host value. Dropping the response sip-0.5.0.js:170

设置包括asterisk服务器和webrtc服务。

下面给出的是我用来测试的示例html页面。

代码语言:javascript
复制
<!DOCTYPE html>
<html>
<head>
<!-- <script type="text/javascript" src="SIPml-api.js"></script> -->
</head>

<body>
Hello woirld
<video id="remoteVideo"></video>
    <video id="localVideo" muted="muted"></video> 
  <button type="button" id="endButton">End</button>  
<button type="button" id="callButton">Call</button>
</body>
<script type="text/javascript" src="sip-0.5.0.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript">

(function () {
  var session;

  function onAccepted () {
    alert("You made a call!");
  }

var userAgent = new SIP.UA({
  uri: 'sip:100@X.X.X.X',
//  wsServers: ['ws://mywebrtc.com:10060'],
  wsServers: ['wss://mywebrtc.com:10062'],
  authorizationUser: '100',
  password: '1234'
});


$( document ).ready(function() {

  var endButton = document.getElementById('endButton');
  endButton.addEventListener("click", function() {
    session.bye();
    alert("Call Ended");
}, false);

});


  //here you determine whether the call has video and audio
  var options = {
    mediaConstraints: {
      audio: true,
      video: true
    }
  };
  //makes the call
  session = userAgent.invite('111', options);
  session.on('accepted', onAccepted);

}) ();



</script>
</html>

=====

有人能帮帮我吗?

EN

回答 1

Stack Overflow用户

发布于 2014-08-01 20:13:34

尝试从您的代码中替换以下内容

代码语言:javascript
复制
<video id="remoteVideo"></video>
    <video id="localVideo" muted="muted"></video>

使用

代码语言:javascript
复制
<audio  id="remoteAudio"></audio>
    <audio  id="localAudio" muted="muted"></audio>

代码语言:javascript
复制
 //here you determine whether the call has video and audio
      var options = {
        mediaConstraints: {
          audio: true,
          video: true
        }
      };

使用

//在这里判断呼叫是否有视频和音频

代码语言:javascript
复制
var options = {

                 media: {
                          constraints: {
                                         audio: true,
                                         video: false,
                                       },
                          render: {
                                    remote: {
                                               audio: document.getElementById('remoteAudio')
                                            },

                                    local:  {
                                               audio: document.getElementById('localAudio')
                                            }
                                  }
                       }
};

我已经使用Asterisk 11.11.0、Firefox 31.0和Opera 22.0.1471.70进行了测试。音频呼叫工作正常。我在最新的chrome浏览器(版本37.0.2062.58 beta-m (64位))上没有遇到音频问题。除此之外,它的作品也很有魅力。

还有一件事,Asterisk不支持vp8编解码器,所以视频不能工作。Asterisk 12支持直通模式下的vp8编解码器。我还没有测试这个特性。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22853881

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档