<?php
/**
 * Test VoIP Notifications
 * 
 * A simple script to test the VoIP notification functionality
 */

require_once('config/database.php');
require_once('classes/VoIPNotificationService.php');
require_once('config/voip_settings.php');

echo "Testing VoIP Notification System...\n";
echo "==================================\n";

// Create VoIP notification service instance
$voipService = new VoIPNotificationService($pdo);

// Test sending a notification
$testPhone = "8801712345678"; // Test phone number
$testMessage = "অধ্যাপক, আপনার ক্লাস শুরু হবে অথবা চলছে: গণিত - একাদশ শ্রেণি ক। সময়: ১০:০০ AM - ১১:০০ AM। অনুগ্রহ করে ক্লাসে উপস্থিত থাকুন।";

echo "Sending test notification to: $testPhone\n";
echo "Message: $testMessage\n";

$result = $voipService->sendVoIPNotification($testPhone, $testMessage);

echo "\nResult:\n";
echo "Success: " . ($result['success'] ? 'Yes' : 'No') . "\n";
echo "Message: " . $result['message'] . "\n";
echo "Timestamp: " . $result['timestamp'] . "\n";

// Test checking for upcoming classes
echo "\nChecking for upcoming classes...\n";
$checkResult = $voipService->checkAndSendNotifications();

echo "Classes found: " . $checkResult['classes_found'] . "\n";
echo "Notifications sent: " . $checkResult['notifications_sent'] . "\n";
echo "Notifications failed: " . $checkResult['notifications_failed'] . "\n";

echo "\nTest completed successfully!\n";
?>