Sipjs无法接听电话

时间:2019-11-29 13:47:53

标签: javascript webrtc sip sipjs

我可以通过sipjs呼叫另一个用户。我正在等待通过sipjs打电话。但这还没到。我可以注册到服务器。控制台上没有错误输出。 newRTCSession事件未提供任何输出。

浏览器:Chrome Vue js代码

var callOptions = {
  mediaConstraints: {
    audio: true, // only audio calls
    video: false
  }
};
var bwPhone = new JsSIP.UA({
  ‘uri’: ‘sip:sip-user@your-domain.bwapp.bwsip.io’,
  ‘password’: ‘password’,
  ‘ws_servers’: ‘wss://webrtc.registration.bandwidth.com:10443’
});
bwPhone.start();
bwPhone.on(“newRTCSession”, function(data){
    var session = data.session;
    if (session.direction === “incoming”) {
        // incoming call here
        session.on(“accepted”,function(){
            // the call has answered
        });
        session.on(“confirmed”,function(){
            // this handler will be called for incoming calls too
        });
        session.on(“ended”,function(){
            // the call has ended
        });
        session.on(“failed”,function(){
            // unable to establish the call
        });
        session.on(‘addstream’, function(e){
            // set remote audio stream (to listen to remote audio)
            // remoteAudio is <audio> element on page
            remoteAudio.src = window.URL.createObjectURL(e.stream);
            remoteAudio.play();
        });

0 个答案:

没有答案