Monday, March 23, 2015

Now Webrtc SIP Client works on IE and Safari | Temasys Plugin Integration with JSSIP

Temasys Plugin Integration with JSSIP


Plugin Required to Install On Client system:- Temasys Webrtc Plugin v0.8.826


Update Exist WEBRTC Code to Use this Plugin:-

1) Need to attach adapter.js provided by Temasys.

2) Need to add code on start of the script to get media using Temasys Plugin:-.

var isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
// Opera 8.0+ (UA detection to detect Blink/v8-powered Opera)
var isFirefox = typeof InstallTrigger !== 'undefined'; // Firefox 1.0+
var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
// At least Safari 3+: "[object HTMLElementConstructor]"
var isChrome = !!window.chrome && !isOpera; // Chrome 1+
var isIE = /*@cc_on!@*/false || !!document.documentMode; // At least IE6

if(isSafari || isIE)
{
AdapterJS.onwebrtcready = function(isUsingPlugin) {
// The WebRTC API is ready.
//isUsingPlugin: true is the WebRTC plugin is being used, false otherwise
getUserMedia(constraints, successCb, failCb);
};
}


3) Need to update gui.js script:-

case "trying":
call.removeClass();
call.addClass("call trying");
status_text.text(description || "trying...");

// unhide HTML Video Elements
//$('#remoteView').attr('hidden', false);
//$('#selfView').attr('hidden', false);

// Set background image
//$('#remoteView').attr('poster', "images/logo.png");

// Hide DTMF box.
dtmf_box.hide();
break;

---------------------------------------------------------------------------------------------------------

call.on('started',function(e){
//Attach the streams to the views if it exists.
if ( call.getLocalStreams().length > 0) {
if(isSafari || isIE)
{
attachMediaStream(selfView, call.getLocalStreams()[0]);
}
else
{
selfView.src = window.URL.createObjectURL(call.getLocalStreams()[0]);
}
//selfView.src = window.URL.createObjectURL(call.getLocalStreams()[0]);
selfView.volume = 0;
}

if ( call.getRemoteStreams().length > 0) {
if(isSafari || isIE)
{
attachMediaStream(remoteView, call.getRemoteStreams()[0]);
}
else
{
remoteView.src = window.URL.createObjectURL(call.getRemoteStreams()[0]);
}
//remoteView.src = window.URL.createObjectURL(call.getRemoteStreams()[0]);
}

GUI.setCallSessionStatus(session, 'answered');
});



Plugin Guide Link:- https://temasys.atlassian.net/wiki/display/TWPP/WebRTC+Plugins