Add SDK persistence and configurable edge location
All checks were successful
Create Release / build (push) Successful in 4s

- Add external SDK installation (wp-content/twilio-sdk/) that survives
  WordPress plugin updates
- Add install-twilio-sdk-external.sh script for external SDK setup
- Update SDK loading to check external location first, internal fallback
- Add post-update detection hook to warn if SDK was deleted
- Add configurable Twilio Edge Location setting (default: roaming)
- Fix US calls failing due to hardcoded Sydney edge location

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-23 18:03:38 -08:00
parent f0806d7e67
commit 3e4dff5c4e
7 changed files with 392 additions and 26 deletions

View File

@@ -8,11 +8,20 @@ This plugin **requires** the Twilio PHP SDK v8.7.0 to function. The plugin will
## Quick Installation
1. **Install the Twilio SDK** (Required):
1. **Install the Twilio SDK** (Required - Recommended Method):
```bash
chmod +x install-twilio-sdk-external.sh
./install-twilio-sdk-external.sh
```
This installs the SDK to `wp-content/twilio-sdk/` which **survives WordPress plugin updates**. The plugin will automatically detect and use this external SDK.
**Alternative Method** (SDK will be deleted during plugin updates):
```bash
chmod +x install-twilio-sdk.sh
./install-twilio-sdk.sh
```
This installs the SDK inside the plugin folder. You'll need to reinstall the SDK after each plugin update.
2. **Test the SDK installation**:
```bash
@@ -23,6 +32,7 @@ This plugin **requires** the Twilio PHP SDK v8.7.0 to function. The plugin will
- Go to **Twilio** → **Settings**
- Enter Account SID and Auth Token
- Configure default phone numbers
- Set Twilio Edge Location (for browser phone - see Browser Phone Setup below)
4. **Set up Phone Numbers** in Twilio Console:
- Configure webhook URLs for voice and SMS
@@ -333,8 +343,20 @@ Comprehensive redesign of hold, transfer, and requeue functionality with profess
2. **Configure in WordPress**:
- Go to **Twilio** → **Settings**
- Enter TwiML App SID
- **Set Twilio Edge Location**: Select the edge location closest to your users (IMPORTANT)
- **Auto-select closest (Recommended)**: Automatically selects the best edge
- **US East (Ashburn)**: For East Coast USA users
- **US West (Umatilla)**: For West Coast USA users
- **Europe - Ireland (Dublin)**: For European users
- **Europe - Germany (Frankfurt)**: For Central European users
- **Singapore**: For Southeast Asian users
- **Sydney**: For Australian users
- **Tokyo**: For Japanese users
- **Sao Paulo**: For South American users
- Save settings
**Note**: Selecting the wrong edge location can cause calls to fail immediately. If you're experiencing browser phone connection issues, verify your edge location is appropriate for your region.
3. **Access Browser Phone** (Admin Only):
- Navigate to **WordPress Admin** → **Twilio** → **Browser Phone**
- Select caller ID from available numbers
@@ -432,14 +454,34 @@ Access the full browser phone interface at: **WordPress Admin → Twilio → Bro
- **Login Required**: Users must be logged in to access browser phone functionality
- Check TwiML App SID is configured in WordPress admin settings
#### Browser Phone Calls Failing Immediately
If browser phone calls disconnect immediately or show HANGUP errors:
- **Check Edge Location Setting**: Go to **Twilio** → **Settings** → **Twilio Edge Location**
- **US Users**: Should use "Auto-select closest" (roaming), "US East (Ashburn)", or "US West (Umatilla)"
- **International Users**: Select the edge location closest to your region
- **Problem**: Wrong edge location causes gateway to immediately reject calls
- **Solution**: Change edge location setting and try the call again (no restart needed)
#### "Twilio SDK classes not available"
**Recommended Solution** (SDK survives plugin updates):
```bash
# Reinstall SDK
# Install SDK to external location
./install-twilio-sdk-external.sh
# Test installation
php test-sdk.php
```
**Alternative Solution** (will need reinstall after plugin updates):
```bash
# Install SDK inside plugin folder
./install-twilio-sdk.sh
# Test installation
php test-sdk.php
```
**After WordPress Plugin Update**: If you get this error after updating the plugin and used the internal SDK method, you'll need to reinstall the SDK. This won't happen if you use the external SDK method.
#### Calls Not Routing to Queues
- Verify queue exists and is active
- Check agent group has members
@@ -551,7 +593,19 @@ All webhooks are REST API endpoints under `/wp-json/twilio-webhook/v1/`:
## Version History
### v2.3.0 (Current - September 2025) - ENTERPRISE READY
### v2.8.9 (Current - January 2026) - SDK PERSISTENCE & BROWSER PHONE FIXES
- **SDK PERSISTENCE**: External SDK installation option that survives WordPress plugin updates
- New installation script: `install-twilio-sdk-external.sh` installs SDK to `wp-content/twilio-sdk/`
- Automatic detection: Plugin checks external SDK location first, falls back to internal
- Post-update warnings: Notifies if SDK was deleted during plugin update
- Zero downtime: Phone system continues working through plugin updates
- **BROWSER PHONE FIX**: Resolved US calls failing immediately with HANGUP errors
- Made Twilio Edge Location configurable (was hardcoded to Sydney)
- New setting: Twilio Edge Location with 8 options (roaming/auto-select, ashburn, umatilla, dublin, frankfurt, singapore, sydney, tokyo, sao-paulo)
- Default: "roaming" (auto-select closest edge for optimal performance)
- Critical fix: US users can now make calls successfully (were failing with Sydney edge)
### v2.3.0 (September 2025) - ENTERPRISE READY
- **SECURITY ENHANCEMENT**: Removed frontend browser phone interface, moved to admin-only access for enhanced security
- **ASSET REDUCTION**: Eliminated 108KB of frontend assets (browser-phone-frontend.js and CSS files)
- **SHORTCODE SECURITY**: Browser phone shortcode now provides secure redirect with authentication checks
@@ -611,4 +665,4 @@ This plugin integrates with Twilio services and requires a Twilio account.
---
**Enterprise Ready v2.3.0** - Extension transfers, browser phone compatibility, and automatic agent management now production-ready with comprehensive reliability improvements.
**Production Ready v2.8.9** - SDK persistence through plugin updates and configurable edge locations ensure zero-downtime phone operations.