Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'RTCPeerConnection' of undefined #4

Closed
raghavchalapathy opened this issue Jan 16, 2014 · 6 comments
Closed

Comments

@raghavchalapathy
Copy link

Hi,

After registration i am trying to make a call using the below script
coolPhone1.on('registered', function(e)
{
var registered = e.data.response;
console.log(" register request1 "+registered);
if (reg) {
coolPhone.call('sip:'+reciever+'@'+uriIP+':'+uriPort, options);
}
});

But I am getting an Type Error Below what could be the reason am I missing any initialilizations Kindly suggest


Entire Error Log;


/usr/lib/node_modules/jssip-for-node/src/RTCSession/RTCMediaHandler.js:128
this.peerConnection = new JsSIP.WebRTC.RTCPeerConnection({'iceServers': se
^
TypeError: Cannot read property 'RTCPeerConnection' of undefined
at Object.RTCMediaHandler.init (/usr/lib/node_modules/jssip-for-node/src/RTCSession/RTCMediaHandler.js:128:43)
at Object.RTCMediaHandler (/usr/lib/node_modules/jssip-for-node/src/RTCSession/RTCMediaHandler.js:22:8)
at Object.RTCSession.connect (/usr/lib/node_modules/jssip-for-node/src/RTCSession.js:544:26)
at Object.UA.call (/usr/lib/node_modules/jssip-for-node/src/UA.js:185:11)
at process.message (/usr/lib/node_modules/thor/mjolnir.js:107:12)
at process.EventEmitter.emit (events.js:117:20)
at handleMessage (child_process.js:318:10)
at Pipe.channel.onread (child_process.js:345:11)

with regards
Raghav

@shimaore
Copy link
Owner

You need to provide a WebRTC-compliant module that handles media, then register it using JsSIP.setWebRTC.
I assume in your case you might want to look at the nomedia-webrtc package.

@raghavchalapathy
Copy link
Author

I hit a GIthub 404 error when i visit this url any changes to the URL
https://github.com/shimaore/node-nomedia-webrtc

Is there a updated link for this could you please tell me

with regards
Raghav

@shimaore
Copy link
Owner

Sorry, I put it on npm but forgot to actually push it to github. It's there now.

@raghavchalapathy
Copy link
Author

Hi,

Could you please guide me if I am correct in performing the Initialization of JssIP.WebRTC variables


Change 1 : I have added the following lines to Jssip.jsas below


var JsSIP = (function() {
"use strict";

var JsSIP = {};
var pkg = require('../package.json');

JsSIP.Grammar = require('./Grammar/dist/Grammar.js')(JsSIP);

/Added By Raghav to support the Webrtc stack initialization/

JsSIP.WebRTC = require('./WebRTC.js')(JsSIP);
JsSIP.WebRTC.getUserMedia = require('./WebRTC.js')(JsSIP);
JsSIP.WebRTC.RTCPeerConnection = require('../../nomedia-webrtc/rtc-peer-connection/index.js')(JsSIP);
JsSIP.WebRTC.RTCSessionDescription = require('../../nomedia-webrtc/rtc-session-description/index.js')(JsSIP);

/End of Added By Raghav to support the Webrtc stack initialization/

return JsSIP;
}());


Change 2 : I have edited the file WebRTC.js as below


module.exports = function(JsSIP) {
var WebRTC;

WebRTC = {};

/_/ Add By Raghav
WebRTC.RTCPeerConnection = JsSIP.global.RTCPeerConnection;
WebRTC.getUserMedia = JsSIP.global.navigator.getUserMedia.bind(navigator);
/_End of Add by Raghav*/

// getUserMedia
if (JsSIP.global.navigator.webkitGetUserMedia) {
WebRTC.getUserMedia = JsSIP.global.navigator.webkitGetUserMedia.bind(navigator);
}
else if (JsSIP.global.navigator.mozGetUserMedia) {
WebRTC.getUserMedia = JsSIP.global.navigator.mozGetUserMedia.bind(navigator);
}
else if (JsSIP.global.navigator.getUserMedia) {
WebRTC.getUserMedia = JsSIP.global.navigator.getUserMedia.bind(navigator);
}


I Hope to eliminate the issue below
/usr/lib/node_modules/jssip-for-node/src/RTCSession/RTCMediaHandler.js:128
this.peerConnection = new JsSIP.WebRTC.RTCPeerConnection({'iceServers': se

But I think I missing something Could you please suggest

  1. How can eliminate this error above;
  2. Files to edit

I have installed nomedia-webrtc through npm globally

Many thanks for the help in advance

with regards
Raghav

@shimaore
Copy link
Owner

Please have a look at https://github.com/shimaore/node-jsSIPp for how I adapted your code.

@raghavchalapathy
Copy link
Author

Hi,

After the initialiazation i hit this problem below , may I know if I am missing something Please

shimaore/node-nomedia-webrtc#1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants