0

我正在尝试使用已经运行的 SIP 服务器与 JSSip 建立连接。我遵循了文档并提出了以下代码。这是我的代码。

<!DOCTYPE html>
<html lang="en">
    <head>
        <title></title>
    </head>

    <body></body>

    <script src="jssip-3.0.0.min.js"></script>

    <script>
    var socket = new JsSIP.WebSocketInterface('wss://sip.group.com');
    var configuration = {
        sockets  : [ socket ],
        uri      : 'sip:4051@sip.group.com',
        password : 'password#'
    };

    var coolPhone = new JsSIP.UA(configuration);

    coolPhone.start();

    // Register callbacks to desired call events
    var eventHandlers = {
      'progress': function(e) {
        console.log('call is in progress');
      },
      'failed': function(e) {
        console.log('call failed with cause: '+ e.data.cause);
      },
      'ended': function(e) {
        console.log('call ended with cause: '+ e.data.cause);
      },
      'confirmed': function(e) {
        console.log('call confirmed');
      }
    };

    var options = {
      'eventHandlers'    : eventHandlers,
      'mediaConstraints' : { 'audio': true, 'video': true }
    };

    var session = coolPhone.call('sip:4050@sip.group.com', options);
    </script>
</html>

我的服务器分机号是 4051,我正在尝试拨打 4050 我的同事。但是,如果我打开 Chrome 的控制台,我会看到以下错误:

WebSocket connection to 'wss://sip.group.com/' failed: WebSocket opening handshake was canceled
4

1 回答 1

0

它不是 jsSIP 或 web socket 的问题。您的 sip.group.com wss 不接受新连接,并且在您尝试时没有响应 websocket 的迹象https://sip.group.com/

Connection:close
Content-Length:76
Content-Type:text/plain
Server:RTC/7.0
X-MS-Server-Fqdn:PNQIN100EDG02.infra.lync.com

1.你确定你的wss在443运行吗​​?如果它在不同的端口上运行,则使用wss://sip.group.com:port

于 2017-02-10T15:11:19.813 回答