active_extension_assigned_inc.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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-2023
  17. the Initial Developer. All Rights Reserved.
  18. Contributor(s):
  19. Mark J Crane <[email protected]>
  20. */
  21. //includes files
  22. require_once dirname(__DIR__, 2) . "/resources/require.php";
  23. require_once "resources/pdo.php";
  24. require_once "resources/check_auth.php";
  25. //check permissions
  26. if (permission_exists('active_extension_assigned_view')) {
  27. //http get and set variables
  28. if (strlen($_GET['url']) > 0) {
  29. $url = $_GET['url'];
  30. }
  31. echo "<table width='100%' border='0' cellpadding='5' cellspacing='0'>\n";
  32. echo "<tr>\n";
  33. echo "<td valign='top'>\n";
  34. echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
  35. echo "<tr>\n";
  36. echo "<th width='50px;'>Ext</th>\n";
  37. if ($_SESSION['user_status_display'] == "false") {
  38. //hide the user_status when it is set to false
  39. }
  40. else {
  41. echo "<th>".$text['label-status']."</th>\n";
  42. }
  43. echo "<th>".$text['label-time']."</th>\n";
  44. //echo "<th>Direction</th>\n";
  45. //echo "<th>Profile</th>\n";
  46. echo "<th>".$text['label-cid-name']."</th>\n";
  47. echo "<th>".$text['label-cid-number']."</th>\n";
  48. echo "<th>".$text['label-destination']."</th>\n";
  49. echo "<th>".$text['label-app']."</th>\n";
  50. echo "<th>".$text['label-secure']."</th>\n";
  51. echo "<th>".$text['label-name']."</th>\n";
  52. echo "<th>".$text['label-opt']."</th>\n";
  53. echo "</tr>\n";
  54. foreach ($_SESSION['extension_array'] as $row) {
  55. $domain_uuid = $row['domain_uuid'];
  56. $extension = $row['extension'];
  57. $enabled = $row['enabled'];
  58. $effective_caller_id_name = $row['effective_caller_id_name'];
  59. foreach ($_SESSION['user']['extension'] as &$user_row) {
  60. if ($extension == $user_row['user']) {
  61. $found_extension = false;
  62. $x = 1;
  63. foreach ($channels_array as $row) {
  64. //set the php variables
  65. foreach ($row as $key => $value) {
  66. $$key = $value;
  67. }
  68. //find the matching extensions
  69. if ($number == $extension) {
  70. //set the found extension to true
  71. $found_extension = true;
  72. break;
  73. }
  74. } //end foreach
  75. if ($number == $extension) {
  76. if ($application == "conference") {
  77. $alt_color = "background-image: url('".PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/images/background_cell_active.gif";
  78. }
  79. switch ($application) {
  80. case "conference":
  81. $style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/images/background_cell_conference.gif');\"";
  82. break;
  83. case "fifo":
  84. $style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/images/background_cell_fifo.gif');\"";
  85. break;
  86. case "valet_park":
  87. $style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/images/background_cell_fifo.gif');\"";
  88. break;
  89. default:
  90. $style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/images/background_cell_active.gif');\"";
  91. }
  92. echo "<tr>\n";
  93. echo "<td class='".$row_style[$c]."' $style_alternate>".escape($extension)."</td>\n";
  94. if ($_SESSION['user_status_display'] == "false") {
  95. //hide the user_status when it is set to false
  96. }
  97. else {
  98. echo "<td class='".$row_style[$c]."' $style_alternate>".escape($user_array[$extension]['user_status'])."&nbsp;</td>\n";
  99. }
  100. echo "<td class='".$row_style[$c]."' $style_alternate width='20px;'>".$call_length."</td>\n";
  101. if (strlen($url) == 0) {
  102. $url = PROJECT_PATH."/core/contacts/contacts.php?search_all={cid_num}";
  103. }
  104. $url = str_replace ("{cid_num}", $cid_num, $url);
  105. $url = str_replace ("{cid_name}", $cid_name, $url);
  106. echo "<td class='".$row_style[$c]."' $style_alternate><a href='".escape($url)."' style='color: #444444;' target='_blank'>".escape($cid_name)."</a></td>\n";
  107. echo "<td class='".$row_style[$c]."' $style_alternate><a href='".escape($url)."' style='color: #444444;' target='_blank'>".escape($cid_num)."</a></td>\n";
  108. //get the active uuid list
  109. if (strlen($uuid) > 1) {
  110. if (strlen($uuid_1) == 0) {
  111. $uuid_1 = $uuid;
  112. //$direction_1 = $direction;
  113. $cid_name_1 = $cid_name;
  114. $cid_num_1 = $cid_num;
  115. }
  116. if (strlen($uuid_1) > 0 && $uuid != $uuid_1) {
  117. $uuid_2 = $uuid;
  118. //$direction_2 = $direction;
  119. $cid_name_2 = $cid_name;
  120. $cid_num_2 = $cid_num;
  121. }
  122. }
  123. echo "<td class='".$row_style[$c]."' $style_alternate>\n";
  124. if ($application == "valet_park") {
  125. echo $valet_array[trim($uuid)]['extension']."\n";
  126. }
  127. else {
  128. echo $dest."&nbsp;\n";
  129. }
  130. echo "</td>\n";
  131. echo "<td class='".$row_style[$c]."' $style_alternate>\n";
  132. if ($application == "fifo") {
  133. echo "queue &nbsp;\n";
  134. }
  135. else {
  136. echo $application."&nbsp;\n";
  137. }
  138. echo "</td>\n";
  139. echo "<td class='".$row_style[$c]."' $style_alternate>\n";
  140. echo "".$secure."&nbsp;\n";
  141. echo "</td>\n";
  142. echo "<td class='".$row_style[$c]."' $style_alternate>\n";
  143. echo "".$effective_caller_id_name."&nbsp;\n";
  144. echo "</td>\n";
  145. echo "<td valign='top' class='".$row_style[$c]."' $style_alternate>\n";
  146. //transfer
  147. echo " <a href='javascript:void(0);' style='color: #444444;' onMouseover=\"document.getElementById('form_label').innerHTML='<strong>".$text['label-transfer']."</strong>';\" onclick=\"send_cmd('calls_exec.php?cmd='+get_transfer_cmd(escape('$uuid')));\">".$text['label-transfer']."</a>&nbsp;\n";
  148. //park
  149. echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"send_cmd('calls_exec.php?cmd='+get_park_cmd(escape('$uuid')));\">".$text['label-park']."</a>&nbsp;\n";
  150. //hangup
  151. echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"confirm_response = confirm('".$text['confirm-hangup']."');if (confirm_response){send_cmd('calls_exec.php?cmd=uuid_kill%20'+(escape('$uuid')));}\">".$text['label-hangup']."</a>&nbsp;\n";
  152. //record start/stop
  153. $tmp_file = $_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$uuid.".wav";
  154. if (file_exists($tmp_file)) {
  155. //stop
  156. echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"send_cmd('calls_exec.php?cmd='+get_record_cmd(escape('$uuid'), 'active_extensions_', escape('$cid_num'))+'&uuid='+escape('$uuid')+'&action=record&action2=stop&prefix=active_extensions_&name='+escape('$cid_num'));\">".$text['label-stop']."</a>&nbsp;\n";
  157. }
  158. else {
  159. //start
  160. echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"send_cmd('calls_exec.php?cmd='+get_record_cmd(escape('$uuid'), 'active_extensions_', escape('$cid_num'))+'&uuid='+escape('$uuid')+'&action=record&action2=start&prefix=active_extensions_');\">".$text['label-start']."</a>&nbsp;\n";
  161. }
  162. echo " &nbsp;";
  163. echo "</td>\n";
  164. echo "</tr>\n";
  165. }
  166. else {
  167. $style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/images/background_cell_light.gif');\"";
  168. echo "<tr>\n";
  169. echo "<td class='".$row_style[$c]."' $style_alternate>$extension</td>\n";
  170. if ($_SESSION['user_status_display'] == "false") {
  171. //hide the user_status when it is set to false
  172. }
  173. else {
  174. echo "<td class='".$row_style[$c]."' $style_alternate>".escape($user_array[$extension]['user_status'])."&nbsp;</td>\n";
  175. }
  176. echo "<td class='".$row_style[$c]."' $style_alternate>&nbsp;</td>\n";
  177. echo "<td class='".$row_style[$c]."' $style_alternate>&nbsp;</td>\n";
  178. echo "<td class='".$row_style[$c]."' $style_alternate>&nbsp;</td>\n";
  179. echo "<td valign='top' class='".$row_style[$c]."' $style_alternate>\n";
  180. echo " &nbsp;";
  181. echo "</td>\n";
  182. echo "<td valign='top' class='".$row_style[$c]."' $style_alternate>\n";
  183. echo " &nbsp;";
  184. echo "</td>\n";
  185. echo "<td valign='top' class='".$row_style[$c]."' $style_alternate>\n";
  186. echo " &nbsp;";
  187. echo "</td>\n";
  188. echo "<td valign='top' class='".$row_style[$c]."' $style_alternate>\n";
  189. echo " &nbsp;";
  190. echo "</td>\n";
  191. echo "<td valign='top' class='".$row_style[$c]."' $style_alternate>\n";
  192. echo " &nbsp;";
  193. echo "</td>\n";
  194. echo "</tr>\n";
  195. }
  196. if ($c==0) { $c=1; } else { $c=0; }
  197. } //end if
  198. } //end foreach
  199. }
  200. echo "</table>\n";
  201. echo "</td>\n";
  202. echo "</tr>\n";
  203. echo "</table>\n";
  204. echo "<span id='uuid_1' style='visibility:hidden;'>$uuid_1</span>\n";
  205. //echo "<span id='direction_1' style='visibility:hidden;'>$direction_1</span>\n";
  206. echo "<span id='cid_name_1' style='visibility:hidden;'>$cid_name_1</span>\n";
  207. echo "<span id='cid_num_1' style='visibility:hidden;'>$cid_num_1</span>\n";
  208. echo "<span id='uuid_2' style='visibility:hidden;'>$uuid_2</span>\n";
  209. //echo "<span id='direction_2' style='visibility:hidden;'>$direction_2</span>\n";
  210. echo "<span id='cid_name_2' style='visibility:hidden;'>$cid_name_2</span>\n";
  211. echo "<span id='cid_num_2' style='visibility:hidden;'>$cid_num_2</span>\n";
  212. echo "<br />\n";
  213. }
  214. ?>