JsSIP
JsSIP copied to clipboard
Error on incoming call
Hi,
I'm trying to use Cyber Mega Phone 2k. It seems to jssip-3.0.13.js. The problem is on an incoming call. The receiving client gets an error
Uncaught TypeError: Cannot set property 'ontrack' of null
at UA.<anonymous> (cyber_mega_phone.js:135)
at UA.EventEmitter.emit (jssip-3.0.13.js:21730)
at UA.newRTCSession (jssip-3.0.13.js:19851)
at RTCSession.newRTCSession (jssip-3.0.13.js:16450)
at RTCSession.init_incoming (jssip-3.0.13.js:14009)
at UA.receiveRequest (jssip-3.0.13.js:19958)
at UA.onTransportData (jssip-3.0.13.js:20585)
at Transport.onData (jssip-3.0.13.js:19317)
at WebSocketInterface.onMessage (jssip-3.0.13.js:21415)
It seems like connection is null on this code
this._ua.on('newRTCSession', function (data) {
let rtc = data.session;
//Code omitted
rtc.connection.ontrack = function (event) {
console.log('ontrack: ' + event.track.kind + ' - ' + event.track.id +
' stream ' + event.streams[0].id);
if (event.track.kind == 'video') {
event.track.enabled = false;
}
for (let i = 0; i < event.streams.length; ++i) {
event.streams[i].local = false;
that._remotes.add(event.streams[i]);
}
//Code omitted
});
I need to mention that I'm running both clients on the same machine and register them on an asterisk box (also running on the same machine with Linux Subsystem). I'm not sure if this can be the problem, so need some guidance on what to look for.
Please use the mailing list for questions. This is not a bug in JsSIP as the documentation about session.connection attribute is clear:
https://jssip.net/documentation/3.3.x/api/session/#attribute_connection