Fork of FusionPBX but with LDAP kinda working
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

161 lines
8.1 KiB

  1. <?php
  2. //includes
  3. require_once "root.php";
  4. require_once "resources/require.php";
  5. require_once "resources/check_auth.php";
  6. //check permissions
  7. if (permission_exists('webphone_view')) {
  8. //access granted
  9. }
  10. else {
  11. echo "access denied";
  12. exit;
  13. }
  14. //add multi-lingual support
  15. $language = new text;
  16. $text = $language->get();
  17. if (is_uuid($_GET['id'])) {
  18. $extension_uuid = $_GET['id'];
  19. }
  20. //get the user ID
  21. $sql = "SELECT extension, password,effective_caller_id_name ";
  22. $sql .= "FROM v_extensions ";
  23. $sql .= "WHERE extension_uuid = '" . $extension_uuid . "' ";
  24. $sql .= "AND v_extensions.domain_uuid = '" . $_SESSION["domain_uuid"] . "' LIMIT 1";
  25. $prep_statement = $db->prepare($sql);
  26. if ($prep_statement) {
  27. $prep_statement->execute();
  28. $row = $prep_statement->fetch(PDO::FETCH_ASSOC);
  29. $user_extension = $row['extension'];
  30. $user_password = $row['password'];
  31. $effective_caller_id_name = $row['effective_caller_id_name'];
  32. }
  33. echo "<html lang='en'>\n";
  34. echo "<head>\n";
  35. echo " <meta charset='utf-8' />\n";
  36. echo " <meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no'>\n";
  37. echo " <title>ctxSip</title>\n";
  38. echo " <link rel='icon' type='image/gif' href='img/favicon.ico' />\n";
  39. echo " <link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css'>\n";
  40. echo " <link rel='stylesheet' href='//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css'>\n";
  41. echo " <link href='css/ctxSip.css' rel='stylesheet' type='text/css' />\n";
  42. echo "</head>\n";
  43. echo "<body id='sipClient'>\n";
  44. echo "<div class='container-fluid'>\n";
  45. echo " <div class='clearfix sipStatus'>\n";
  46. echo " <div id='txtCallStatus' class='pull-right'>&nbsp;</div>\n";
  47. echo " <div id='txtRegStatus'></div>\n";
  48. echo " </div>\n";
  49. echo " <div class='form-group' id='phoneUI'>\n";
  50. echo " <div class='input-group'>\n";
  51. echo " <div class='input-group-btn'>\n";
  52. echo " <button class='btn btn-sm btn-primary dropdown-toggle' data-toggle='dropdown' title='Show Keypad'>\n";
  53. echo " <i class='fa fa-th'></i>\n";
  54. echo " </button>\n";
  55. echo " <div id='sip-dialpad' class='dropdown-menu'>\n";
  56. echo " <button type='button' class='btn btn-default digit' data-digit='1'>1<span>&nbsp;</span></button>\n";
  57. echo " <button type='button' class='btn btn-default digit' data-digit='2'>2<span>ABC</span></button>\n";
  58. echo " <button type='button' class='btn btn-default digit' data-digit='3'>3<span>DEF</span></button>\n";
  59. echo " <button type='button' class='btn btn-default digit' data-digit='4'>4<span>GHI</span></button>\n";
  60. echo " <button type='button' class='btn btn-default digit' data-digit='5'>5<span>JKL</span></button>\n";
  61. echo " <button type='button' class='btn btn-default digit' data-digit='6'>6<span>MNO</span></button>\n";
  62. echo " <button type='button' class='btn btn-default digit' data-digit='7'>7<span>PQRS</span></button>\n";
  63. echo " <button type='button' class='btn btn-default digit' data-digit='8'>8<span>TUV</span></button>\n";
  64. echo " <button type='button' class='btn btn-default digit' data-digit='9'>9<span>WXYZ</span></button>\n";
  65. echo " <button type='button' class='btn btn-default digit' data-digit='*'>*<span>&nbsp;</span></button>\n";
  66. echo " <button type='button' class='btn btn-default digit' data-digit='0'>0<span>+</span></button>\n";
  67. echo " <button type='button' class='btn btn-default digit' data-digit='#'>#<span>&nbsp;</span></button>\n";
  68. echo " <div class='clearfix'>&nbsp;</div>\n";
  69. echo " <button class='btn btn-success btn-block btnCall' title='Send'>\n";
  70. echo " <i class='fa fa-play'></i> Send\n";
  71. echo " </button>\n";
  72. echo " </div>\n";
  73. echo " </div>\n";
  74. echo " <input type='text' name='number' id='numDisplay' class='form-control text-center input-sm' value='' placeholder='Enter number...' autocomplete='off' />\n";
  75. echo " <div class='input-group-btn input-group-btn-sm'>\n";
  76. echo " <button class='btn btn-sm btn-primary dropdown-toggle' id='btnVol' data-toggle='dropdown' title='Volume'>\n";
  77. echo " <i class='fa fa-fw fa-volume-up'></i>\n";
  78. echo " </button>\n";
  79. echo " <div class='dropdown-menu dropdown-menu-right'>\n";
  80. echo " <input type='range' min='0' max='100' value='100' step='1' id='sldVolume' />\n";
  81. echo " </div>\n";
  82. echo " </div>\n";
  83. echo " </div>\n";
  84. echo " </div>\n";
  85. echo " <div class=well-sip'>\n";
  86. echo " <div id='sip-splash' class='text-muted text-center panel panel-default'>\n";
  87. echo " <div class='panel-body'>\n";
  88. echo " <h3 class='page-header'>\n";
  89. echo " <span class='fa-stack fa-2x'>\n";
  90. echo " <i class='fa fa-circle fa-stack-2x text-success'></i>\n";
  91. echo " <i class='fa fa-phone fa-stack-1x fa-inverse'></i>\n";
  92. echo " </span><br>\n";
  93. echo " This is your phone.</h3>\n";
  94. echo " <p class='lead'>To make a call enter a number in the box above.</p>\n";
  95. echo " <small>Closing this window will cause calls to go to voicemail.</small>\n";
  96. echo " </div>\n";
  97. echo " </div>\n";
  98. echo " <div id='sip-log' class='panel panel-default hide'>\n";
  99. echo " <div class='panel-heading'>\n";
  100. echo " <h4 class='text-muted panel-title'>Recent Calls <span class='pull-right'><i class='fa fa-trash text-muted sipLogClear' title='Clear Log'></i></span></h4>\n";
  101. echo " </div>\n";
  102. echo " <div id='sip-logitems' class='list-group'>\n";
  103. echo " <p class='text-muted text-center'>No recent calls from this browser.</p>\n";
  104. echo " </div>\n";
  105. echo " </div>\n";
  106. echo " </div>\n";
  107. echo " <div class='modal fade' id='mdlError' tabindex='-1' role='dialog' aria-hidden='true' data-backdrop='static' data-keyboard='false'>\n";
  108. echo " <div class='modal-dialog modal-sm'>\n";
  109. echo " <div class='modal-content'>\n";
  110. echo " <div class='modal-header'>\n";
  111. echo " <h4 class='modal-title'>Sip Error</h4>\n";
  112. echo " </div>\n";
  113. echo " <div class='modal-body text-center text-danger'>\n";
  114. echo " <h3><i class='fa fa-3x fa-ban'></i></h3>\n";
  115. echo " <p class='lead'>Sip registration failed. No calls can be handled.</p>\n";
  116. echo " </div>\n";
  117. echo " </div>\n";
  118. echo " </div>\n";
  119. echo " </div>\n";
  120. echo "</div>\n";
  121. echo "<audio id='ringtone' src='sounds/incoming.mp3' loop></audio>\n";
  122. echo "<audio id='ringbacktone' src='sounds/outgoing.mp3' loop></audio>\n";
  123. echo "<audio id='dtmfTone' src='sounds/dtmf.mp3'></audio>\n";
  124. echo "<audio id='audioRemote'></audio>\n";
  125. echo "<script type='text/javascript' src='https://code.jquery.com/jquery-1.11.3.min.js'></script>\n";
  126. echo "<script src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js'></script>\n";
  127. echo "<script type='text/javascript' src='scripts/moment.js/moment.min.js'></script>\n";
  128. //echo "<script type='text/javascript' src='scripts/SIP.js/sip.min.js'></script>\n";
  129. echo "<script type='text/javascript' src='scripts/SIP.js/sip.js'></script>\n";
  130. //echo "<script type='text/javascript' src='scripts/config.js'></script>\n";
  131. echo "<script type='text/javascript'>\n";
  132. echo "var user = {'User' : '" . $user_extension. "', ";
  133. echo " 'Pass' : '".$user_password."', ";
  134. echo " 'Realm' : '".$_SESSION["domain_name"]."', ";
  135. echo " 'Display' : '".$effective_caller_id_name."', ";
  136. echo " 'WSServer' : 'wss://".$_SESSION["domain_name"].":7443' ";
  137. echo "};\n";
  138. echo "</script>\n";
  139. echo "<script type='text/javascript' src='scripts/app.js'></script>\n";
  140. echo "</body>\n";
  141. //</html>
  142. ?>