Vicidial index.php
setInterval(function() {
recheckVDAI_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&campaign=" + campaign + "&ACTION=VDADREcheckINCOMING" + "&agent_log_id=" + agent_log_id + "&lead_id=" + document.vicidial_form.lead_id.value;
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
if(this.responseText==1){
AutoDial_ReSume_PauSe('VDADready');
}
}
};
xhttp.open("GET", "auto_ready.php?"+recheckVDAI_query, true);
xhttp.send();
}, 30000);
auto_ready.php
$servername = "localhost";
$username = "cron";
$password = "1234";
$dbname = "asterisk";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "select * from vicidial_live_agents where status='PAUSED' and pause_code='DCMX' and user='".$_GET['user']."'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
$result = $conn->query($sql); $resultu = $conn->query("update vicidial_live_agents set status='READY' where user='".$_GET['user']."' and status='PAUSED' and pause_code='DCMX'");
echo "1";
} else {
echo "0 results";
}
$conn->close();