Fork of FusionPBX but with LDAP kinda working
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
2.5 KiB

2 years ago
  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 <markjcrane@fusionpbx.com>
  16. Portions created by the Initial Developer are Copyright (C) 2008-2019
  17. the Initial Developer. All Rights Reserved.
  18. Contributor(s):
  19. Mark J Crane <markjcrane@fusionpbx.com>
  20. */
  21. //includes
  22. include "root.php";
  23. require_once "resources/require.php";
  24. require_once "resources/check_auth.php";
  25. //check permissions
  26. if (permission_exists('call_active_view')) {
  27. //access granted
  28. }
  29. else {
  30. echo "access denied";
  31. exit;
  32. }
  33. //add multi-lingual support
  34. $language = new text;
  35. $text = $language->get();
  36. //authorized referrer
  37. if (stristr($_SERVER["HTTP_REFERER"], '/calls_active.php') === false) {
  38. echo "access denied";
  39. exit;
  40. }
  41. //authorized commands
  42. if ($_REQUEST['action'] == 'hangup' && permission_exists('call_active_hangup')) {
  43. //validate the token
  44. $token = new token;
  45. if (!$token->validate('/app/calls_active/calls_active_inc.php')) {
  46. message::add($text['message-invalid_token'],'negative');
  47. header('Location: calls_active.php');
  48. exit;
  49. }
  50. //verify submitted call uuids
  51. if (is_array($_POST['calls']) && @sizeof($_POST['calls']) != 0) {
  52. foreach ($_POST['calls'] as $call) {
  53. if ($call['checked'] == 'true' && is_uuid($call['uuid'])) {
  54. $calls[] = $call['uuid'];
  55. }
  56. }
  57. }
  58. if (is_uuid($_REQUEST['uuid'])) {
  59. $calls[] = $_REQUEST['uuid'];
  60. }
  61. //iterate through calls
  62. if (is_array($calls) && @sizeof($calls) != 0) {
  63. //setup the event socket connection
  64. $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
  65. //execute hangup command
  66. foreach ($calls as $call_uuid) {
  67. $switch_result = event_socket_request($fp, 'api uuid_kill '.$call_uuid);
  68. }
  69. //set message
  70. message::add($text['message-calls_ended'].': '.@sizeof($calls),'positive');
  71. }
  72. //redirect
  73. header('Location: calls_active.php');
  74. exit;
  75. }
  76. else {
  77. echo "access denied";
  78. exit;
  79. }
  80. ?>