active_extensions_inc.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  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/pdo.php";
  24. require_once "resources/check_auth.php";
  25. //check permissions
  26. if (permission_exists('active_extension_view')) {
  27. //access granted
  28. }
  29. else {
  30. echo "access denied";
  31. exit;
  32. }
  33. //set debug to true or false
  34. $debug = false;
  35. //http get and set variables
  36. if (strlen($_GET['url']) > 0) {
  37. $url = $_GET['url'];
  38. }
  39. if (strlen($_GET['rows']) == 0) {
  40. $_GET['rows'] = 0;
  41. }
  42. //define variables
  43. $c = 0;
  44. $row_style["0"] = "row_style1";
  45. $row_style["1"] = "row_style1";
  46. //get the user status
  47. $sql = "select e.extension, u.username, u.user_status ";
  48. $sql .= "from v_users as u, v_extensions as e ";
  49. $sql .= "where e.domain_uuid = '$domain_uuid' ";
  50. $sql .= "and u.user_enabled = 'true' ";
  51. $sql .= "and u.domain_uuid = '$domain_uuid' ";
  52. //$sql = "select * ";
  53. //$sql .= "from v_extensions ";
  54. //$sql .= "where domain_uuid = '$domain_uuid' ";
  55. //$sql .= "and enabled = 'true' ";
  56. if (!(if_group("admin") || if_group("superadmin"))) {
  57. if (count($_SESSION['user']['extension']) > 0) {
  58. $sql .= "and (";
  59. $x = 0;
  60. foreach($_SESSION['user']['extension'] as $row) {
  61. if ($x > 0) { $sql .= "or "; }
  62. $sql .= "e.extension = '".$row['user']."' ";
  63. $x++;
  64. }
  65. $sql .= ")";
  66. }
  67. else {
  68. //hide any results when a user has not been assigned an extension
  69. $sql .= "and extension = 'disabled' ";
  70. }
  71. }
  72. $prep_statement = $db->prepare(check_sql($sql));
  73. $prep_statement->execute();
  74. $x = 0;
  75. $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
  76. foreach ($result as &$row) {
  77. if (strlen($row["user_status"]) > 0) {
  78. $user_array[$row["extension"]]['username'] = $row["username"];
  79. $user_array[$row["extension"]]['user_status'] = $row["user_status"];
  80. $username_array[$row["username"]]['user_status'] = $row["user_status"];
  81. if ($row["username"] == $_SESSION["username"]) {
  82. $user_status = $row["user_status"];
  83. }
  84. }
  85. $x++;
  86. }
  87. unset ($prep_statement, $x);
  88. //create the event socket connection
  89. $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
  90. //get information over event socket
  91. if (!$fp) {
  92. $msg = "<div align='center'>".$text['confirm-socket']."<br /></div>";
  93. echo "<div align='center'>\n";
  94. echo "<table width='40%'>\n";
  95. echo "<tr>\n";
  96. echo "<th align='left'>".$text['label-message']."</th>\n";
  97. echo "</tr>\n";
  98. echo "<tr>\n";
  99. echo "<td class='row_style1'><strong>$msg</strong></td>\n";
  100. echo "</tr>\n";
  101. echo "</table>\n";
  102. echo "</div>\n";
  103. }
  104. else {
  105. //get the agent list from event socket
  106. $switch_cmd = 'callcenter_config agent list';
  107. $event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
  108. $agent_array = csv_to_named_array($event_socket_str, '|');
  109. //set the status on the user_array by using the extension as the key
  110. foreach ($agent_array as $row) {
  111. if (count($_SESSION['domains']) == 1) {
  112. //get the extension status from the call center agent list
  113. preg_match('/user\/(\d{2,7})/', $row['contact'], $matches);
  114. $extension = $matches[1];
  115. $user_array[$extension]['username'] = $tmp[0];
  116. if ($user_array[$extension]['user_status'] != "Do Not Disturb") {
  117. $user_array[$extension]['user_status'] = $row['status'];
  118. }
  119. } else {
  120. $tmp = explode('@',$row["name"]);
  121. if ($tmp[1] == $_SESSION['domain_name']) {
  122. //get the extension status from the call center agent list
  123. preg_match('/user\/(\d{2,7})/', $row['contact'], $matches);
  124. $extension = $matches[1];
  125. $user_array[$extension]['username'] = $tmp[0];
  126. if ($user_array[$extension]['user_status'] != "Do Not Disturb") {
  127. $user_array[$extension]['user_status'] = $row['status'];
  128. }
  129. }
  130. }
  131. }
  132. //send the api command over event socket
  133. //$switch_cmd = 'valet_info';
  134. //$valet_xml_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
  135. //parse the xml
  136. //try {
  137. // $valet_xml = new SimpleXMLElement($valet_xml_str);
  138. //}
  139. //catch(Exception $e) {
  140. // //echo $e->getMessage();
  141. //}
  142. //$valet_xml = new SimpleXMLElement($valet_xml_str);
  143. //foreach ($valet_xml as $row) {
  144. // $valet_name = (string) $row->attributes()->name;
  145. // foreach ($row->extension as $row2) {
  146. // $extension = (string) $row2;
  147. // $uuid = (string) $row2->attributes()->uuid;
  148. // $uuid = trim($uuid);
  149. // $valet_array[$uuid]['name'] = $valet_name;
  150. // $valet_array[$uuid]['extension'] = $extension;
  151. // }
  152. //}
  153. //send the event socket command
  154. $switch_cmd = 'show channels as xml';
  155. $xml_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
  156. //parse the xml
  157. try {
  158. $xml = new SimpleXMLElement($xml_str);
  159. }
  160. catch(Exception $e) {
  161. //echo $e->getMessage();
  162. }
  163. //active channels array
  164. $x = 1;
  165. foreach ($xml as $row) {
  166. //set the original array id
  167. $channels_array[$x]['x'] = $x;
  168. //get the values from xml and set them to the channel array
  169. $channels_array[$x]['uuid'] = $row->uuid;
  170. $channels_array[$x]['direction'] = $row->direction;
  171. $channels_array[$x]['created'] = $row->created;
  172. $channels_array[$x]['created_epoch'] = $row->created_epoch;
  173. $channels_array[$x]['name'] = $row->name;
  174. $channels_array[$x]['state'] = $row->state;
  175. $channels_array[$x]['cid_name'] = $row->cid_name;
  176. $channels_array[$x]['cid_num'] = $row->cid_num;
  177. $channels_array[$x]['ip_addr'] = $row->ip_addr;
  178. $channels_array[$x]['dest'] = $row->dest;
  179. $channels_array[$x]['application'] = $row->application;
  180. $channels_array[$x]['application_data'] = $row->application_data;
  181. $channels_array[$x]['dialplan'] = $row->dialplan;
  182. $channels_array[$x]['context'] = $row->context;
  183. $channels_array[$x]['read_codec'] = $row->read_codec;
  184. $channels_array[$x]['read_rate'] = $row->read_rate;
  185. $channels_array[$x]['read_bit_rate'] = $row->read_bit_rate;
  186. $channels_array[$x]['write_codec'] = $row->write_codec;
  187. $channels_array[$x]['write_rate'] = $row->write_rate;
  188. $channels_array[$x]['write_bit_rate'] = $row->write_bit_rate;
  189. $channels_array[$x]['secure'] = $row->secure;
  190. $channels_array[$x]['hostname'] = $row->hostname;
  191. $channels_array[$x]['presence_id'] = $row->presence_id;
  192. $channels_array[$x]['presence_data'] = $row->presence_data;
  193. $channels_array[$x]['callstate'] = $row->callstate;
  194. $channels_array[$x]['callee_name'] = $row->callee_name;
  195. $channels_array[$x]['callee_num'] = $row->callee_num;
  196. $channels_array[$x]['callee_direction'] = $row->callee_direction;
  197. $channels_array[$x]['call_uuid'] = $row->call_uuid;
  198. //remove other domains
  199. if (count($_SESSION["domains"]) > 1) {
  200. //unset domains that are not related to this tenant
  201. $temp_array = explode("@", $channels_array[$x]['presence_id']);
  202. if ($temp_array[1] != $_SESSION['domain_name']) {
  203. unset($channels_array[$x]);
  204. }
  205. }
  206. //parse some of the php variables\
  207. $temp_array = explode("@", $channels_array[$x]['presence_id']);
  208. $channels_array[$x]['number'] = $temp_array[0];
  209. //remove the '+' because it breaks the call recording
  210. $channels_array[$x]['cid_num'] = $temp_array[0] = str_replace("+", "", $channels_array[$x]['cid_num']);
  211. //calculate and set the call length
  212. $call_length_seconds = time() - $channels_array[$x]['created_epoch'];
  213. $call_length_hour = floor($call_length_seconds/3600);
  214. $call_length_min = floor($call_length_seconds/60 - ($call_length_hour * 60));
  215. $call_length_sec = $call_length_seconds - (($call_length_hour * 3600) + ($call_length_min * 60));
  216. $call_length_min = sprintf("%02d", $call_length_min);
  217. $call_length_sec = sprintf("%02d", $call_length_sec);
  218. $call_length = $call_length_hour.':'.$call_length_min.':'.$call_length_sec;
  219. $channels_array[$x]['call_length'] = $call_length;
  220. //valet park
  221. //if (is_array($valet_array[$uuid])) {
  222. // $valet_array[$uuid]['context'] = $channels_array[$x]['context'];
  223. // $valet_array[$uuid]['cid_name'] = $channels_array[$x]['cid_name'];
  224. // $valet_array[$uuid]['cid_num'] = $channels_array[$x]['cid_num'];
  225. // $valet_array[$uuid]['call_length'] = $call_length;
  226. //}
  227. //increment the array index
  228. $x++;
  229. }
  230. //active extensions
  231. //get the extension information
  232. if (!empty($debug)) {
  233. unset($_SESSION['extension_array']);
  234. }
  235. if (empty($_SESSION['extension_array'])) {
  236. $sql = "";
  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. $prep_statement = $db->prepare(check_sql($sql));
  265. $prep_statement->execute();
  266. $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
  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. ?>