Enhance browser phone with real-time updates and audible alerts

- Fix token expiration: Extend refresh buffer to 10 minutes for reliability
- Add real-time queue updates: Reduce polling to 5 seconds for instant feedback
- Implement audible alert system: 30-second repeating notifications with user toggle
- Optimize Discord/Slack notifications: Non-blocking requests for immediate delivery
- Add persistent alert preferences: Toggle button with localStorage integration
- Clean up debug file: Remove unused debug-phone-numbers.php

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-08-15 09:14:51 -07:00
parent 2cb9b9472d
commit d63eec129a
5 changed files with 223 additions and 104 deletions

View File

@@ -347,12 +347,14 @@ class TWP_Notifications {
* Send webhook request
*/
private static function send_webhook_request($webhook_url, $payload, $service) {
// Send notification immediately without blocking
$response = wp_remote_post($webhook_url, array(
'headers' => array(
'Content-Type' => 'application/json',
),
'body' => json_encode($payload),
'timeout' => 30,
'timeout' => 10, // Reduce timeout for faster processing
'blocking' => false, // Non-blocking request for immediate processing
));
if (is_wp_error($response)) {
@@ -360,15 +362,9 @@ class TWP_Notifications {
return false;
}
$response_code = wp_remote_retrieve_response_code($response);
if ($response_code >= 200 && $response_code < 300) {
error_log("TWP {$service} notification sent successfully");
return true;
} else {
error_log("TWP {$service} notification failed with response code: " . $response_code);
error_log("Response body: " . wp_remote_retrieve_body($response));
return false;
}
// For non-blocking requests, we can't check response code immediately
error_log("TWP {$service} notification sent (non-blocking)");
return true;
}
/**