Я использую freeswitch, поскольку sip-сервер также использует pem из папки freeswitch (/ usr / local / freeswitch / certs).
В клиентской части я использую SIP.js клиент выглядит так:
<script src="https://rawgit.com/onsip/SIP.js/0.8.0/dist/sip-0.8.0.js"></script>
<!--script src="sip-0.12.0.js"></script-->
<video id="remoteVideo"></video>
<video id="localVideo" muted="muted"></video>
<script>
var userAgent = new SIP.UA({
uri: '1002@192.168.0.100',
wsServers: ['wss://192.168.0.100:7443'],
authorizationUser: '1002',
password: '1234',
});
userAgent.on("connected", function() {
console.log("Connected $$$$$$$$$$$$$$$$$$$$$$$$");
});
userAgent.on('invite', function (session) {
session.accept({
media: {
render: {
remote: {
video: document.getElementById('remoteVideo')
},
local: {
video: document.getElementById('localVideo')
}
}
}
});
});
</script>
Журнал ошибок в браузере (хром):
sip-0.8.0.js:11540 WebSocket connection to 'wss://192.168.0.100:7443/' failed: Error in connection establishment: net::ERR_CERT_AUTHORITY_INVALID
connect @ sip-0.8.0.js:11540
Transport @ sip-0.8.0.js:11428
(anonymous) @ sip-0.8.0.js:7798
sip-0.8.0.js:746 Thu Jan 03 2019 11:10:42 GMT+0100 (Central European Standard Time) | sip.transport | WebSocket connection error:
LoggerFactory.print @ sip-0.8.0.js:746
LoggerFactory.(anonymous function) @ sip-0.8.0.js:763
Logger.(anonymous function) @ sip-0.8.0.js:757
onError @ sip-0.8.0.js:11725
ws.onerror @ sip-0.8.0.js:11565
error (async)
connect @ sip-0.8.0.js:11564
Transport @ sip-0.8.0.js:11428
(anonymous) @ sip-0.8.0.js:7798
setTimeout (async)
Timers.(anonymous function) @ sip-0.8.0.js:1446
UA.recoverTransport @ sip-0.8.0.js:7795
UA.onTransportError @ sip-0.8.0.js:7452
onClose @ sip-0.8.0.js:11633
ws.onclose @ sip-0.8.0.js:11552
sip-0.8.0.js:746 Event {isTrusted: true, type: "error", target: WebSocket, currentTarget: WebSocket, eventPhase: 2, …}
LoggerFactory.print @ sip-0.8.0.js:746
LoggerFactory.(anonymous function) @ sip-0.8.0.js:763
Logger.(anonymous function) @ sip-0.8.0.js:757
onError @ sip-0.8.0.js:11726
ws.onerror @ sip-0.8.0.js:11565
error (async)
connect @ sip-0.8.0.js:11564
Transport @ sip-0.8.0.js:11428
(anonymous) @ sip-0.8.0.js:7798
setTimeout (async)
Timers.(anonymous function) @ sip-0.8.0.js:1446
UA.recoverTransport @ sip-0.8.0.js:7795
UA.onTransportError @ sip-0.8.0.js:7452
onClose @ sip-0.8.0.js:11633
ws.onclose @ sip-0.8.0.js:11552
sip-0.8.0.js:746 Thu Jan 03 2019 11:10:42 GMT+0100 (Central European Standard Time) | sip.transport | WebSocket disconnected (code: 1006)
sip-0.8.0.js:746 Thu Jan 03 2019 11:10:42 GMT+0100 (Central European Standard Time) | sip.transport | WebSocket abrupt disconnection
LoggerFactory.print @ sip-0.8.0.js:746
LoggerFactory.(anonymous function) @ sip-0.8.0.js:763
Logger.(anonymous function) @ sip-0.8.0.js:757
onClose @ sip-0.8.0.js:11614
ws.onclose @ sip-0.8.0.js:11552
sip-0.8.0.js:746 Thu Jan 03 2019 11:10:42 GMT+0100 (Central European Standard Time) | sip.ua | transport wss://192.168.0.100:7443 failed | connection state set to 2
sip-0.8.0.js:746 Thu Jan 03 2019 11:10:42 GMT+0100 (Central European Standard Time) | sip.ua | time for next connection attempt exceeds connectionRecoveryMaxInterval, resetting counter
sip-0.8.0.js:746 Thu Jan 03 2019 11:10:42 GMT+0100 (Central European Standard Time) | sip.ua | next connection attempt in 2 seconds
sip-0.8.0.js:746 Thu Jan 03 2019 11:10:44 GMT+0100 (Central European Standard Time) | sip.transport | connecting to WebSocket wss://192.168.0.100:7443
Войти на сервер freeswitch, работающий в localhost env:
tport.c:2753 tport_wakeup_pri() tport_wakeup_pri(0x7f8780e28b20): events IN
tport.c:862 tport_alloc_secondary() tport_alloc_secondary(0x7f8780e28b20): new secondary tport 0x7f878193c200
tport.c:2294 tport_set_secondary_timer() tport(0x7f878193c200): set timer at 4998 ms because keepalive
tport.c:2644 tport_accept() tport_accept(0x7f878193c200): new connection from wss/192.168.0.100:56317/sips
tport.c:2777 tport_wakeup() tport_wakeup(0x7f878193c200): events IN
tport.c:2868 tport_recv_event() tport_recv_event(0x7f878193c200)
tport_type_ws.c:232 tport_recv_stream_ws() tport_recv_stream_ws(0x7f878193c200): su_getmsgsize(): Host is down (64) N=-1
tport.c:2159 tport_shutdown0() tport_shutdown0(0x7f878193c200, 2)
tport.c:2092 tport_close() tport_close(0x7f878193c200): wss/192.168.0.100:56317/sips
tport.c:2265 tport_set_secondary_timer() tport(0x7f878193c200): set timer at 0 ms because zap
tport_type_ws.c:531 tport_ws_deinit_secondary() 0x7f878193c200 destroy wss transport 0x7f878193c3f0.