active_extension_assigned_inc.php 10 KB

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