2014-04-04 36 views
0

我在使用jssip/sipjs庫進行調用時出現退出。沒有音頻了。以下內容顯示在JavaScript控制檯中。JSSIP/SIP-JS調用退出

==== 
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 

設置涉及星號服務器和webrtc服務。

下面給出的是我用來測試的示例html頁面。

<!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:[email protected]', 
// 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> 

=====

有人可以幫我在這?從您的代碼

回答

0

嘗試更換以下

<video id="remoteVideo"></video> 
    <video id="localVideo" muted="muted"></video> 

<audio id="remoteAudio"></audio> 
    <audio id="localAudio" muted="muted"></audio> 

//here you determine whether the call has video and audio 
     var options = { 
     mediaConstraints: { 
      audio: true, 
      video: true 
     } 
     }; 

//在這裏確定呼叫是否具有視頻和音頻

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編解碼器。我還沒有測試這個功能。