<?php
require_once 'config.php';

// Log call status changes
$callSid = $_POST['CallSid'] ?? '';
$callStatus = $_POST['CallStatus'] ?? '';
$from = $_POST['From'] ?? '';
$to = $_POST['To'] ?? '';

if ($callSid && $callStatus) {
    // Log to file for debugging
    $logEntry = date('Y-m-d H:i:s') . " - Call SID: $callSid, Status: $callStatus, From: $from, To: $to\n";
    file_put_contents('call_status.log', $logEntry, FILE_APPEND);
    
    // You could also log to database here if needed
}

header('Content-Type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?><Response></Response>';
?>
