index.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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-2012
  17. the Initial Developer. All Rights Reserved.
  18. Contributor(s):
  19. Mark J Crane <[email protected]>
  20. */
  21. include "root.php";
  22. require_once "resources/require.php";
  23. require_once "resources/check_auth.php";
  24. if (permission_exists('get_call_details') || if_group("superadmin")) {
  25. //access granted
  26. }
  27. else {
  28. echo "access denied";
  29. exit;
  30. }
  31. //get_call_details
  32. //get the call details for all calls or all active calls
  33. //usage
  34. //http://x.x.x.x/app/get_call_details/index.php?dest=101&username=example&password=1234
  35. $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
  36. if (!$fp) {
  37. $msg['error']['message'] = "Connection to Event Socket failed.";
  38. echo json_encode($row);
  39. }
  40. $response = trim(event_socket_request($fp, "api show calls"));
  41. $response = explode("\n\n", $response);
  42. $response_array = csv_to_named_array($response[0], ',');
  43. unset($response);
  44. if (isset($_REQUEST['dest'])) {
  45. foreach ($response_array as $row) {
  46. if ($row['dest'] == trim($_REQUEST['dest'])) {
  47. echo json_encode($row);
  48. }
  49. }
  50. }
  51. else {
  52. echo json_encode($response_array);
  53. }
  54. ?>