连接它
我正在尝试使用已经运行的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
它不是JSSIP或Web插座的问题。您的sip.group.com wss不接受新连接,尝试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