Я использую простой код на основе SIPjs с сервером с бесплатным коммутатором.Я пытаюсь зарегистрировать пользовательский агент и сделать приглашение для создания сеанса, но это не работает.Камера открывается, и все закрывается через 5 секунд, не имея возможности совершить вызов.
Это журнал, который я получил от соединения:
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | configuration parameters after validation: sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · viaHost: "kpp2l67cqloc.invalid" sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · uri: sip:1002@serv24.com sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · custom: {} sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · displayName: "" sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · password: NOT SHOWN sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · registerExpires: 600 sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · register: true sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · registrarServer: sip:serv24.com sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · transportConstructor: i sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · transportOptions: {} sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · userAgentString: "SIP.js/0.11.6" sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · noAnswerTimeout: 60000 sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · hackViaTcp: false sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · hackIpInContact: false sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · hackWssInTransport: false sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · hackAllowUnregisteredOptionTags: false sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · sessionDescriptionHandlerFactoryOptions: {"constraints":{},"peerConnectionOptions":{}} sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · contactName: "8l475d4t" sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · contactTransport: "ws" sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · forceRport: false sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · autostart: true sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · autostop: true sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · rel100: "none" sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · dtmfType: "info" sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · replaces: "none" sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · sessionDescriptionHandlerFactory: function(e,t){var r=e.ua.getLogger("sip.invitecontext.sessionDescriptionHandler",e.id),n=new(i(31))(e,t);return new s(r,n,t)} sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · authenticationFactory: undefined sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · allowLegacyNotifications: false sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · allowOutOfDialogRefers: false sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · authorizationUser: "1002" sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · instanceId: "ed1d1f6b-e9ba-43a8-b96e-12a257e508b6" sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · sipjsId: "9h4mc" sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | · hostportParams: "serv24.com" sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.ua | user requested startup... sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.transport | configuration parameters after validation: sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.transport | · wsServers: [{"scheme":"WSS","sip_uri":"<sip:edge.sip.onsip.com;transport=ws;lr>","weight":0,"ws_uri":"wss://edge.sip.onsip.com","isError":false}] sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.transport | · connectionTimeout: 5 sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.transport | · maxReconnectionAttempts: 3 sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.transport | · reconnectionTimeout: 4 sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.transport | · keepAliveInterval: 0 sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.transport | · keepAliveDebounce: 10 sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.transport | · traceSip: false sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:50 GMT+0100 (hora estándar de Europa central) | sip.transport | connecting to WebSocket wss://edge.sip.onsip.com
Thu Nov 22 2018 09:43:51 GMT+0100 (hora estándar de Europa central) | sip.transport | WebSocket wss://edge.sip.onsip.com connected sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:53 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | SessionDescriptionHandlerOptions: {"constraints":{},"peerConnectionOptions":{}} sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:53 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | initPeerConnection sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:53 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | New peer connection created sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:53 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | acquiring local media sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | acquired local media streams sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | RTCIceGatheringState changed: gathering sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:0 1 UDP 2122252543 192.168.56.1 63656 typ host sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:2 1 UDP 2122187007 2a02:121f:6bf:1:105d:48c4:e002:6907 63657 typ host sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:4 1 UDP 2122121471 192.168.3.203 63658 typ host sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:6 1 TCP 2105524479 192.168.56.1 9 typ host tcptype active sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:7 1 TCP 2105458943 2a02:121f:6bf:1:105d:48c4:e002:6907 9 typ host tcptype active sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:8 1 TCP 2105393407 192.168.3.203 9 typ host tcptype active sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:0 2 UDP 2122252542 192.168.56.1 56756 typ host sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:2 2 UDP 2122187006 2a02:121f:6bf:1:105d:48c4:e002:6907 56757 typ host sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:4 2 UDP 2122121470 192.168.3.203 56758 typ host sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:6 2 TCP 2105524478 192.168.56.1 9 typ host tcptype active sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:7 2 TCP 2105458942 2a02:121f:6bf:1:105d:48c4:e002:6907 9 typ host tcptype active sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:8 2 TCP 2105393406 192.168.3.203 9 typ host tcptype active sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:0 1 UDP 2122252543 192.168.56.1 56759 typ host sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:2 1 UDP 2122187007 2a02:121f:6bf:1:105d:48c4:e002:6907 56760 typ host sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:4 1 UDP 2122121471 192.168.3.203 56761 typ host sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:6 1 TCP 2105524479 192.168.56.1 9 typ host tcptype active sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:7 1 TCP 2105458943 2a02:121f:6bf:1:105d:48c4:e002:6907 9 typ host tcptype active sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:8 1 TCP 2105393407 192.168.3.203 9 typ host tcptype active sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:0 2 UDP 2122252542 192.168.56.1 56762 typ host sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:2 2 UDP 2122187006 2a02:121f:6bf:1:105d:48c4:e002:6907 56763 typ host sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:4 2 UDP 2122121470 192.168.3.203 56764 typ host sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:6 2 TCP 2105524478 192.168.56.1 9 typ host tcptype active sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:7 2 TCP 2105458942 2a02:121f:6bf:1:105d:48c4:e002:6907 9 typ host tcptype active sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:8 2 TCP 2105393406 192.168.3.203 9 typ host tcptype active sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:5 1 UDP 1685921791 146.4.10.10 63658 typ srflx raddr 192.168.3.203 rport 63658 sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:5 2 UDP 1685921790 146.4.10.10 56758 typ srflx raddr 192.168.3.203 rport 56758 sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:5 1 UDP 1685921791 146.4.10.10 56761 typ srflx raddr 192.168.3.203 rport 56761 sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:43:57 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:5 2 UDP 1685921790 146.4.10.10 56764 typ srflx raddr 192.168.3.203 rport 56764 sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:44:02 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | RTCIceChecking Timeout Triggered after 5000 milliseconds sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:44:02 GMT+0100 (hora estándar de Europa central) | sip.inviteclientcontext | closing INVITE session 9h4mc2g6b5s5sbvvcnd197eq6fdeno sip-0.11.6.min.js:1:8973
Thu Nov 22 2018 09:44:02 GMT+0100 (hora estándar de Europa central) | sip.invitecontext.sessionDescriptionHandler | closing PeerConnection sip-0.11.6.min.js:1:8973
Возможно, это неверная конфигурация сервера или свободного переключателя?Я не могу понять, где проблема.Вот код SIPjs:
var userAgent = new SIP.UA({
uri: 'useruri',
wsServers: ['wss://serveraddress'],
authorizationUser: 'username',
password: 'pass',
traceSip: true
});
var options = {
media: {
constraints: {
audio: true,
video: true
},
render: {
remote: document.getElementById('remoteVideo'),
local: document.getElementById('localVideo')
}
}
};
var startButton = document.getElementById('startCall');
startButton.addEventListener("click", function() {
session = userAgent.invite('address', options);
alert("Call Started");
}, false);
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();
});