webrtc.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <?php
  2. /*
  3. FusionPBX
  4. Version: MPL 1.1
  5. The contents of this file are subject to the Mozilla Public License Version
  6. 1.1 (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.mozilla.org/MPL/
  9. Software distributed under the License is distributed on an "AS IS" basis,
  10. WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  11. for the specific language governing rights and limitations under the
  12. License.
  13. The Original Code is FusionPBX
  14. The Initial Developer of the Original Code is
  15. Mark J Crane <[email protected]>
  16. Portions created by the Initial Developer are Copyright (C) 2008-2012
  17. the Initial Developer. All Rights Reserved.
  18. Contributor(s):
  19. Mark J Crane <[email protected]>
  20. Giovanni Maruzzelli <[email protected]>
  21. Len Graham <[email protected]>
  22. */
  23. //includes
  24. require_once "root.php";
  25. require_once "resources/require.php";
  26. //check permissions
  27. require_once "resources/check_auth.php";
  28. if (permission_exists('webrtc')) {
  29. //access granted
  30. }
  31. else {
  32. echo "access denied";
  33. exit;
  34. }
  35. //add multi-lingual support
  36. $language = new text;
  37. $text = $language->get();
  38. //get variables used to control the order
  39. $order_by = $_GET["order_by"];
  40. $order = $_GET["order"];
  41. //additional includes
  42. require_once "resources/header.php";
  43. require_once "resources/paging.php";
  44. echo " <meta charset=\"utf-8\">\n";
  45. echo " <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n";
  46. echo " <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n";
  47. echo " <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->\n";
  48. echo " <meta name=\"description\" content=\"A WebRTC client for Verto FreeSWITCH module\">\n";
  49. echo " <meta name=\"author\" content=\"Giovanni Maruzzelli\">\n";
  50. echo " <link rel=\"icon\" href=\"favicon.ico\">\n";
  51. echo " <!-- Bootstrap core CSS -->\n";
  52. echo " <link href=\"css/bootstrap.min.css\" rel=\"stylesheet\">\n";
  53. echo " <!-- Custom styles for this template -->\n";
  54. //echo " <link href=\"high.css\" rel=\"stylesheet\">\n";
  55. //prepare to page the results
  56. $sql = "select count(*) as num_rows from v_webrtc ";
  57. if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
  58. $prep_statement = $db->prepare($sql);
  59. if ($prep_statement) {
  60. $prep_statement->execute();
  61. $row = $prep_statement->fetch(PDO::FETCH_ASSOC);
  62. if ($row['num_rows'] > 0) {
  63. $num_rows = $row['num_rows'];
  64. }
  65. else {
  66. $num_rows = '0';
  67. }
  68. }
  69. //prepare to page the results
  70. $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
  71. $param = "";
  72. $page = $_GET['page'];
  73. if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
  74. list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
  75. $offset = $rows_per_page * $page;
  76. //get the user ID
  77. $sql = "SELECT extension,v_extensions.password,effective_caller_id_name FROM ";
  78. $sql .= "v_extension_users, v_extensions, v_users ";
  79. $sql .= "WHERE v_users.user_uuid = v_extension_users.user_uuid ";
  80. $sql .= "AND v_extensions.extension_uuid = v_extension_users.extension_uuid ";
  81. $sql .= "AND v_users.user_uuid = '" . $_SESSION['user_uuid'] . "' ";
  82. $sql .= "AND v_extensions.domain_uuid = '" . $_SESSION["domain_uuid"] . "' LIMIT 1";
  83. $prep_statement = $db->prepare($sql);
  84. if ($prep_statement) {
  85. $prep_statement->execute();
  86. $row = $prep_statement->fetch(PDO::FETCH_ASSOC);
  87. $user_extension = $row['extension'];
  88. $user_password = $row['password'];
  89. $effective_caller_id_name = $row['effective_caller_id_name'];
  90. }
  91. //show the content
  92. echo " <div id=\"conference\">\n";
  93. echo " <input type=\"hidden\" id=\"hostName\" value=\"" . $_SESSION['domain_name'] . "\"/>\n";
  94. echo " <input type=\"hidden\" id=\"wsURL\" value=\"wss://" . $_SESSION['domain_name'] . ":8082\"/>\n";
  95. echo " <input type=\"hidden\" id=\"login\" value=\"" . $user_extension . "\"/>\n";
  96. echo " <input type=\"hidden\" id=\"passwd\" value=\"" . $user_password . "\"/>\n";
  97. echo " <input type=\"hidden\" id=\"cidnumber\" value=\"" . $effective_caller_id_name . "\"/>\n";
  98. echo " <div class=\"form-signin\">\n";
  99. echo " <h2 class=\"form-signin-heading\">" . $_SESSION['theme']['webrtc_title']['text'] . "</h2>\n";
  100. echo " <div id=\"content\" class=\"form-signin-content\">\n";
  101. echo " <input type=\"text\" id=\"ext\" class=\"form-control\" placeholder=\"Number to dial ? (eg: 3000)\" required autofocus>\n";
  102. echo " <button class=\"btn btn-lg btn-primary btn-success\" data-inline=\"true\" id=\"extbtn\">Call</button>\n";
  103. echo " <input type=\"text\" id=\"cidname\" class=\"form-control\" placeholder=\"insert here your NAME (eg: Squidward)\" required autofocus>\n";
  104. echo " <button class=\"btn btn-lg btn-primary btn-success\" data-inline=\"true\" id=\"callbtn\">Call</button>\n";
  105. echo " <button class=\"btn btn-lg btn-primary btn-danger\" data-inline=\"true\" id=\"backbtn\">Back</button>\n";
  106. echo " </div>\n";
  107. echo " <div id=\"video1\" align=\"center\" class=\"embed-responsive embed-responsive-4by3\">\n";
  108. echo " <video id=\"webcam\" autoplay=\"autoplay\" class=\"embed-responsive-item\"> </video>\n";
  109. echo " </div>\n";
  110. echo " <button class=\"btn btn-lg btn-primary btn-danger\" data-inline=\"true\" id=\"hupbtn\">Hangup</button>\n";
  111. echo " <br id=\"br\"/>\n";
  112. echo " <textarea id=\"chatwin\" class=\"form-control\" rows=\"5\" readonly></textarea>\n";
  113. echo " <br id=\"br\"/>\n";
  114. echo " <textarea id=\"chatmsg\" class=\"form-control\" rows=\"1\" placeholder=\"type here your chat msg\" autofocus></textarea>\n";
  115. echo " <button class=\"btn btn-primary btn-success\" data-inline=\"true\" id=\"chatsend\">Send Msg</button>\n";
  116. echo " </div>\n";
  117. echo " </div>\n";
  118. echo " <script type=\"text/javascript\" src=\"js/jquery.min.js\"></script>\n";
  119. echo " <script type=\"text/javascript\" src=\"js/jquery.json-2.4.min.js\"></script>\n";
  120. echo " <script type=\"text/javascript\" src=\"js/verto-min.js\"></script>\n";
  121. echo " <script type=\"text/javascript\" src=\"high.js\"></script>\n";
  122. echo " </body> </html>\n";
  123. echo "\n";
  124. //include the footer
  125. require_once "resources/footer.php";
  126. ?>