1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,574 @@ |
1 |
+<?php |
|
2 |
+/** |
|
3 |
+ * Copyright (C) 2021 Double Bastion LLC |
|
4 |
+ * |
|
5 |
+ * This file is part of Roundpin, which is licensed under the |
|
6 |
+ * GNU Affero General Public License Version 3.0. The license terms |
|
7 |
+ * are detailed in the "LICENSE.txt" file located in the root directory. |
|
8 |
+ * |
|
9 |
+ * This is a modified version of the original file "index.html", |
|
10 |
+ * first modified in 2020. The copyright notice for the original |
|
11 |
+ * content follows: |
|
12 |
+ |
|
13 |
+/* |
|
14 |
+ Cyber Mega Phone 2K |
|
15 |
+ Copyright (C) 2017 Digium, Inc. |
|
16 |
+ |
|
17 |
+ This program is free software, distributed under the terms of the |
|
18 |
+ MIT License. See the LICENSE file at the top of the source tree. |
|
19 |
+*/ |
|
20 |
+ |
|
21 |
+$retrievedstringinit = $_GET['param']; |
|
22 |
+$retrievedstring = hex2bin($retrievedstringinit); |
|
23 |
+ |
|
24 |
+if ($retrievedstring != '') { |
|
25 |
+ |
|
26 |
+ session_start(); |
|
27 |
+ |
|
28 |
+ define('ACCESSCONST', TRUE); |
|
29 |
+ |
|
30 |
+ require('../db-connect.php'); |
|
31 |
+ |
|
32 |
+ // Extract the secret from the configuration file |
|
33 |
+ $configfilestring = file_get_contents('../roundpin-config.php'); |
|
34 |
+ |
|
35 |
+ if (preg_match_all('[include|include_once|require|require_once]', $configfilestring) != 0) { |
|
36 |
+ |
|
37 |
+ if (strpos($configfilestring, "'") !== false) { |
|
38 |
+ $continit = explode("'", $configfilestring); |
|
39 |
+ $configfilepath = $continit[1]; |
|
40 |
+ } elseif (strpos($configfilestring, "\"") !== false) { |
|
41 |
+ $continit = explode("\"", $configfilestring); |
|
42 |
+ $configfilepath = $continit[1]; |
|
43 |
+ } |
|
44 |
+ |
|
45 |
+ $configfilelines = file($configfilepath); |
|
46 |
+ |
|
47 |
+ if (count($configfilelines) != 0) { |
|
48 |
+ |
|
49 |
+ foreach ($configfilelines as $keyfile => $valuefile) { |
|
50 |
+ |
|
51 |
+ if (strpos($valuefile, "\$secret") !== false) { |
|
52 |
+ $secret_init = explode("'", $valuefile); |
|
53 |
+ $secretfin = $secret_init[1]; |
|
54 |
+ } |
|
55 |
+ } |
|
56 |
+ } |
|
57 |
+ |
|
58 |
+ } else { |
|
59 |
+ |
|
60 |
+ $configfilelines = file('../roundpin-config.php'); |
|
61 |
+ |
|
62 |
+ if (count($configfilelines) != 0) { |
|
63 |
+ foreach ($configfilelines as $keyfile => $valuefile) { |
|
64 |
+ if (strpos($valuefile, "\$secret") !== false) { |
|
65 |
+ $secretinit = explode("'", $valuefile); |
|
66 |
+ $secretfin = $secretinit[1]; |
|
67 |
+ } |
|
68 |
+ } |
|
69 |
+ } |
|
70 |
+ } |
|
71 |
+ |
|
72 |
+ // Decrypt the extension used for external access to conference and the username of the user who created the link |
|
73 |
+ $componentuserext = explode(':', $retrievedstring); |
|
74 |
+ |
|
75 |
+ $encpwdinusext = $componentuserext[0]; |
|
76 |
+ $ivkey = $componentuserext[1]; |
|
77 |
+ |
|
78 |
+ $userExtDec = openssl_decrypt($encpwdinusext, 'AES-256-CBC', $secretfin, false, $ivkey); |
|
79 |
+ |
|
80 |
+ $userExtDecComp = explode("|", $userExtDec); |
|
81 |
+ $userName = $userExtDecComp[0]; |
|
82 |
+ $extForExtern = $userExtDecComp[1]; |
|
83 |
+ |
|
84 |
+ $retrievedSipUsername = $extForExtern; |
|
85 |
+ |
|
86 |
+ // Get the relevant information for the superadmin who created the external access link |
|
87 |
+ $query1 = $mysqli->query("SELECT id, userrole, username, wss_server, stun_server, video_conf_extension, enabled FROM app_users WHERE userrole = 'superadmin' AND BINARY username = '$userName' AND enabled = 1"); |
|
88 |
+ $queryres = $query1->fetch_array(); |
|
89 |
+ $userID = $queryres[0]; |
|
90 |
+ $retrievedWssServer = $queryres[3]; |
|
91 |
+ $retrievedStunServer = $queryres[4]; |
|
92 |
+ $retrievedVideoConfExt = $queryres[5]; |
|
93 |
+ |
|
94 |
+ // Get the SIP password from the 'external_users' table |
|
95 |
+ $query2 = $mysqli->query("SELECT id, userid, exten_for_external, exten_for_ext_pass FROM external_users WHERE userid = '$userID' AND exten_for_external = '$extForExtern'"); |
|
96 |
+ $extqueryres = $query2->fetch_array(); |
|
97 |
+ $extensionPass = $extqueryres[3]; |
|
98 |
+ |
|
99 |
+ // Decrypt the SIP password |
|
100 |
+ $componentpkey = explode(':', $extensionPass); |
|
101 |
+ $psswdaddedkey = file_get_contents('../restr/'.$userName.'/externalext/'.$extForExtern); |
|
102 |
+ |
|
103 |
+ $encpwdinsip = $componentpkey[0]; |
|
104 |
+ $ivkeysip = $componentpkey[1]; |
|
105 |
+ |
|
106 |
+ $retrievedSipPassword = openssl_decrypt($encpwdinsip, 'AES-256-CBC', $psswdaddedkey, false, $ivkeysip); |
|
107 |
+ |
|
108 |
+?> |
|
109 |
+ |
|
110 |
+<!DOCTYPE html> |
|
111 |
+ |
|
112 |
+<html> |
|
113 |
+<head> |
|
114 |
+ <meta charset="utf-8" /> |
|
115 |
+ <title>Roundpin Video Conference</title> |
|
116 |
+ <link rel="stylesheet" type="text/css" href="css/conference-phone.min.css"> |
|
117 |
+ |
|
118 |
+ <link rel="stylesheet" type="text/css" href="../fonts/font-awesome-4.7.0/css/font-awesome.min.css"/> |
|
119 |
+ |
|
120 |
+ <link rel="stylesheet" type="text/css" href="../css/jeegoo-1.0.0.min.css"/> |
|
121 |
+ |
|
122 |
+ <link rel="shortcut icon" type="image/svg" href="../images/favicon.svg" /> |
|
123 |
+ <script type="text/javascript" src="js/sdp-interop-sl-1.4.0.min.js"></script> |
|
124 |
+ <script type="text/javascript" src="js/jssip-3.7.0.min.js"></script> |
|
125 |
+ <script type="text/javascript" src="js/utils.min.js"></script> |
|
126 |
+ <script type="text/javascript" src="../js/jquery-3.3.1.min.js"></script> |
|
127 |
+ |
|
128 |
+ <script type="text/javascript" src="js/conference-phone.min.js"></script> |
|
129 |
+ |
|
130 |
+ <script type="text/javascript" src="../js/jquery.jeegoopopup.1.0.0.min.js"></script> |
|
131 |
+ |
|
132 |
+<script type="text/javascript"> |
|
133 |
+ |
|
134 |
+let phone; |
|
135 |
+let numPressed = null; |
|
136 |
+ |
|
137 |
+let sip_username = "<?php print_r($retrievedSipUsername); ?>"; |
|
138 |
+let sip_password = "<?php print_r($retrievedSipPassword); ?>"; |
|
139 |
+let wss_server = "<?php print_r($retrievedWssServer); ?>"; |
|
140 |
+let stun_server = "<?php print_r($retrievedStunServer); ?>"; |
|
141 |
+let videoConfExtension = "<?php print_r($retrievedVideoConfExt); ?>"; |
|
142 |
+ |
|
143 |
+window.onload = function() { |
|
144 |
+ |
|
145 |
+ var mvcount = 0; |
|
146 |
+ document.getElementById("connect").value = "Connect"; |
|
147 |
+ document.getElementById("connect").disabled = false; |
|
148 |
+ document.getElementById("call").value = "Call"; |
|
149 |
+ document.getElementById("call").disabled = true; |
|
150 |
+ document.getElementById("call").style.display = 'none'; |
|
151 |
+ document.getElementById("fullscreen").style.display = 'none'; |
|
152 |
+ |
|
153 |
+ function findMediaView(parent, stream) { |
|
154 |
+ let nodes = parent.childNodes; |
|
155 |
+ |
|
156 |
+ for (let i = 0; i < nodes.length; ++i) { |
|
157 |
+ if (nodes[i].id == stream.id) { |
|
158 |
+ return nodes[i]; |
|
159 |
+ } |
|
160 |
+ } |
|
161 |
+ return null; |
|
162 |
+ } |
|
163 |
+ |
|
164 |
+ function dtmfMenuShow() { |
|
165 |
+ |
|
166 |
+ $.jeegoopopup.close(); |
|
167 |
+ |
|
168 |
+ var leftPos = event.pageX - 90; |
|
169 |
+ var topPos = event.pageY + 28; |
|
170 |
+ |
|
171 |
+ if ($(window).width() < 680) { |
|
172 |
+ leftPos = event.pageX - 50; |
|
173 |
+ } |
|
174 |
+ |
|
175 |
+ var html = "<div id=\"sendPinDialPad\">"; |
|
176 |
+ html += "<div><input type=\"text\" id=\"dialText\" class=\"dialTextInput\"></div>"; |
|
177 |
+ html += "<table cellspacing=10 cellpadding=0 style=\"margin-left:auto; margin-right: auto\">"; |
|
178 |
+ html += "<tr><td><button class=dtmfButtons onclick=\"phone.dtmfSend('1');new Audio('../sounds/dtmf.mp3').play();\"><div>1</div><span> </span></button></td>"; |
|
179 |
+ html += "<td><button class=dtmfButtons onclick=\"phone.dtmfSend('2');new Audio('../sounds/dtmf.mp3').play();\"><div>2</div><span>ABC</span></button></td>"; |
|
180 |
+ html += "<td><button class=dtmfButtons onclick=\"phone.dtmfSend('3');new Audio('../sounds/dtmf.mp3').play();\"><div>3</div><span>DEF</span></button></td></tr>"; |
|
181 |
+ html += "<tr><td><button class=dtmfButtons onclick=\"phone.dtmfSend('4');new Audio('../sounds/dtmf.mp3').play();\"><div>4</div><span>GHI</span></button></td>"; |
|
182 |
+ html += "<td><button class=dtmfButtons onclick=\"phone.dtmfSend('5');new Audio('../sounds/dtmf.mp3').play();\"><div>5</div><span>JKL</span></button></td>"; |
|
183 |
+ html += "<td><button class=dtmfButtons onclick=\"phone.dtmfSend('6');new Audio('../sounds/dtmf.mp3').play();\"><div>6</div><span>MNO</span></button></td></tr>"; |
|
184 |
+ html += "<tr><td><button class=dtmfButtons onclick=\"phone.dtmfSend('7');new Audio('../sounds/dtmf.mp3').play();\"><div>7</div><span>PQRS</span></button></td>"; |
|
185 |
+ html += "<td><button class=dtmfButtons onclick=\"phone.dtmfSend('8');new Audio('../sounds/dtmf.mp3').play();\"><div>8</div><span>TUV</span></button></td>"; |
|
186 |
+ html += "<td><button class=dtmfButtons onclick=\"phone.dtmfSend('9');new Audio('../sounds/dtmf.mp3').play();\"><div>9</div><span>WXYZ</span></button></td></tr>"; |
|
187 |
+ html += "<tr><td><button class=dtmfButtons onclick=\"phone.dtmfSend('*');new Audio('../sounds/dtmf.mp3').play();\">*</button></td>"; |
|
188 |
+ html += "<td><button class=dtmfButtons onclick=\"phone.dtmfSend('0');new Audio('../sounds/dtmf.mp3').play();\">0</button></td>"; |
|
189 |
+ html += "<td><button class=dtmfButtons onclick=\"phone.dtmfSend('#');new Audio('../sounds/dtmf.mp3').play();\">#</button></td></tr>"; |
|
190 |
+ html += "</table>"; |
|
191 |
+ html += "</div>"; |
|
192 |
+ |
|
193 |
+ $.jeegoopopup.open({ |
|
194 |
+ html: html, |
|
195 |
+ width: "auto", |
|
196 |
+ height: "auto", |
|
197 |
+ left: leftPos, |
|
198 |
+ top: topPos, |
|
199 |
+ scrolling: 'no', |
|
200 |
+ skinClass: 'jg_popup_basic', |
|
201 |
+ overlay: true, |
|
202 |
+ opacity: 0, |
|
203 |
+ draggable: true, |
|
204 |
+ resizable: false, |
|
205 |
+ fadeIn: 0 |
|
206 |
+ }); |
|
207 |
+ |
|
208 |
+ $("#jg_popup_overlay").click(function() { $.jeegoopopup.close(); }); |
|
209 |
+ $(window).on('keydown', function(event) { if (event.key == "Escape") { $.jeegoopopup.close(); } }); |
|
210 |
+ } |
|
211 |
+ |
|
212 |
+ function createMediaControls(video) { |
|
213 |
+ |
|
214 |
+ let controls = document.createElement("div"); |
|
215 |
+ controls.className = "media-controls"; |
|
216 |
+ |
|
217 |
+ if (video.srcObject.local == true) { |
|
218 |
+ let sendPin = document.createElement("button"); |
|
219 |
+ sendPin.className = "mediaControlBtn"; |
|
220 |
+ sendPin.id = "sendPinBtn"; |
|
221 |
+ sendPin.innerHTML = '<i class="fa fa-keyboard-o" aria-hidden="true" title="Show Keypad"></i>'; |
|
222 |
+ sendPin.onclick = function() { dtmfMenuShow(); } |
|
223 |
+ |
|
224 |
+ controls.appendChild(sendPin); |
|
225 |
+ } |
|
226 |
+ |
|
227 |
+ let audioTracks = video.srcObject.getAudioTracks(); |
|
228 |
+ if (audioTracks.length > 0) { |
|
229 |
+ let muteAudio = document.createElement("button"); |
|
230 |
+ muteAudio.className = "mediaControlBtn"; |
|
231 |
+ muteAudio.innerHTML = '<i class="fa fa-microphone-slash" aria-hidden="true" title="Mute Audio"></i>'; |
|
232 |
+ muteAudio.setAttribute("state", "Unmute"); |
|
233 |
+ muteAudio.onclick = function() { |
|
234 |
+ let state = this.getAttribute("state"); |
|
235 |
+ if (state == "Mute") { |
|
236 |
+ this.setAttribute("state", "Unmute"); |
|
237 |
+ this.innerHTML = '<i class="fa fa-microphone-slash" aria-hidden="true" title="Mute Audio"></i>'; |
|
238 |
+ } else if (state == "Unmute") { |
|
239 |
+ this.setAttribute("state", "Mute"); |
|
240 |
+ this.innerHTML = '<i class="fa fa-microphone" aria-hidden="true" title="Unmute Audio"></i>'; |
|
241 |
+ } |
|
242 |
+ |
|
243 |
+ mute(video.srcObject, {audio: this.getAttribute("state") == "Mute"}); |
|
244 |
+ }; |
|
245 |
+ controls.appendChild(muteAudio); |
|
246 |
+ } |
|
247 |
+ |
|
248 |
+ let videoTracks = video.srcObject.getVideoTracks(); |
|
249 |
+ if (videoTracks.length > 0) { |
|
250 |
+ let muteVideo = document.createElement("button"); |
|
251 |
+ muteVideo.className = "mediaControlBtn"; |
|
252 |
+ muteVideo.innerHTML = '<i class="fa fa-ban" aria-hidden="true" title="Mute Video"></i>'; |
|
253 |
+ muteVideo.setAttribute("state", "Unmute"); |
|
254 |
+ muteVideo.onclick = function() { |
|
255 |
+ let state = this.getAttribute("state"); |
|
256 |
+ if (state == "Mute") { |
|
257 |
+ this.setAttribute("state", "Unmute"); |
|
258 |
+ this.innerHTML = '<i class="fa fa-ban" aria-hidden="true" title="Mute Video"></i>'; |
|
259 |
+ } else if (state == "Unmute") { |
|
260 |
+ this.setAttribute("state", "Mute"); |
|
261 |
+ this.innerHTML = '<i class="fa fa-video-camera" aria-hidden="true" title="Unmute Video"></i>'; |
|
262 |
+ } |
|
263 |
+ |
|
264 |
+ mute(video.srcObject, {video: this.getAttribute("state") == "Mute"}); |
|
265 |
+ }; |
|
266 |
+ controls.appendChild(muteVideo); |
|
267 |
+ |
|
268 |
+ if (video.srcObject.local == true) { |
|
269 |
+ let ScreenShare = document.createElement("button"); |
|
270 |
+ ScreenShare.className = "mediaControlBtn"; |
|
271 |
+ ScreenShare.innerHTML = '<i class="fa fa-desktop" aria-hidden="true" title="Share Screen"></i>'; |
|
272 |
+ ScreenShare.onclick = function() { |
|
273 |
+ phone.ShareScreen(); |
|
274 |
+ }; |
|
275 |
+ |
|
276 |
+ controls.appendChild(ScreenShare); |
|
277 |
+ |
|
278 |
+ let VideoShare = document.createElement("button"); |
|
279 |
+ VideoShare.className = "mediaControlBtn"; |
|
280 |
+ VideoShare.innerHTML = '<i class="fa fa-video-camera" aria-hidden="true" title="Share Camera"></i>'; |
|
281 |
+ VideoShare.onclick = function() { |
|
282 |
+ phone.ShareVideo(); |
|
283 |
+ }; |
|
284 |
+ |
|
285 |
+ controls.appendChild(VideoShare); |
|
286 |
+ } |
|
287 |
+ |
|
288 |
+ let fullScreen = document.createElement("button"); |
|
289 |
+ fullScreen.className = "mediaControlBtn"; |
|
290 |
+ fullScreen.innerHTML = '<i class="fa fa-expand" aria-hidden="true" title="Full Screen"></i>'; |
|
291 |
+ fullScreen.onclick = function() { |
|
292 |
+ this.fullScreen.request(); |
|
293 |
+ }; |
|
294 |
+ |
|
295 |
+ fullScreen.fullScreen = new FullScreen(video); |
|
296 |
+ controls.appendChild(fullScreen); |
|
297 |
+ } |
|
298 |
+ return controls; |
|
299 |
+ } |
|
300 |
+ |
|
301 |
+ function createMediaView(stream) { |
|
302 |
+ |
|
303 |
+ var mediaView = document.createElement("div"); |
|
304 |
+ mediaView.className = "media-view"; |
|
305 |
+ mediaView.id = "new-media-view"+stream.id; |
|
306 |
+ mediaView.style.width = localStorage.getItem("VidConfWindowWidth")+"%"; |
|
307 |
+ |
|
308 |
+ var videoView = document.createElement("div"); |
|
309 |
+ videoView.className = "video-view"; |
|
310 |
+ videoView.id = "video-view"+stream.id; |
|
311 |
+ |
|
312 |
+ var video = document.createElement("video"); |
|
313 |
+ video.className = "videoElem"; |
|
314 |
+ video.id = "locVideo"+stream.id; |
|
315 |
+ video.autoplay = true; |
|
316 |
+ |
|
317 |
+ video.srcObject = stream; |
|
318 |
+ video.onloadedmetadata = function() { |
|
319 |
+ let tracks = stream.getVideoTracks(); |
|
320 |
+ |
|
321 |
+ for (let i = 0; i < tracks.length; ++i) { |
|
322 |
+ tracks[i].enabled = true; |
|
323 |
+ } |
|
324 |
+ }; |
|
325 |
+ |
|
326 |
+ if (stream.local == false) { |
|
327 |
+ function checkForVideo() { |
|
328 |
+ if (video.videoWidth < 10 || video.videoHeight < 10) { |
|
329 |
+ mediaView.style.display = 'none'; |
|
330 |
+ return; |
|
331 |
+ } |
|
332 |
+ mediaView.style.display = 'inline'; |
|
333 |
+ } |
|
334 |
+ checkForVideo(); |
|
335 |
+ setInterval(checkForVideo, 1000); |
|
336 |
+ } |
|
337 |
+ |
|
338 |
+ // Video elements connected to local streams will by default |
|
339 |
+ // echo both the video and the audio back to ourselves. Since |
|
340 |
+ // we don't want to hear ourselves we mute it, which mutes only |
|
341 |
+ // the audio portion. |
|
342 |
+ |
|
343 |
+ if (stream.local == true) { |
|
344 |
+ video.muted = true; |
|
345 |
+ } else if (mvcount == 0) { |
|
346 |
+ // We hide our own remote video track |
|
347 |
+ mvcount = 1; |
|
348 |
+ document.getElementById(mediaView.id).style.display = 'none'; |
|
349 |
+ } |
|
350 |
+ |
|
351 |
+ videoView.appendChild(video); |
|
352 |
+ mediaView.appendChild(videoView); |
|
353 |
+ mediaView.appendChild(createMediaControls(video)); |
|
354 |
+ |
|
355 |
+ return mediaView; |
|
356 |
+ } |
|
357 |
+ |
|
358 |
+ function removeMediaView(parent, stream) { |
|
359 |
+ let node = findMediaView(parent, stream); |
|
360 |
+ if (node) { |
|
361 |
+ parent.removeChild(node); |
|
362 |
+ } |
|
363 |
+ } |
|
364 |
+ |
|
365 |
+ function getValue(id) { |
|
366 |
+ let obj = document.getElementById(id); |
|
367 |
+ return obj.value ? obj.value : obj.placeholder; |
|
368 |
+ } |
|
369 |
+ |
|
370 |
+ document.getElementById("connect").addEventListener("click", function() { |
|
371 |
+ if (document.getElementById("connect").value == "Disconnect") { |
|
372 |
+ document.getElementById("call").value = "Call"; |
|
373 |
+ document.getElementById("call").disabled = true; |
|
374 |
+ document.getElementById("connect").value = "Disconnecting"; |
|
375 |
+ document.getElementById("connect").disabled = true; |
|
376 |
+ |
|
377 |
+ phone.disconnect(); |
|
378 |
+ return; |
|
379 |
+ } |
|
380 |
+ |
|
381 |
+ phone = new ConferencePhone(sip_username, sip_username, sip_password, wss_server, stun_server, true); |
|
382 |
+ |
|
383 |
+ sip_password = ''; |
|
384 |
+ |
|
385 |
+ phone.handle("connected", function () { |
|
386 |
+ |
|
387 |
+ if (document.getElementById("connect").value != "Disconnect") { |
|
388 |
+ document.getElementById("connect").value = "Registering"; |
|
389 |
+ } else { |
|
390 |
+ document.getElementById("connect").value = "Disconnect"; |
|
391 |
+ document.getElementById("connect").disabled = false; |
|
392 |
+ document.getElementById("call").disabled = false; |
|
393 |
+ } |
|
394 |
+ }); |
|
395 |
+ |
|
396 |
+ phone.handle("disconnected", function () { |
|
397 |
+ document.getElementById("connect").value = "Connect"; |
|
398 |
+ document.getElementById("connect").disabled = false; |
|
399 |
+ document.getElementById("call").value = "Call"; |
|
400 |
+ document.getElementById("call").disabled = true; |
|
401 |
+ }); |
|
402 |
+ |
|
403 |
+ phone.handle("registered", function () { |
|
404 |
+ document.getElementById("connect").value = "Disconnect"; |
|
405 |
+ document.getElementById("connect").disabled = false; |
|
406 |
+ document.getElementById("call").disabled = false; |
|
407 |
+ }); |
|
408 |
+ |
|
409 |
+ phone.handle("registrationFailed", function () { |
|
410 |
+ phone.disconnect(); |
|
411 |
+ }); |
|
412 |
+ |
|
413 |
+ phone.handle("incoming", function (reason) { |
|
414 |
+ document.getElementById("call").value = "Answer"; |
|
415 |
+ }); |
|
416 |
+ |
|
417 |
+ phone.handle("failed", function (reason) { |
|
418 |
+ document.getElementById("call").value = "Call"; |
|
419 |
+ document.getElementById("call").disabled = false; |
|
420 |
+ }); |
|
421 |
+ |
|
422 |
+ phone.handle("ended", function (reason) { |
|
423 |
+ document.getElementById("call").value = "Call"; |
|
424 |
+ document.getElementById("call").disabled = document.getElementById("connect").value == "Connect"; |
|
425 |
+ }); |
|
426 |
+ |
|
427 |
+ phone.handle("streamAdded", function (stream) { |
|
428 |
+ document.getElementById("media-views").appendChild(createMediaView(stream)); |
|
429 |
+ document.getElementById("call").value = "Hangup"; |
|
430 |
+ document.getElementById("call").disabled = false; |
|
431 |
+ document.getElementById("call").style.display = 'inline'; |
|
432 |
+ document.getElementById("fullscreen").style.display = 'inline'; |
|
433 |
+ document.getElementById("fullscreen").innerHTML = '<i class="fa fa-expand" aria-hidden="true"></i><b> Fullscreen'; |
|
434 |
+ }); |
|
435 |
+ |
|
436 |
+ phone.handle("streamRemoved", function (stream) { |
|
437 |
+ removeMediaView(document.getElementById("media-views"), stream); |
|
438 |
+ }); |
|
439 |
+ |
|
440 |
+ phone.connect(); |
|
441 |
+ |
|
442 |
+ document.getElementById("connect").disabled = true; |
|
443 |
+ document.getElementById("connect").value = "Connecting"; |
|
444 |
+ }); |
|
445 |
+ |
|
446 |
+ document.getElementById("connect").click(); |
|
447 |
+ |
|
448 |
+ let constraints = { video: true, audio: true }; |
|
449 |
+ navigator.mediaDevices.getUserMedia(constraints).then(function(stream) { |
|
450 |
+ phone.call(videoConfExtension); |
|
451 |
+ }).catch(function(err) { }); |
|
452 |
+ |
|
453 |
+ let node = document.getElementById("call"); |
|
454 |
+ |
|
455 |
+ if (node.value == "Answer") { |
|
456 |
+ node.disabled = true; |
|
457 |
+ node.value = "Hangup"; |
|
458 |
+ } |
|
459 |
+ |
|
460 |
+ document.getElementById("call").addEventListener("click", function() { |
|
461 |
+ if (node.value == "Hangup") { |
|
462 |
+ phone.terminate(); |
|
463 |
+ document.getElementById("call").remove(); |
|
464 |
+ window.close(); |
|
465 |
+ document.getElementsByTagName("body")[0].innerHTML = '<h4 style="text-align:center;color:#595959;">You have closed the video conference call ! If you want to enter the conference again, just press the button from below:</h4><button class="enterConfExt" onclick="window.location.reload()">Enter Conference Again</button><h4 style="text-align:center;color:#595959;">Otherwise, you can close this browser tab.</h4>'; |
|
466 |
+ } |
|
467 |
+ }); |
|
468 |
+ |
|
469 |
+ $("#showConnectionBttns").click(function() { |
|
470 |
+ if ($("#connection").is(':visible')) { |
|
471 |
+ $("#connection").hide(); |
|
472 |
+ $("#showConnectionBttns").html('<i class="fa fa-caret-down" aria-hidden="true"></i>'); |
|
473 |
+ } else { |
|
474 |
+ $("#connection").show(); |
|
475 |
+ $("#showConnectionBttns").html('<i class="fa fa-caret-up" aria-hidden="true"></i>'); |
|
476 |
+ } |
|
477 |
+ }); |
|
478 |
+ |
|
479 |
+ document.addEventListener("fullscreenchange", onFullScreenChange, false); |
|
480 |
+ document.addEventListener("webkitfullscreenchange", onFullScreenChange, false); |
|
481 |
+ document.addEventListener("mozfullscreenchange", onFullScreenChange, false); |
|
482 |
+ |
|
483 |
+ function onFullScreenChange() { |
|
484 |
+ if (document.mozFullScreenElement != null || document.webkitFullscreenElement != null || document.fullscreenElement != null) { |
|
485 |
+ document.getElementById("fullscreen").innerHTML = '<i class="fa fa-compress" aria-hidden="true"></i><b> Exit Fullscreen'; |
|
486 |
+ document.getElementById("fullscreen").style.width = "148px"; |
|
487 |
+ } else { |
|
488 |
+ document.getElementById("fullscreen").innerHTML = '<i class="fa fa-expand" aria-hidden="true"></i><b> Fullscreen'; |
|
489 |
+ document.getElementById("fullscreen").style.width = "117px"; |
|
490 |
+ } |
|
491 |
+ } |
|
492 |
+ |
|
493 |
+}; // window.onload |
|
494 |
+ |
|
495 |
+window.onbeforeunload = function() { |
|
496 |
+ phone.terminate(); |
|
497 |
+}; |
|
498 |
+ |
|
499 |
+window.onunload = function() { |
|
500 |
+ if (phone) { |
|
501 |
+ phone.disconnect(); |
|
502 |
+ } |
|
503 |
+}; // window.onunload |
|
504 |
+ |
|
505 |
+</script> |
|
506 |
+</head> |
|
507 |
+<body> |
|
508 |
+ <div id="connection"> |
|
509 |
+ <div id="VideoConferenceLogo"><img src="../images/small-logo.svg" /></div> |
|
510 |
+ <input type="button" id="connect" class="connect" value="Connect" style="display:none;" /> |
|
511 |
+ <button id="call" class="call"><i class="fa fa-phone" aria-hidden="true"></i><b> Hangup</b></button> |
|
512 |
+ <button id="fullscreen" class="fullscreen" onclick="toggleFullScreen(document.body)"><i class="fa fa-expand" aria-hidden="true"></i><b> Fullscreen</b></button> |
|
513 |
+ </div> |
|
514 |
+ <div id="showConnectionBttns"><i class="fa fa-caret-down" aria-hidden="true"></i></div> |
|
515 |
+ <div id="media-views" class="media-views"></div> |
|
516 |
+ |
|
517 |
+<script type="text/javascript"> |
|
518 |
+ |
|
519 |
+FullScreen.prototype.request = function() { |
|
520 |
+ if (this.is()) { |
|
521 |
+ return; |
|
522 |
+ } |
|
523 |
+ |
|
524 |
+ if (this._obj.requestFullscreen) { |
|
525 |
+ this._obj.requestFullscreen(); |
|
526 |
+ } else if (this._obj.mozRequestFullScreen) { |
|
527 |
+ this._obj.mozRequestFullScreen(); |
|
528 |
+ } else if (this._obj.webkitRequestFullScreen) { |
|
529 |
+ this._obj.webkitRequestFullScreen(); |
|
530 |
+ } else if (this._obj.msRequestFullscreen) { |
|
531 |
+ this._obj.msRequestFullscreen(); |
|
532 |
+ } |
|
533 |
+ |
|
534 |
+ this.setData(true); |
|
535 |
+}; |
|
536 |
+ |
|
537 |
+function toggleFullScreen(elem) { |
|
538 |
+ |
|
539 |
+ if ((document.fullScreenElement !== undefined && document.fullScreenElement === null) || (document.msFullscreenElement !== undefined && document.msFullscreenElement === null) || |
|
540 |
+ (document.mozFullScreen !== undefined && !document.mozFullScreen) || (document.webkitIsFullScreen !== undefined && !document.webkitIsFullScreen)) { |
|
541 |
+ if (elem.requestFullScreen) { |
|
542 |
+ elem.requestFullScreen(); |
|
543 |
+ } else if (elem.mozRequestFullScreen) { |
|
544 |
+ elem.mozRequestFullScreen(); |
|
545 |
+ } else if (elem.webkitRequestFullScreen) { |
|
546 |
+ elem.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT); |
|
547 |
+ } else if (elem.msRequestFullscreen) { |
|
548 |
+ elem.msRequestFullscreen(); |
|
549 |
+ } |
|
550 |
+ |
|
551 |
+ } else { |
|
552 |
+ if (document.cancelFullScreen) { |
|
553 |
+ document.cancelFullScreen(); |
|
554 |
+ } else if (document.mozCancelFullScreen) { |
|
555 |
+ document.mozCancelFullScreen(); |
|
556 |
+ } else if (document.webkitCancelFullScreen) { |
|
557 |
+ document.webkitCancelFullScreen(); |
|
558 |
+ } else if (document.msExitFullscreen) { |
|
559 |
+ document.msExitFullscreen(); |
|
560 |
+ } |
|
561 |
+ } |
|
562 |
+} |
|
563 |
+ |
|
564 |
+</script> |
|
565 |
+</body> |
|
566 |
+</html> |
|
567 |
+ |
|
568 |
+<?php |
|
569 |
+ |
|
570 |
+} else { |
|
571 |
+ header("Location: ../roundpin-login.php"); |
|
572 |
+ } |
|
573 |
+ |
|
574 |
+?> |