active_extensions_inc.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  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. Copyright (C) 2010-2023
  17. 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_view')) {
  26. //access granted
  27. }
  28. else {
  29. echo "access denied";
  30. exit;
  31. }
  32. //set debug to true or false
  33. $debug = false;
  34. //http get and set variables
  35. if (strlen($_GET['url']) > 0) {
  36. $url = $_GET['url'];
  37. }
  38. if (strlen($_GET['rows']) == 0) {
  39. $_GET['rows'] = 0;
  40. }
  41. //connect to the database
  42. $database = new database;
  43. //define variables
  44. $c = 0;
  45. $row_style["0"] = "row_style1";
  46. $row_style["1"] = "row_style1";
  47. //get the user status
  48. $sql = "select e.extension, u.username, u.user_status ";
  49. $sql .= "from v_users as u, v_extensions as e ";
  50. $sql .= "where e.domain_uuid = :domain_uuid ";
  51. $sql .= "and u.user_enabled = 'true' ";
  52. $sql .= "and u.domain_uuid = :domain_uuid ";
  53. //$sql = "select * ";
  54. //$sql .= "from v_extensions ";
  55. //$sql .= "where domain_uuid = '$domain_uuid' ";
  56. //$sql .= "and enabled = 'true' ";
  57. if (!(if_group("admin") || if_group("superadmin"))) {
  58. if (!empty($_SESSION['user']['extension'])) {
  59. $sql .= "and (";
  60. $x = 0;
  61. foreach($_SESSION['user']['extension'] as $row) {
  62. if ($x > 0) { $sql .= "or "; }
  63. $sql .= "e.extension = '".$row['user']."' ";
  64. $x++;
  65. }
  66. $sql .= ")";
  67. }
  68. else {
  69. //hide any results when a user has not been assigned an extension
  70. $sql .= "and extension = 'disabled' ";
  71. }
  72. }
  73. $parameters['domain_uuid'] = $domain_uuid;
  74. $result = $database->select($sql, $parameters ?? null, 'all');
  75. unset($sql, $parameters);
  76. $x = 0;
  77. foreach ($result as &$row) {
  78. if (strlen($row["user_status"]) > 0) {
  79. $user_array[$row["extension"]]['username'] = $row["username"];
  80. $user_array[$row["extension"]]['user_status'] = $row["user_status"];
  81. $username_array[$row["username"]]['user_status'] = $row["user_status"];
  82. if ($row["username"] == $_SESSION["username"]) {
  83. $user_status = $row["user_status"];
  84. }
  85. }
  86. $x++;
  87. }
  88. unset ($x);
  89. //create the event socket connection
  90. $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
  91. //get information over event socket
  92. if (!$fp) {
  93. $msg = "<div align='center'>".$text['confirm-socket']."<br /></div>";
  94. echo "<div align='center'>\n";
  95. echo "<table width='40%'>\n";
  96. echo "<tr>\n";
  97. echo "<th align='left'>".$text['label-message']."</th>\n";
  98. echo "</tr>\n";
  99. echo "<tr>\n";
  100. echo "<td class='row_style1'><strong>$msg</strong></td>\n";
  101. echo "</tr>\n";
  102. echo "</table>\n";
  103. echo "</div>\n";
  104. }
  105. else {
  106. //get the agent list from event socket
  107. $switch_cmd = 'callcenter_config agent list';
  108. $event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
  109. $agent_array = csv_to_named_array($event_socket_str, '|');
  110. //set the status on the user_array by using the extension as the key
  111. foreach ($agent_array as $row) {
  112. if (count($_SESSION['domains']) == 1) {
  113. //get the extension status from the call center agent list
  114. preg_match('/user\/(\d{2,7})/', $row['contact'], $matches);
  115. $extension = $matches[1];
  116. $user_array[$extension]['username'] = $tmp[0];
  117. if ($user_array[$extension]['user_status'] != "Do Not Disturb") {
  118. $user_array[$extension]['user_status'] = $row['status'];
  119. }
  120. } else {
  121. $tmp = explode('@',$row["name"]);
  122. if ($tmp[1] == $_SESSION['domain_name']) {
  123. //get the extension status from the call center agent list
  124. preg_match('/user\/(\d{2,7})/', $row['contact'], $matches);
  125. $extension = $matches[1];
  126. $user_array[$extension]['username'] = $tmp[0];
  127. if ($user_array[$extension]['user_status'] != "Do Not Disturb") {
  128. $user_array[$extension]['user_status'] = $row['status'];
  129. }
  130. }
  131. }
  132. }
  133. //send the api command over event socket
  134. //$switch_cmd = 'valet_info';
  135. //$valet_xml_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
  136. //parse the xml
  137. //try {
  138. // $valet_xml = new SimpleXMLElement($valet_xml_str);
  139. //}
  140. //catch(Exception $e) {
  141. // //echo $e->getMessage();
  142. //}
  143. //$valet_xml = new SimpleXMLElement($valet_xml_str);
  144. //foreach ($valet_xml as $row) {
  145. // $valet_name = (string) $row->attributes()->name;
  146. // foreach ($row->extension as $row2) {
  147. // $extension = (string) $row2;
  148. // $uuid = (string) $row2->attributes()->uuid;
  149. // $uuid = trim($uuid);
  150. // $valet_array[$uuid]['name'] = $valet_name;
  151. // $valet_array[$uuid]['extension'] = $extension;
  152. // }
  153. //}
  154. //send the event socket command
  155. $switch_cmd = 'show channels as xml';
  156. $xml_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
  157. //parse the xml
  158. try {
  159. $xml = new SimpleXMLElement($xml_str);
  160. }
  161. catch(Exception $e) {
  162. //echo $e->getMessage();
  163. }
  164. //active channels array
  165. $x = 1;
  166. foreach ($xml as $row) {
  167. //set the original array id
  168. $channels_array[$x]['x'] = $x;
  169. //get the values from xml and set them to the channel array
  170. $channels_array[$x]['uuid'] = $row->uuid;
  171. $channels_array[$x]['direction'] = $row->direction;
  172. $channels_array[$x]['created'] = $row->created;
  173. $channels_array[$x]['created_epoch'] = $row->created_epoch;
  174. $channels_array[$x]['name'] = $row->name;
  175. $channels_array[$x]['state'] = $row->state;
  176. $channels_array[$x]['cid_name'] = $row->cid_name;
  177. $channels_array[$x]['cid_num'] = $row->cid_num;
  178. $channels_array[$x]['ip_addr'] = $row->ip_addr;
  179. $channels_array[$x]['dest'] = $row->dest;
  180. $channels_array[$x]['application'] = $row->application;
  181. $channels_array[$x]['application_data'] = $row->application_data;
  182. $channels_array[$x]['dialplan'] = $row->dialplan;
  183. $channels_array[$x]['context'] = $row->context;
  184. $channels_array[$x]['read_codec'] = $row->read_codec;
  185. $channels_array[$x]['read_rate'] = $row->read_rate;
  186. $channels_array[$x]['read_bit_rate'] = $row->read_bit_rate;
  187. $channels_array[$x]['write_codec'] = $row->write_codec;
  188. $channels_array[$x]['write_rate'] = $row->write_rate;
  189. $channels_array[$x]['write_bit_rate'] = $row->write_bit_rate;
  190. $channels_array[$x]['secure'] = $row->secure;
  191. $channels_array[$x]['hostname'] = $row->hostname;
  192. $channels_array[$x]['presence_id'] = $row->presence_id;
  193. $channels_array[$x]['presence_data'] = $row->presence_data;
  194. $channels_array[$x]['callstate'] = $row->callstate;
  195. $channels_array[$x]['callee_name'] = $row->callee_name;
  196. $channels_array[$x]['callee_num'] = $row->callee_num;
  197. $channels_array[$x]['callee_direction'] = $row->callee_direction;
  198. $channels_array[$x]['call_uuid'] = $row->call_uuid;
  199. //remove other domains
  200. if (count($_SESSION["domains"]) > 1) {
  201. //unset domains that are not related to this tenant
  202. $temp_array = explode("@", $channels_array[$x]['presence_id']);
  203. if ($temp_array[1] != $_SESSION['domain_name']) {
  204. unset($channels_array[$x]);
  205. }
  206. }
  207. //parse some of the php variables\
  208. $temp_array = explode("@", $channels_array[$x]['presence_id']);
  209. $channels_array[$x]['number'] = $temp_array[0];
  210. //remove the '+' because it breaks the call recording
  211. $channels_array[$x]['cid_num'] = $temp_array[0] = str_replace("+", "", $channels_array[$x]['cid_num']);
  212. //calculate and set the call length
  213. $call_length_seconds = time() - $channels_array[$x]['created_epoch'];
  214. $call_length_hour = floor($call_length_seconds/3600);
  215. $call_length_min = floor($call_length_seconds/60 - ($call_length_hour * 60));
  216. $call_length_sec = $call_length_seconds - (($call_length_hour * 3600) + ($call_length_min * 60));
  217. $call_length_min = sprintf("%02d", $call_length_min);
  218. $call_length_sec = sprintf("%02d", $call_length_sec);
  219. $call_length = $call_length_hour.':'.$call_length_min.':'.$call_length_sec;
  220. $channels_array[$x]['call_length'] = $call_length;
  221. //valet park
  222. //if (is_array($valet_array[$uuid])) {
  223. // $valet_array[$uuid]['context'] = $channels_array[$x]['context'];
  224. // $valet_array[$uuid]['cid_name'] = $channels_array[$x]['cid_name'];
  225. // $valet_array[$uuid]['cid_num'] = $channels_array[$x]['cid_num'];
  226. // $valet_array[$uuid]['call_length'] = $call_length;
  227. //}
  228. //increment the array index
  229. $x++;
  230. }
  231. //active extensions
  232. //get the extension information
  233. if (!empty($debug)) {
  234. unset($_SESSION['extension_array']);
  235. }
  236. if (empty($_SESSION['extension_array'])) {
  237. $sql = "select * from v_extensions ";
  238. $x = 0;
  239. $range_array = $_GET['range'];
  240. foreach($range_array as $tmp_range) {
  241. $tmp_range = str_replace(":", "-", $tmp_range);
  242. $tmp_array = explode("-", $tmp_range);
  243. $tmp_min = $tmp_array[0];
  244. $tmp_max = $tmp_array[1];
  245. if ($x == 0) {
  246. $sql .= "where domain_uuid = :domain_uuid ";
  247. $sql .= "and extension >= $tmp_min ";
  248. $sql .= "and extension <= $tmp_max ";
  249. $sql .= "and enabled = 'true' ";
  250. }
  251. else {
  252. $sql .= "or domain_uuid = :domain_uuid ";
  253. $sql .= "and extension >= $tmp_min ";
  254. $sql .= "and extension <= $tmp_max ";
  255. $sql .= "and enabled = 'true' ";
  256. }
  257. $x++;
  258. }
  259. if (empty($range_array)) {
  260. $sql .= "where domain_uuid = :domain_uuid ";
  261. $sql .= "and enabled = 'true' ";
  262. }
  263. $sql .= "order by extension asc ";
  264. $parameters['domain_uuid'] = $domain_uuid;
  265. $result = $database->select($sql, $parameters ?? null, 'all');
  266. unset($sql, $parameters);
  267. foreach ($result as &$row) {
  268. if ($row["enabled"] == "true") {
  269. $extension = $row["extension"];
  270. $extension_array[$extension]['domain_uuid'] = $row["domain_uuid"];
  271. $extension_array[$extension]['extension'] = $row["extension"];
  272. //$extension_array[$extension]['password'] = $row["password"];
  273. $extension_array[$extension]['mailbox'] = $row["mailbox"];
  274. //$vm_password = $row["vm_password"];
  275. //$vm_password = str_replace("#", "", $vm_password); //preserves leading zeros
  276. //$_SESSION['extension_array'][$extension]['vm_password'] = $vm_password;
  277. $extension_array[$extension]['accountcode'] = $row["accountcode"];
  278. $extension_array[$extension]['effective_caller_id_name'] = $row["effective_caller_id_name"];
  279. $extension_array[$extension]['effective_caller_id_number'] = $row["effective_caller_id_number"];
  280. $extension_array[$extension]['outbound_caller_id_name'] = $row["outbound_caller_id_name"];
  281. $extension_array[$extension]['outbound_caller_id_number'] = $row["outbound_caller_id_number"];
  282. $extension_array[$extension]['vm_enabled'] = $row["vm_enabled"];
  283. $extension_array[$extension]['vm_mailto'] = $row["vm_mailto"];
  284. $extension_array[$extension]['vm_attach_file'] = $row["vm_attach_file"];
  285. $extension_array[$extension]['vm_keep_local_after_email'] = $row["vm_keep_local_after_email"];
  286. $extension_array[$extension]['user_context'] = $row["user_context"];
  287. $extension_array[$extension]['call_group'] = $row["call_group"];
  288. $extension_array[$extension]['auth_acl'] = $row["auth_acl"];
  289. $extension_array[$extension]['cidr'] = $row["cidr"];
  290. $extension_array[$extension]['sip_force_contact'] = $row["sip_force_contact"];
  291. //$extension_array[$extension]['enabled'] = $row["enabled"];
  292. $extension_array[$extension]['effective_caller_id_name'] = $row["effective_caller_id_name"];
  293. }
  294. }
  295. $_SESSION['extension_array'] = $extension_array;
  296. }
  297. //get a list of assigned extensions for this user
  298. //include "active_extension_assigned_inc.php";
  299. //list all extensions
  300. if (permission_exists('active_extension_view')) {
  301. echo "<table width='100%' border='0' cellpadding='5' cellspacing='0'>\n";
  302. echo "<tr>\n";
  303. echo "<td valign='top'>\n";
  304. echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
  305. echo "<tr>\n";
  306. echo "<th width='50px;'>".$text['label-extension']."</th>\n";
  307. if ($_SESSION['user_status_display'] == "false") {
  308. //hide the user_status when it is set to false
  309. }
  310. else {
  311. echo "<th>".$text['label-status']."</th>\n";
  312. }
  313. echo "<th>".$text['label-time']."</th>\n";
  314. if (if_group("admin") || if_group("superadmin")) {
  315. if (strlen(($_GET['rows'])) == 0) {
  316. echo "<th>".$text['label-cid-name']."</th>\n";
  317. echo "<th>".$text['label-cid-number']."</th>\n";
  318. echo "<th>".$text['label-destination']."</th>\n";
  319. echo "<th>".$text['label-app']."</th>\n";
  320. echo "<th>".$text['label-secure']."</th>\n";
  321. }
  322. }
  323. echo "<th>".$text['label-name']."</th>\n";
  324. if (if_group("admin") || if_group("superadmin")) {
  325. if (strlen(($_GET['rows'])) == 0) {
  326. echo "<th>".$text['label-opt']."</th>\n";
  327. }
  328. }
  329. echo "</tr>\n";
  330. $x = 1;
  331. foreach ($_SESSION['extension_array'] as $row) {
  332. $domain_uuid = $row['domain_uuid'];
  333. $extension = $row['extension'];
  334. $enabled = $row['enabled'];
  335. $effective_caller_id_name = $row['effective_caller_id_name'];
  336. $found_extension = false;
  337. foreach ($channels_array as $row) {
  338. //set the php variables
  339. foreach ($row as $key => $value) {
  340. $$key = $value;
  341. }
  342. //check to see if the extension is found in the channel array
  343. if ($number == $extension) {
  344. $found_extension = true;
  345. break;
  346. }
  347. }
  348. if ($found_extension) {
  349. if ($application == "conference") {
  350. $alt_color = "background-image: url('".PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/images/background_cell_active.gif";
  351. }
  352. switch ($application) {
  353. case "conference":
  354. $style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/images/background_cell_conference.gif');\"";
  355. break;
  356. case "fifo":
  357. $style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/images/background_cell_fifo.gif');\"";
  358. break;
  359. case "valet_park":
  360. $style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/images/background_cell_fifo.gif');\"";
  361. break;
  362. default:
  363. $style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/images/background_cell_active.gif');\"";
  364. }
  365. echo "<tr>\n";
  366. echo "<td class='".$row_style[$c]."' $style_alternate>".escape($extension)."</td>\n";
  367. if ($_SESSION['user_status_display'] == "false") {
  368. //hide the user_status when it is set to false
  369. }
  370. else {
  371. echo "<td class='".$row_style[$c]."' $style_alternate>".escape($user_array[$extension]['user_status'])."&nbsp;</td>\n";
  372. }
  373. echo "<td class='".$row_style[$c]."' $style_alternate width='20px;'>".$call_length."</td>\n";
  374. if (if_group("admin") || if_group("superadmin")) {
  375. if (strlen(($_GET['rows'])) == 0) {
  376. if (strlen($url) == 0) {
  377. $url = PROJECT_PATH."/core/contacts/contacts.php?search_all={cid_num}";
  378. }
  379. $url = str_replace ("{cid_num}", escape($cid_num), $url);
  380. $url = str_replace ("{cid_name}", escape($cid_name), $url);
  381. echo "<td class='".$row_style[$c]."' $style_alternate><a href='".$url."' style='color: #444444;' target='_blank'>".escape($cid_name)."</a></td>\n";
  382. echo "<td class='".$row_style[$c]."' $style_alternate><a href='".$url."' style='color: #444444;' target='_blank'>".escape($cid_num)."</a></td>\n";
  383. }
  384. }
  385. if (if_group("admin") || if_group("superadmin")) {
  386. if (strlen(($_GET['rows'])) == 0) {
  387. echo "<td class='".$row_style[$c]."' $style_alternate>\n";
  388. echo "".escape($dest)."<br />\n";
  389. echo "</td>\n";
  390. echo "<td class='".$row_style[$c]."' $style_alternate>\n";
  391. if ($application == "fifo") {
  392. echo "queue &nbsp;\n";
  393. }
  394. else {
  395. echo escape($application)." &nbsp;\n";
  396. }
  397. echo "</td>\n";
  398. echo "<td class='".$row_style[$c]."' $style_alternate>\n";
  399. echo escape($secure)."<br />\n";
  400. echo "</td>\n";
  401. }
  402. }
  403. }
  404. else {
  405. $style_alternate = "style=\"color: #444444; background-image: url('".PROJECT_PATH."/themes/".$_SESSION['domain']['template']['name']."/images/background_cell_light.gif');\"";
  406. echo "<tr>\n";
  407. echo "<td class='".$row_style[$c]."' $style_alternate>".escape($extension)."</td>\n";
  408. if ($_SESSION['user_status_display'] == "false") {
  409. //hide the user_status when it is set to false
  410. }
  411. else {
  412. echo "<td class='".$row_style[$c]."' $style_alternate>".escape($user_array[$extension]['user_status'])."&nbsp;</td>\n";
  413. }
  414. echo "<td class='".$row_style[$c]."' $style_alternate>&nbsp;</td>\n";
  415. if (if_group("admin") || if_group("superadmin")) {
  416. if (strlen(($_GET['rows'])) == 0) {
  417. echo "<td class='".$row_style[$c]."' $style_alternate>&nbsp;</td>\n";
  418. echo "<td class='".$row_style[$c]."' $style_alternate>&nbsp;</td>\n";
  419. echo "<td class='".$row_style[$c]."' $style_alternate>&nbsp;</td>\n";
  420. echo "<td class='".$row_style[$c]."' $style_alternate>&nbsp;</td>\n";
  421. echo "<td class='".$row_style[$c]."' $style_alternate>&nbsp;</td>\n";
  422. }
  423. }
  424. }
  425. echo "<td valign='top' class='".$row_style[$c]."' $style_alternate>\n";
  426. echo " ".escape($effective_caller_id_name)."&nbsp;\n";
  427. echo "</td>\n";
  428. if (if_group("admin") || if_group("superadmin")) {
  429. if (strlen(($_GET['rows'])) == 0) {
  430. if ($found_extension) {
  431. echo "<td valign='top' class='".$row_style[$c]."' $style_alternate>\n";
  432. //transfer
  433. echo " <a href='javascript:void(0);' style='color: #444444;' onclick=\"send_cmd('calls_exec.php?cmd='+get_transfer_cmd(escape('$uuid')));\">".$text['label-transfer']."</a>&nbsp;\n";
  434. //park
  435. 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";
  436. //hangup
  437. 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";
  438. //record start/stop
  439. $tmp_file = $_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d")."/".$uuid.".wav";
  440. if (file_exists($tmp_file)) {
  441. //stop
  442. 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";
  443. }
  444. else {
  445. //start
  446. 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";
  447. }
  448. echo " &nbsp;";
  449. echo "</td>\n";
  450. }
  451. else {
  452. echo "<td valign='top' class='".$row_style[$c]."' $style_alternate>\n";
  453. echo " &nbsp;";
  454. echo "</td>\n";
  455. }
  456. }
  457. }
  458. echo "</tr>\n";
  459. if ($y == $_GET['rows'] && !empty($_GET['rows'])) {
  460. $y = 0;
  461. echo "</table>\n";
  462. echo "</td>\n";
  463. echo "<td valign='top'>\n";
  464. echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
  465. echo "<tr>\n";
  466. echo "<th>".$text['label-ext']."</th>\n";
  467. if ($_SESSION['user_status_display'] == "false") {
  468. //hide the user_status when it is set to false
  469. }
  470. else {
  471. echo "<th>".$text['label-status']."</th>\n";
  472. }
  473. echo "<th>".$text['label-time']."</th>\n";
  474. if (if_group("admin") || if_group("superadmin")) {
  475. if ($_GET['rows'] == 0) {
  476. echo "<th>".$text['label-cid-name']."</th>\n";
  477. echo "<th>".$text['label-cid-number']."</th>\n";
  478. echo "<th>".$text['label-destination']."</th>\n";
  479. echo "<th>".$text['label-app']."</th>\n";
  480. echo "<th>".$text['label-secure']."</th>\n";
  481. }
  482. }
  483. echo "<th>".$text['label-name']."</th>\n";
  484. if (if_group("admin") || if_group("superadmin")) {
  485. if ($_GET['rows'] == 0) {
  486. echo "<th>".$text['label-opt']."</th>\n";
  487. }
  488. }
  489. echo "</tr>\n";
  490. }
  491. $y++;
  492. if ($c==0) { $c=1; } else { $c=0; }
  493. }
  494. echo "</table>\n";
  495. echo "<br /><br />\n";
  496. //valet park
  497. //echo "<table width='100%' border='0' cellpadding='5' cellspacing='0'>\n";
  498. //echo "<tr>\n";
  499. //echo "<th valign='top'>".$text['label-park-ext']."</th>\n";
  500. //echo "<th valign='top'>".$text['label-time']."</th>\n";
  501. //echo "<th valign='top'>".$text['label-cid-name']."</th>\n";
  502. //echo "<th valign='top'>".$text['label-cid-number']."</th>\n";
  503. //echo "</tr>\n";
  504. //foreach ($valet_array as $row) {
  505. // if (strlen($row['extension']) > 0) {
  506. // if ($row['context'] == $_SESSION['domain_name'] || $row['context'] == "default") {
  507. // echo "<tr>\n";
  508. // echo "<td valign='top' class='".$row_style[$c]."' >*".escape($row['extension'])."</td>\n";
  509. // echo "<td valign='top' class='".$row_style[$c]."' >".escape($row['call_length'])."</td>\n";
  510. // echo "<td valign='top' class='".$row_style[$c]."' >".escape($row['cid_name'])."</td>\n";
  511. // echo "<td valign='top' class='".$row_style[$c]."' >".escape($row['cid_num'])."</td>\n";
  512. // echo "</tr>\n";
  513. // }
  514. // }
  515. //}
  516. //echo "<table>\n";
  517. } //end permission
  518. echo "<br /><br />\n";
  519. if ($user_status == "Available (On Demand)") {
  520. $user_status = "Available_On_Demand";
  521. }
  522. $user_status = str_replace(" ", "_", $user_status);
  523. echo "<span id='db_user_status' style='visibility:hidden;'>".escape($user_status)."</span>\n";
  524. echo "<div id='cmd_reponse'>\n";
  525. echo "</div>\n";
  526. }
  527. ?>