我有一个有关SIP调用的Sip.js框架的小问题。 问题是,尽管按照配置中的指定将其设置为true,但仍无法启用traceSip参数。 Chrome浏览器中的控制台将'traceSip'参数的值显示为false。我正在尝试将其设置为true
我无法发布到Sip.js邮件列表,因为他们要求将带有此选项的日志附加到我无法执行的帖子中
请附上我的代码
<html>
<head>
<link rel="stylesheet" href="my-styles.css">
<script language="javascript" src="js/sip-0.11.6.min.js"></script>
<script>
var session; // aglobal variable for the user session
var remoteVideo = document.getElementById('remoteVideo');
var localVideo = document.getElementById('localVideo');
//registration
var userAgent = new SIP.UA({
uri: 'test1@10.10.30.10',
transportOptions: {
wsServers: ['ws://10.10.30.10:8090']
},
authorizationUser: 'test1',
password: '****',
traceSip: true,
iceCheckingTimeout: 35000,
register: true,
stunServers: [],
turnServers: []
});
function createUserSession(userName,userAgent)
{
//send invitation
var session = userAgent.invite(userName, {
media: {
constraints: {
audio: true,
video: false
}
}
});
return session;
}
//create the user session
function callUser()
{
session=createUserSession(document.getElementById('txtUserName').value,userAgent);
//alert('Session created' + session.remoteIdentity);
}
//accept invitation
userAgent.on('invite', function(session) {
alert('incoming call');
session.accept();
});
//add media event
session.on('trackAdded', function() {
// We need to check the peer connection to determine which track was added
var pc = session.sessionDescriptionHandler.peerConnection;
// Gets remote tracks
var remoteStream = new MediaStream();
pc.getReceivers().forEach(function(receiver) {
remoteStream.addTrack(receiver.track);
});
remoteVideo.srcObject = remoteStream;
remoteVideo.play();
// Gets local tracks
var localStream = new MediaStream();
pc.getSenders().forEach(function(sender) {
localStream.addTrack(sender.track);
});
localVideo.srcObject = localStream;
localVideo.play();
});
function endCall()
{
session.terminate();
}
</script>
</head>
<body>
fsdfsafd
<video id="remoteVideo"></video>
<video id="localVideo" muted="muted"></video>
<input type='text' id='txtUserName' value='test@10.10.30.10'/>
<button id="endCall" onclick="javascript:endCall();">End Call</button>
<button id="callUser" onclick="callUser();">CAll User</button>
</body>
</html>
预先感谢
马修
答案 0 :(得分:0)
traceSip必须添加到下面的transportOptions部分
var userAgent = new SIP.UA({
uri: 'test@test.local',
transportOptions: {
wsServers: ['ws://10.10.30.10:8090'],
traceSip: true,
iceCheckingTimeout: 35000,
register: true,
stunServers: [],
turnServers: []
},
authorizationUser: 'test',
password: '****'
});