Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

callme_page.php FreePBX Patch

By: a guest on Mar 16th, 2012  |  syntax: PHP  |  size: 2.63 KB  |  views: 1,183  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.  
  3. /**
  4.  * @file
  5.  * for making call to play message
  6.  */
  7.  
  8. chdir('..');
  9. include_once('./includes/bootstrap.php');
  10.  
  11. if (!isset($_SESSION['ari_user']['recfiles'][$_REQUEST['recindex']])) {
  12.         die; // Disable anonymous or malicious access.
  13. }
  14. ?>
  15.  
  16. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  17. <html xmlns="http://www.w3.org/1999/xhtml">
  18. <head>
  19.         <title>Voicemail Message Call Me Control</title>
  20.         <link rel="stylesheet" href="../theme/main.css" type="text/css">
  21.         <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  22. </head>
  23. <body>
  24. <?php
  25.  
  26. // Database login:
  27. if (databaseLogon()) {
  28.         $extension = $_SESSION['ari_user']['extension'];
  29.        
  30.         // Either start or end the call me call:
  31.         if ($_REQUEST['action'] === 'c') {
  32.        
  33.                 // Call me and display hang-up button if successful:
  34.                 $recfile_path = $_SESSION['ari_user']['recfiles'][$_REQUEST['recindex']];
  35.                 $recfile_path = substr($recfile_path, 0, -4); // Without the sound file extension.
  36.                 $callme_num = callme_getnum($extension);
  37.                 $call_status = callme_startcall($callme_num, $extension, $recfile_path);
  38.                
  39.                 echo '<table class="voicemail" style="width: 100%; height: 100%; margin: 0 0 0 0; border: 0px; padding: 0px"><tr><td valign="middle" style="border: 0px">';
  40.                 if (callme_succeeded($call_status)) {
  41.                         echo '<a href="callme_page.php?action=h">Click here to hang up.</a>';
  42.                 }
  43.                 echo '</td></tr></table>';
  44.                
  45.                 echo '<script language="javascript">';
  46.                 echo 'parent.document.getElementById("callme_status").innerHTML = "'. _($call_status) .'";';
  47.                 echo 'parent.document.getElementById("callme_status").parentNode.style.backgroundColor = "white";';
  48.                 echo 'parent.document.getElementById("pb_load_inprogress").value = "false";';
  49.                 echo '</script>';
  50.                
  51.         } else if ($_REQUEST['action'] === 'h') {
  52.        
  53.                 // Find the channel and hang it up if it still exists:
  54.                 callme_hangup($extension);
  55.                 echo '<script language="javascript">parent.document.getElementById("callme_status").innerHTML = "'. _("The call was terminated.") .'"; </script>';
  56.         }
  57.        
  58. } else {
  59.         // Database login failed:
  60.         echo 'Unable to connect to Asterisk Manager Interface';
  61. }
  62.  
  63. // Database logoff:
  64. databaseLogoff();
  65. ?>
  66. </body>
  67. </html>