|
@@ -18,7 +18,7 @@
|
|
|
DEBUG VERSION: 'SIPml-api.js'
|
|
|
RELEASE VERSION: 'release/SIPml-api.js'
|
|
|
-->
|
|
|
- <script src="SIPml-api.js?svn=179" type="text/javascript"> </script>
|
|
|
+ <script src="SIPml-api.js?svn=224" type="text/javascript"> </script>
|
|
|
|
|
|
<!-- Styles -->
|
|
|
<link href="./assets/css/bootstrap.css" rel="stylesheet" />
|
|
@@ -123,7 +123,7 @@
|
|
|
|
|
|
// to avoid caching
|
|
|
//if (window.location.href.indexOf("svn=") == -1) {
|
|
|
- // window.location.href += (window.location.href.indexOf("?") == -1 ? "?svn=13" : "&svn=13");
|
|
|
+ // window.location.href += (window.location.href.indexOf("?") == -1 ? "?svn=224" : "&svn=224");
|
|
|
//}
|
|
|
|
|
|
var sTransferNumber;
|
|
@@ -132,9 +132,10 @@
|
|
|
var videoRemote, videoLocal, audioRemote;
|
|
|
var bFullScreen = false;
|
|
|
var oNotifICall;
|
|
|
- var oReadyStateTimer;
|
|
|
var bDisableVideo = false;
|
|
|
var viewVideoLocal, viewVideoRemote; // <video> (webrtc) or <div> (webrtc4all)
|
|
|
+ var oConfigCall;
|
|
|
+ var oReadyStateTimer;
|
|
|
|
|
|
C =
|
|
|
{
|
|
@@ -142,6 +143,9 @@
|
|
|
};
|
|
|
|
|
|
window.onload = function () {
|
|
|
+ if(window.console) {
|
|
|
+ window.console.info("location=" + window.location);
|
|
|
+ }
|
|
|
videoLocal = document.getElementById("video_local");
|
|
|
videoRemote = document.getElementById("video_remote");
|
|
|
audioRemote = document.getElementById("audio_remote");
|
|
@@ -150,23 +154,66 @@
|
|
|
document.body.onkeyup = onKeyUp;
|
|
|
divCallCtrl.onmousemove = onDivCallCtrlMouseMove;
|
|
|
|
|
|
+ // set debug level
|
|
|
+ SIPml.setDebugLevel((window.localStorage && window.localStorage.getItem('org.doubango.expert.disable_debug') == "true") ? "error" : "info");
|
|
|
+
|
|
|
loadCredentials();
|
|
|
loadCallOptions();
|
|
|
|
|
|
+ // Initialize call button
|
|
|
+ uiBtnCallSetText("Call");
|
|
|
+
|
|
|
+ var getPVal = function (PName) {
|
|
|
+ var query = window.location.search.substring(1);
|
|
|
+ var vars = query.split('&');
|
|
|
+ for (var i = 0; i < vars.length; i++) {
|
|
|
+ var pair = vars[i].split('=');
|
|
|
+ if (decodeURIComponent(pair[0]) === PName) {
|
|
|
+ return decodeURIComponent(pair[1]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ var preInit = function() {
|
|
|
+ // set default webrtc type (before initialization)
|
|
|
+ var s_webrtc_type = getPVal("wt");
|
|
|
+ if (s_webrtc_type) {
|
|
|
+ if(window.console) {
|
|
|
+ window.console.info("s_webrtc_type=" + s_webrtc_type);
|
|
|
+ }
|
|
|
+ SIPml.setWebRtcType(s_webrtc_type);
|
|
|
+ }
|
|
|
+
|
|
|
+ // initialize SIPML5
|
|
|
+ SIPml.init(postInit);
|
|
|
+ }
|
|
|
+
|
|
|
oReadyStateTimer = setInterval(function () {
|
|
|
if (document.readyState === "complete") {
|
|
|
clearInterval(oReadyStateTimer);
|
|
|
// initialize SIPML5
|
|
|
- SIPml.init(postInit);
|
|
|
+ preInit();
|
|
|
}
|
|
|
},
|
|
|
500);
|
|
|
+
|
|
|
+ /*if (document.readyState === "complete") {
|
|
|
+ preInit();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ document.onreadystatechange = function () {
|
|
|
+ if (document.readyState === "complete") {
|
|
|
+ preInit();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }*/
|
|
|
};
|
|
|
|
|
|
function postInit() {
|
|
|
// check webrtc4all version
|
|
|
if (SIPml.isWebRtc4AllSupported() && SIPml.isWebRtc4AllPluginOutdated()) {
|
|
|
- if (confirm("Your WebRtc4all extension is outdated. A new version(" +SIPml.getWebRtc4AllVersion()+") with critical bug fix is available. Do you want to install it?\nIMPORTANT: You must restart your browser after the installation.")) {
|
|
|
+ if (confirm("Your WebRtc4all extension is outdated ("+SIPml.getWebRtc4AllVersion()+"). A new version with critical bug fix is available. Do you want to install it?\nIMPORTANT: You must restart your browser after the installation.")) {
|
|
|
window.location = 'http://code.google.com/p/webrtc4all/downloads/list';
|
|
|
return;
|
|
|
}
|
|
@@ -265,9 +312,22 @@
|
|
|
window.location = 'https://www.google.com/intl/en/chrome/browser/';
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
btnRegister.disabled = false;
|
|
|
document.body.style.cursor = 'default';
|
|
|
+ oConfigCall = {
|
|
|
+ audio_remote: audioRemote,
|
|
|
+ video_local: viewVideoLocal,
|
|
|
+ video_remote: viewVideoRemote,
|
|
|
+ bandwidth: { audio:undefined, video:undefined },
|
|
|
+ video_size: { minWidth:undefined, minHeight:undefined, maxWidth:undefined, maxHeight:undefined },
|
|
|
+ events_listener: { events: '*', listener: onSipEventSession },
|
|
|
+ sip_caps: [
|
|
|
+ { name: '+g.oma.sip-im' },
|
|
|
+ { name: '+sip.ice' },
|
|
|
+ { name: 'language', value: '\"en,fr\"' }
|
|
|
+ ]
|
|
|
+ };
|
|
|
}
|
|
|
|
|
|
|
|
@@ -301,9 +361,9 @@
|
|
|
else {
|
|
|
/*txtDisplayName.value = "005";
|
|
|
txtPrivateIdentity.value = "005";
|
|
|
- txtPublicIdentity.value = "sip:[email protected].42";
|
|
|
+ txtPublicIdentity.value = "sip:[email protected]8";
|
|
|
txtPassword.value = "005";
|
|
|
- txtRealm.value = "192.168.0.42";
|
|
|
+ txtRealm.value = "192.168.0.28";
|
|
|
txtPhoneNumber.value = "005";*/
|
|
|
}
|
|
|
};
|
|
@@ -343,6 +403,9 @@
|
|
|
// save credentials
|
|
|
saveCredentials();
|
|
|
|
|
|
+ // update debug level to be sure new values will be used if the user haven't updated the page
|
|
|
+ SIPml.setDebugLevel((window.localStorage && window.localStorage.getItem('org.doubango.expert.disable_debug') == "true") ? "error" : "info");
|
|
|
+
|
|
|
// create SIP stack
|
|
|
oSipStack = new SIPml.Stack({
|
|
|
realm: txtRealm.value,
|
|
@@ -355,8 +418,12 @@
|
|
|
ice_servers: (window.localStorage ? window.localStorage.getItem('org.doubango.expert.ice_servers') : null),
|
|
|
enable_rtcweb_breaker: (window.localStorage ? window.localStorage.getItem('org.doubango.expert.enable_rtcweb_breaker') == "true" : false),
|
|
|
events_listener: { events: '*', listener: onSipEventStack },
|
|
|
+ enable_early_ims: (window.localStorage ? window.localStorage.getItem('org.doubango.expert.disable_early_ims') != "true" : true), // Must be true unless you're using a real IMS network
|
|
|
+ enable_media_stream_cache: (window.localStorage ? window.localStorage.getItem('org.doubango.expert.enable_media_caching') == "true" : false),
|
|
|
+ bandwidth: (window.localStorage ? tsk_string_to_object(window.localStorage.getItem('org.doubango.expert.bandwidth')) : null), // could be redefined a session-level
|
|
|
+ video_size: (window.localStorage ? tsk_string_to_object(window.localStorage.getItem('org.doubango.expert.video_size')) : null), // could be redefined a session-level
|
|
|
sip_headers: [
|
|
|
- { name: 'User-Agent', value: 'IM-client/OMA1.0 sipML5-v1.2013.05.24' },
|
|
|
+ { name: 'User-Agent', value: 'IM-client/OMA1.0 sipML5-v1.2014.04.18' },
|
|
|
{ name: 'Organization', value: 'Doubango Telecom' }
|
|
|
]
|
|
|
}
|
|
@@ -380,27 +447,31 @@
|
|
|
}
|
|
|
|
|
|
// makes a call (SIP INVITE)
|
|
|
- function sipCall() {
|
|
|
- // call configuration
|
|
|
- var oConf = {
|
|
|
- audio_remote: audioRemote,
|
|
|
- video_local: viewVideoLocal,
|
|
|
- video_remote: viewVideoRemote,
|
|
|
- events_listener: { events: '*', listener: onSipEventSession },
|
|
|
- sip_caps: [
|
|
|
- { name: '+g.oma.sip-im' },
|
|
|
- { name: '+sip.ice' },
|
|
|
- { name: 'language', value: '\"en,fr\"' }
|
|
|
- ]
|
|
|
- };
|
|
|
+ function sipCall(s_type) {
|
|
|
if (oSipStack && !oSipSessionCall && !tsk_string_is_null_or_empty(txtPhoneNumber.value)) {
|
|
|
+ if(s_type == 'call-screenshare') {
|
|
|
+ if(!SIPml.isScreenShareSupported()) {
|
|
|
+ alert('Screen sharing not supported. Are you using chrome 26+?');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!location.protocol.match('https')){
|
|
|
+ if (confirm("Screen sharing requires https://. Do you want to be redirected?")) {
|
|
|
+ sipUnRegister();
|
|
|
+ window.location = 'https://ns313841.ovh.net/call.htm';
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
btnCall.disabled = true;
|
|
|
btnHangUp.disabled = false;
|
|
|
|
|
|
- // check whether video is disabled or not
|
|
|
- bDisableVideo = (window.localStorage && window.localStorage.getItem('org.doubango.expert.disable_video') == "true");
|
|
|
+ if(window.localStorage) {
|
|
|
+ oConfigCall.bandwidth = tsk_string_to_object(window.localStorage.getItem('org.doubango.expert.bandwidth')); // already defined at stack-level but redifined to use latest values
|
|
|
+ oConfigCall.video_size = tsk_string_to_object(window.localStorage.getItem('org.doubango.expert.video_size')); // already defined at stack-level but redifined to use latest values
|
|
|
+ }
|
|
|
+
|
|
|
// create call session
|
|
|
- oSipSessionCall = oSipStack.newSession(bDisableVideo ? 'call-audio' : 'call-audiovideo', oConf);
|
|
|
+ oSipSessionCall = oSipStack.newSession(s_type, oConfigCall);
|
|
|
// make call
|
|
|
if (oSipSessionCall.call(txtPhoneNumber.value) != 0) {
|
|
|
oSipSessionCall = null;
|
|
@@ -413,7 +484,7 @@
|
|
|
}
|
|
|
else if (oSipSessionCall) {
|
|
|
txtCallStatus.innerHTML = '<i>Connecting...</i>';
|
|
|
- oSipSessionCall.accept(oConf);
|
|
|
+ oSipSessionCall.accept(oConfigCall);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -572,31 +643,29 @@
|
|
|
}
|
|
|
|
|
|
function uiVideoDisplayEvent(b_local, b_added) {
|
|
|
- //if (!bDisableVideo) {
|
|
|
- var o_elt_video = b_local ? videoLocal : videoRemote;
|
|
|
+ var o_elt_video = b_local ? videoLocal : videoRemote;
|
|
|
|
|
|
- if (b_added) {
|
|
|
- if (SIPml.isWebRtc4AllSupported()) {
|
|
|
- if (b_local){ if(window.__o_display_local) window.__o_display_local.style.visibility = "visible"; }
|
|
|
- else { if(window.__o_display_remote) window.__o_display_remote.style.visibility = "visible"; }
|
|
|
+ if (b_added) {
|
|
|
+ if (SIPml.isWebRtc4AllSupported()) {
|
|
|
+ if (b_local){ if(window.__o_display_local) window.__o_display_local.style.visibility = "visible"; }
|
|
|
+ else { if(window.__o_display_remote) window.__o_display_remote.style.visibility = "visible"; }
|
|
|
|
|
|
- }
|
|
|
- else {
|
|
|
- o_elt_video.style.opacity = 1;
|
|
|
- }
|
|
|
- uiVideoDisplayShowHide(true);
|
|
|
}
|
|
|
else {
|
|
|
- if (SIPml.isWebRtc4AllSupported()) {
|
|
|
- if (b_local){ if(window.__o_display_local) window.__o_display_local.style.visibility = "hidden"; }
|
|
|
- else { if(window.__o_display_remote) window.__o_display_remote.style.visibility = "hidden"; }
|
|
|
- }
|
|
|
- else{
|
|
|
- o_elt_video.style.opacity = 0;
|
|
|
- }
|
|
|
- fullScreen(false);
|
|
|
+ o_elt_video.style.opacity = 1;
|
|
|
+ }
|
|
|
+ uiVideoDisplayShowHide(true);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if (SIPml.isWebRtc4AllSupported()) {
|
|
|
+ if (b_local){ if(window.__o_display_local) window.__o_display_local.style.visibility = "hidden"; }
|
|
|
+ else { if(window.__o_display_remote) window.__o_display_remote.style.visibility = "hidden"; }
|
|
|
}
|
|
|
- //}
|
|
|
+ else{
|
|
|
+ o_elt_video.style.opacity = 0;
|
|
|
+ }
|
|
|
+ fullScreen(false);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
function uiVideoDisplayShowHide(b_show) {
|
|
@@ -611,8 +680,48 @@
|
|
|
btnFullScreen.disabled = !b_show;
|
|
|
}
|
|
|
|
|
|
+ function uiDisableCallOptions() {
|
|
|
+ if(window.localStorage) {
|
|
|
+ window.localStorage.setItem('org.doubango.expert.disable_callbtn_options', 'true');
|
|
|
+ uiBtnCallSetText('Call');
|
|
|
+ alert('Use expert view to enable the options again (/!\\requires re-loading the page)');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function uiBtnCallSetText(s_text) {
|
|
|
+ switch(s_text) {
|
|
|
+ case "Call":
|
|
|
+ {
|
|
|
+ var bDisableCallBtnOptions = (window.localStorage && window.localStorage.getItem('org.doubango.expert.disable_callbtn_options') == "true");
|
|
|
+ btnCall.value = btnCall.innerHTML = bDisableCallBtnOptions ? 'Call' : 'Call <span id="spanCaret" class="caret">';
|
|
|
+ btnCall.setAttribute("class", bDisableCallBtnOptions ? "btn btn-primary" : "btn btn-primary dropdown-toggle");
|
|
|
+ btnCall.onclick = bDisableCallBtnOptions ? function(){ sipCall(bDisableVideo ? 'call-audio' : 'call-audiovideo'); } : null;
|
|
|
+ ulCallOptions.style.visibility = bDisableCallBtnOptions ? "hidden" : "visible";
|
|
|
+ if(!bDisableCallBtnOptions && ulCallOptions.parentNode != divBtnCallGroup){
|
|
|
+ divBtnCallGroup.appendChild(ulCallOptions);
|
|
|
+ }
|
|
|
+ else if(bDisableCallBtnOptions && ulCallOptions.parentNode == divBtnCallGroup) {
|
|
|
+ document.body.appendChild(ulCallOptions);
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ {
|
|
|
+ btnCall.value = btnCall.innerHTML = s_text;
|
|
|
+ btnCall.setAttribute("class", "btn btn-primary");
|
|
|
+ btnCall.onclick = function(){ sipCall(bDisableVideo ? 'call-audio' : 'call-audiovideo'); };
|
|
|
+ ulCallOptions.style.visibility = "hidden";
|
|
|
+ if(ulCallOptions.parentNode == divBtnCallGroup){
|
|
|
+ document.body.appendChild(ulCallOptions);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
function uiCallTerminated(s_description){
|
|
|
- btnCall.value = 'Call';
|
|
|
+ uiBtnCallSetText("Call");
|
|
|
btnHangUp.value = 'HangUp';
|
|
|
btnHoldResume.value = 'hold';
|
|
|
btnCall.disabled = false;
|
|
@@ -692,8 +801,10 @@
|
|
|
}
|
|
|
else {
|
|
|
oSipSessionCall = e.newSession;
|
|
|
+ // start listening for events
|
|
|
+ oSipSessionCall.setConfiguration(oConfigCall);
|
|
|
|
|
|
- btnCall.value = 'Answer';
|
|
|
+ uiBtnCallSetText('Answer');
|
|
|
btnHangUp.value = 'Reject';
|
|
|
btnCall.disabled = false;
|
|
|
btnHangUp.disabled = false;
|
|
@@ -986,7 +1097,7 @@
|
|
|
<img alt="sipML5" class="brand" src="./images/sipml-34x39.png" />
|
|
|
<div class="nav-collapse">
|
|
|
<ul class="nav">
|
|
|
- <li class="active"><a href="index.html?svn=179">Home</a></li>
|
|
|
+ <li class="active"><a href="index.html?svn=224">Home</a></li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
<!--/.nav-collapse -->
|
|
@@ -1050,9 +1161,9 @@
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td colspan="2" align="right">
|
|
|
- <input type="button" class="btn-success" id="btnRegister" value="LogIn" disabled onclick='sipRegister();' />
|
|
|
+ <input type="button" class="btn btn-success" id="btnRegister" value="LogIn" disabled onclick='sipRegister();' />
|
|
|
|
|
|
- <input type="button" class="btn-danger" id="btnUnRegister" value="LogOut" disabled onclick='sipUnRegister();' />
|
|
|
+ <input type="button" class="btn btn-danger" id="btnUnRegister" value="LogOut" disabled onclick='sipUnRegister();' />
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
@@ -1087,8 +1198,14 @@
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td colspan="1" align="right">
|
|
|
- <input type="button" class="btn-primary" style="" id="btnCall" value="Call" onclick='sipCall();' disabled />
|
|
|
- <input type="button" class="btn-primary" style="" id="btnHangUp" value="HangUp" onclick='sipHangUp();' disabled />
|
|
|
+ <div class="btn-toolbar" style="margin: 0; vertical-align:middle">
|
|
|
+ <div id="divBtnCallGroup" class="btn-group">
|
|
|
+ <button id="btnCall" disabled class="btn btn-primary" data-toggle="dropdown">Call</button>
|
|
|
+ </div>
|
|
|
+ <div class="btn-group">
|
|
|
+ <input type="button" id="btnHangUp" style="margin: 0; vertical-align:middle; height: 100%;" class="btn btn-primary" value="HangUp" onclick='sipHangUp();' disabled />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
@@ -1131,7 +1248,7 @@
|
|
|
Will open confirmation dialogs if not already done
|
|
|
-->
|
|
|
<object id="fakeVideoDisplay" classid="clsid:5C2C407B-09D9-449B-BB83-C39B7802A684" style="visibility:hidden;"> </object>
|
|
|
- <object id="fakeLooper" classid="clsid:7082C446-54A8-4280-A18D-54143846211A" style="visibility:hidden;"> </object>
|
|
|
+ <object id="fakeLooper" classid="clsid:7082C446-54A8-4280-A18D-54143846211A" style="visibility:visible; width:0px; height:0px"> </object>
|
|
|
<object id="fakeSessionDescription" classid="clsid:DBA9F8E2-F9FB-47CF-8797-986A69A1CA9C" style="visibility:hidden;"> </object>
|
|
|
<object id="fakeNetTransport" classid="clsid:5A7D84EC-382C-4844-AB3A-9825DBE30DAE" style="visibility:hidden;"> </object>
|
|
|
<object id="fakePeerConnection" classid="clsid:56D10AD3-8F52-4AA4-854B-41F4D6F9CEA3" style="visibility:hidden;"> </object>
|
|
@@ -1155,6 +1272,14 @@
|
|
|
<tr><td colspan=3><input type="button" style="width: 100%" class="btn btn-medium btn-danger" value="close" onclick="closeKeyPad();" /></td></tr>
|
|
|
</table>
|
|
|
</div>
|
|
|
+ <!-- Call button options -->
|
|
|
+ <ul id="ulCallOptions" class="dropdown-menu" style="visibility:hidden">
|
|
|
+ <li><a href="#" onclick='sipCall("call-audio");'>Audio</a></li>
|
|
|
+ <li><a href="#" onclick='sipCall("call-audiovideo");'>Video</a></li>
|
|
|
+ <li id='liScreenShare' ><a href="#" onclick='sipCall("call-screenshare");'>Screen Share</a></li>
|
|
|
+ <li class="divider"></li>
|
|
|
+ <li><a href="#" onclick='uiDisableCallOptions();'><b>Disable these options</b></a></li>
|
|
|
+ </ul>
|
|
|
|
|
|
<!-- Le javascript
|
|
|
================================================== -->
|