active_extensions_inc.php 23 KB

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