<?php
/**
* @file
* for making call to play message
*/
chdir('..');
include_once('./includes/bootstrap.php');
if (!isset($_SESSION['ari_user']['recfiles'][$_REQUEST['recindex']])) {
die; // Disable anonymous or malicious access.
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Voicemail Message Call Me Control</title>
<link rel="stylesheet" href="../theme/main.css" type="text/css">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<?php
// Database login:
if (databaseLogon()) {
$extension = $_SESSION['ari_user']['extension'];
// Either start or end the call me call:
if ($_REQUEST['action'] === 'c') {
// Call me and display hang-up button if successful:
$recfile_path = $_SESSION['ari_user']['recfiles'][$_REQUEST['recindex']];
$recfile_path = substr($recfile_path, 0, -4); // Without the sound file extension.
$callme_num = callme_getnum($extension);
$call_status = callme_startcall($callme_num, $extension, $recfile_path);
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">';
if (callme_succeeded($call_status)) {
echo '<a href="callme_page.php?action=h">Click here to hang up.</a>';
}
echo '</td></tr></table>';
echo '<script language="javascript">';
echo 'parent.document.getElementById("callme_status").innerHTML = "'. _($call_status) .'";';
echo 'parent.document.getElementById("callme_status").parentNode.style.backgroundColor = "white";';
echo 'parent.document.getElementById("pb_load_inprogress").value = "false";';
echo '</script>';
} else if ($_REQUEST['action'] === 'h') {
// Find the channel and hang it up if it still exists:
callme_hangup($extension);
echo '<script language="javascript">parent.document.getElementById("callme_status").innerHTML = "'. _("The call was terminated.") .'"; </script>';
}
} else {
// Database login failed:
echo 'Unable to connect to Asterisk Manager Interface';
}
// Database logoff:
databaseLogoff();
?>
</body>
</html>