- Updated shortcode to redirect to admin browser phone page for enhanced security - Removed frontend browser phone assets (108KB total): - assets/js/browser-phone-frontend.js (85KB) - assets/css/browser-phone-frontend.css (23KB) - Modified shortcode to show secure redirect interface with authentication checks - Added new shortcode attributes: title, button_text, target - Enhanced documentation with security improvements and new behavior - Reduced frontend attack surface by eliminating JavaScript exposure - Improved performance with minimal asset loading for shortcode pages 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
614 lines
30 KiB
Markdown
614 lines
30 KiB
Markdown
# Twilio WordPress Plugin
|
|
|
|
A comprehensive WordPress plugin for Twilio voice and SMS integration with advanced call center functionality.
|
|
|
|
## ⚠️ IMPORTANT: SDK Required
|
|
|
|
This plugin **requires** the Twilio PHP SDK v8.7.0 to function. The plugin will not work without it.
|
|
|
|
## Quick Installation
|
|
|
|
1. **Install the Twilio SDK** (Required):
|
|
```bash
|
|
chmod +x install-twilio-sdk.sh
|
|
./install-twilio-sdk.sh
|
|
```
|
|
|
|
2. **Test the SDK installation**:
|
|
```bash
|
|
php test-sdk.php
|
|
```
|
|
|
|
3. **Configure Twilio Credentials** in WordPress admin:
|
|
- Go to **Twilio** → **Settings**
|
|
- Enter Account SID and Auth Token
|
|
- Configure default phone numbers
|
|
|
|
4. **Set up Phone Numbers** in Twilio Console:
|
|
- Configure webhook URLs for voice and SMS
|
|
- Voice: `https://yoursite.com/wp-json/twilio-webhook/v1/voice`
|
|
- SMS: `https://yoursite.com/wp-json/twilio-webhook/v1/sms`
|
|
|
|
## Requirements
|
|
|
|
- **PHP 8.0+** (required for Twilio SDK v8.7.0)
|
|
- **WordPress 5.0+**
|
|
- **Twilio Account** with active phone number
|
|
- **curl** and **tar** (for SDK installation)
|
|
|
|
## Key Features
|
|
|
|
### 📞 Call Center Operations
|
|
- **Agent Groups**: Organize agents into groups with priority levels
|
|
- **Call Queues**: Manage incoming calls with position announcements
|
|
- **Smart Routing**: Distribute calls based on availability and schedules
|
|
- **SMS Accept**: Agents can text "1" to accept incoming calls
|
|
- **Queue Notifications**: SMS alerts to designated numbers when calls enter queues
|
|
|
|
### 🌐 Browser Phone (WebRTC)
|
|
- **Admin-Only Access**: Secure browser phone interface available only in WordPress admin area
|
|
- **Enhanced Security**: All browser phone functionality moved from frontend for improved security
|
|
- **Twilio Voice SDK v2**: Uses latest SDK for WebRTC functionality
|
|
- **Visual Dialpad**: Click-to-dial interface with DTMF support
|
|
- **Call Controls**: Mute, hold indicators, call timer
|
|
- **Auto-Answer**: Optional automatic call acceptance
|
|
- **Queue Integration**: Accept calls from specific queues
|
|
- **Token Management**: Automatic token refresh for uninterrupted service
|
|
- **Mobile-Friendly**: Responsive design optimized for smartphones and tablets
|
|
- **Shortcode Redirect**: `[twp_browser_phone]` shortcode provides secure redirect to admin interface
|
|
|
|
### 🕒 Business Hours Management
|
|
- **Schedule-based Routing**: Different call flows for business hours vs after-hours
|
|
- **Holiday Support**: Define specific dates for holiday routing
|
|
- **Multiple Schedules**: Create different schedules for departments
|
|
- **After-Hours Actions**: Configurable routing when closed
|
|
|
|
### 🎛️ Workflow Builder
|
|
- **Visual Interface**: Drag-and-drop workflow creation
|
|
- **Step Types**:
|
|
- **Greeting**: Welcome messages with multiple voice options
|
|
- **IVR Menu**: Interactive voice response with digit collection
|
|
- **Call Queue**: Place callers in queue with hold music
|
|
- **Forward**: Route calls to specific numbers
|
|
- **Voicemail**: Record messages with transcription
|
|
- **Schedule Check**: Route based on business hours
|
|
- **Voice Options**:
|
|
- Default Twilio voice (Say)
|
|
- ElevenLabs text-to-speech integration with voice persistence
|
|
- Custom audio file URLs
|
|
- **Smart Voice Loading**: Saved voices display without API calls
|
|
|
|
### 📱 SMS Integration
|
|
- **Agent Notifications**: Automatic SMS alerts when calls arrive
|
|
- **Queue Management**: Agents receive queue status updates
|
|
- **Command System**: Text commands to manage availability
|
|
- **SMS Logging**: Complete history of all SMS interactions
|
|
|
|
### 🔔 Discord & Slack Notifications
|
|
- **Real-time Alerts**: Instant notifications to Discord channels and Slack workspaces
|
|
- **Multiple Event Types**: Incoming calls, queue timeouts, and missed calls
|
|
- **Rich Formatting**: Structured messages with caller info, queue details, and timestamps
|
|
- **Webhook Integration**: Simple configuration with webhook URLs
|
|
- **Configurable Options**: Enable/disable specific notification types
|
|
- **Automatic Monitoring**: Background checks for queue timeout situations
|
|
|
|
### 📊 Real-time Dashboard
|
|
- **Queue Monitor**: Live view of waiting calls
|
|
- **Agent Status**: Track agent availability
|
|
- **Call Statistics**: Performance metrics and reporting
|
|
- **Call Logs**: Detailed history with filtering options
|
|
- **Active Call Display**: Real-time call count monitoring
|
|
|
|
### 🎤 Advanced Features
|
|
- **Voicemail Transcription**: Automatic speech-to-text
|
|
- **Callback System**: Offer callbacks instead of long holds
|
|
- **Outbound Calling**: Click-to-call with proper caller ID
|
|
- **Multiple Phone Numbers**: Support for multiple business lines per workflow
|
|
- **Agent Phone Management**: Store and validate agent phone numbers
|
|
- **Duplicate Prevention**: Ensures unique phone numbers per agent
|
|
- **Enhanced Notifications**: Discord and Slack integration for real-time alerts
|
|
- **Premium Voice Synthesis**: ElevenLabs TTS integration for professional-grade voice prompts
|
|
- **Automatic Queue Creation**: Personal and hold queues created automatically for all agents
|
|
- **Smart Extension System**: Unique 3-4 digit extensions auto-assigned for direct dialing
|
|
|
|
## Recent Updates
|
|
|
|
### MAJOR RELEASE v2.3.0 (September 2025) - Enterprise Ready
|
|
Comprehensive system overhaul with production-ready reliability improvements and enhanced security.
|
|
|
|
#### 🔒 Security Enhancement: Frontend Browser Phone Removal
|
|
- **Security-First Approach**: Removed full browser phone interface from frontend shortcode
|
|
- **Admin-Only Access**: All browser phone functionality now restricted to secure WordPress admin area
|
|
- **Asset Reduction**: Eliminated 108KB of frontend assets (browser-phone-frontend.js and CSS)
|
|
- **Reduced Attack Surface**: Minimized frontend JavaScript exposure and potential security vectors
|
|
- **Performance Boost**: Improved page load times with reduced frontend asset loading
|
|
- **Professional Redirect**: Shortcode now provides clean redirect interface to admin browser phone
|
|
|
|
#### 🚀 Extension Transfer System - Complete Solution
|
|
- **FIXED: Direct Voicemail Issue**: Extension transfers no longer go directly to voicemail for available agents
|
|
- **Queue-Based System**: Replaced active client dialing with intelligent queue-based routing
|
|
- **2-Minute Timeout**: Automatic voicemail fallback ensures no calls are lost
|
|
- **Agent Detection**: Enhanced availability checking works perfectly with browser phone users
|
|
- **Professional Experience**: "Please hold while we connect you to extension X" messaging
|
|
- **Reliability**: Enterprise-grade call routing with comprehensive fallback mechanisms
|
|
- **Zero Configuration**: Works automatically without any manual setup required
|
|
|
|
#### 🌍 Browser Phone - Universal Compatibility
|
|
- **Firefox Support**: Fixed compatibility issues with explicit microphone/speaker permission handling
|
|
- **Permission System**: Automatic permission requests prevent silent call failures
|
|
- **Call Stability**: Resolved disconnections during transfers and call operations
|
|
- **Cross-Browser**: Tested and verified on Chrome, Firefox, Safari, and Edge
|
|
- **Error Recovery**: Clear error messages and automatic reconnection capabilities
|
|
- **Mobile Enhanced**: Improved mobile browser compatibility and user experience
|
|
- **Client Consistency**: Fixed mismatch between capability tokens and call acceptance
|
|
|
|
#### ⏱️ Automatic Agent Status Management - Smart Productivity
|
|
- **1-Minute Auto-Revert**: Agents automatically return to available status after 1 minute in busy state
|
|
- **Productivity Boost**: Prevents agents from staying busy indefinitely after calls
|
|
- **Smart Automation**: WordPress cron job handles status management in background
|
|
- **Database Enhanced**: New auto_busy_at column tracks automatic status changes
|
|
- **Manual Override**: Agent-initiated status changes still respected
|
|
- **Zero Maintenance**: Fully automated system requires no administrative intervention
|
|
|
|
#### 📊 Call Statistics - Complete Accuracy
|
|
- **Browser Phone Tracking**: All browser phone calls now appear in agent statistics
|
|
- **Enhanced Logging**: Improved call data storage with structured JSON format
|
|
- **Customer Detection**: Advanced identification system for complex call scenarios
|
|
- **Real-Time Updates**: Statistics dashboards show accurate real-time metrics
|
|
- **Performance Insights**: Detailed tracking of browser phone usage and efficiency
|
|
|
|
#### 🎧 Voicemail & Transcription - Professional Grade
|
|
- **Real Transcription**: Replaced placeholder system with actual Twilio API integration
|
|
- **Manual Requests**: Ability to request transcriptions for existing voicemails
|
|
- **Extension Support**: Enhanced voicemail handling for extension-based systems
|
|
- **Customer Identification**: Improved customer number detection for all voicemail scenarios
|
|
- **Professional Audio**: ElevenLabs TTS integration for voicemail prompts
|
|
|
|
#### 🛠️ Technical Improvements
|
|
- **Database Migration**: Automatic schema updates to version 1.6.2
|
|
- **Error Handling**: Comprehensive error recovery throughout all systems
|
|
- **Logging Enhanced**: Detailed debugging information for troubleshooting
|
|
- **Performance**: Optimized cron jobs and background processing
|
|
- **Compatibility**: Universal browser support with fallback mechanisms
|
|
|
|
### MAJOR: Complete Call Control System Overhaul (September 2025)
|
|
Comprehensive redesign of hold, transfer, and requeue functionality with professional-grade reliability.
|
|
|
|
#### 🎯 Hold Function - Complete Solution
|
|
- **Problem Solved**: "Queue not found" errors that prevented calls from being put on hold
|
|
- **Automatic Setup**: Personal and hold queues are now created automatically for all agents
|
|
- **Smart Extensions**: Unique 3-4 digit extensions (100-9999) auto-assigned to each agent
|
|
- **Seamless Experience**: Works immediately without any manual queue setup
|
|
- **Premium Audio**: Professional hold messages using ElevenLabs voices (with fallback to Twilio)
|
|
- **Browser Phone Ready**: Handles complex call scenarios from browser phone users
|
|
|
|
#### 📞 Transfer Function - Professional Grade
|
|
- **Audio Quality Fixed**: Eliminated customers hearing technical webhook URLs during transfers
|
|
- **Multiple Transfer Types**: Extension transfers, queue transfers, browser phone transfers, and external number transfers all work perfectly
|
|
- **Professional Announcements**: "Transferring to extension 101" and "Transferring your call" messages
|
|
- **Smart Detection**: Automatically identifies the correct call to transfer (customer, not agent)
|
|
- **Outbound Call Support**: Transfer functionality now works for both incoming and outgoing calls
|
|
- **Enhanced Reliability**: Comprehensive error handling prevents transfer failures
|
|
|
|
#### 🔄 Requeue Function - Seamless Operation
|
|
- **User Experience Fixed**: Customers now hear "Placing you back in the queue" instead of technical errors
|
|
- **Proper Queue Integration**: Seamless integration with queue waiting experience and hold music
|
|
- **Call Preservation**: Maintains call history and position tracking when requeuing
|
|
- **Professional Audio**: Uses same premium voice technology as other functions
|
|
- **Database Consistency**: Works with all database schemas and maintains data integrity
|
|
|
|
### CRITICAL: Outbound Call Issues Fixed (September 2025)
|
|
- **Customer Disconnection Issue Resolved**: Fixed major problem where hold, transfer, and requeue functions were disconnecting customers in outbound calls
|
|
- **Call Leg Detection System**: New intelligent system identifies customer vs agent call legs in complex call topologies
|
|
- **Browser Phone Transfers**: Fixed "Invalid phone number format" errors when transferring to browser phone agents
|
|
- **Outbound Call Stability**: All call control functions now work correctly for both inbound and outbound scenarios
|
|
- **Enhanced Logging**: Comprehensive debugging for call relationship tracking
|
|
|
|
### Customer Number Detection Improvements (September 2025)
|
|
- **Voicemail Interface Fix**: Customer numbers now display correctly instead of showing "client:agentname" for browser phone calls
|
|
- **Call Recording Interface Fix**: Recording admin interface now shows actual customer phone numbers for all call types
|
|
- **Smart Number Detection**: Enhanced fallback logic retrieves customer numbers from call logs and parent call analysis
|
|
- **Browser Phone Support**: Proper handling of complex call topologies created by browser phone calls
|
|
- **User Experience**: Admin interfaces now consistently display meaningful customer information
|
|
|
|
### Browser Phone Upgrade (v2.0 → v2.3.0)
|
|
- **Universal Browser Support**: Firefox, Chrome, Safari, and Edge fully supported
|
|
- **Permission Management**: Automatic microphone/speaker access with user-friendly prompts
|
|
- **Stability Enhanced**: Eliminated call disconnections during transfers and operations
|
|
- **Client Consistency**: Standardized naming prevents connection mismatches
|
|
- **Mobile Optimized**: Enhanced mobile browser compatibility
|
|
- **Error Recovery**: Intelligent reconnection and clear error messaging
|
|
- **Migrated to Twilio Voice SDK v2**: Modern WebRTC with automatic token refresh
|
|
|
|
### Queue System Improvements
|
|
- **Notification Numbers**: Queues now use notification_number field for SMS alerts
|
|
- **No Direct Assignment**: Queues are workflow destinations, not directly assigned to numbers
|
|
- **Better Integration**: Improved queue handling in IVR and workflow steps
|
|
|
|
### Voice Configuration Enhancements
|
|
- **Voice Persistence**: ElevenLabs voices save both ID and name
|
|
- **No Unnecessary API Calls**: Saved voices display immediately without loading
|
|
- **Improved UX**: Load voices only when changing selection
|
|
|
|
### IVR Fixes
|
|
- **Form Field Handling**: Fixed IVR option saving and loading
|
|
- **Queue Selection**: Proper queue routing based on digit selection
|
|
- **Voice Selection**: Fixed voice dropdown persistence issues
|
|
|
|
### Multiple Phone Numbers Support
|
|
- **Workflow Enhancement**: Workflows can now be assigned to multiple phone numbers
|
|
- **Junction Table**: New `twp_workflow_phones` table for many-to-many relationships
|
|
- **Backward Compatibility**: Existing single-number workflows continue to work
|
|
- **Validation Fixes**: Proper validation for multiple phone number selections
|
|
|
|
### Discord & Slack Notifications
|
|
- **Real-time Integration**: Instant notifications to Discord channels and Slack workspaces
|
|
- **Event Monitoring**: Automated tracking of incoming calls, queue timeouts, and missed calls
|
|
- **Rich Message Format**: Structured notifications with caller details, queue info, and timestamps
|
|
- **Configurable Settings**: Toggle notification types and set custom webhook URLs
|
|
- **Background Processing**: Cron-based monitoring for queue timeout alerts
|
|
|
|
## How It Works
|
|
|
|
### Call Flow
|
|
1. **Incoming Call** → Twilio webhook triggers
|
|
2. **Workflow Processing** → System loads assigned workflow
|
|
3. **Step Execution** → Each workflow step processes sequentially:
|
|
- Greeting plays welcome message
|
|
- IVR collects user input
|
|
- Schedule check determines routing
|
|
- Queue or forward based on configuration
|
|
4. **Agent Connection** → Call routed to available agent
|
|
5. **Logging** → All interactions logged for reporting
|
|
|
|
### Queue System
|
|
- **Queue Assignment**: Calls routed to queues through workflows
|
|
- **Notification Numbers**: Optional SMS alerts to designated numbers (not agents)
|
|
- **Agent Groups**: Queues linked to agent groups for distribution
|
|
- **Wait Experience**: Configurable hold music and position announcements
|
|
- **Timeout Handling**: Automatic callback offers after timeout
|
|
- **Browser Phone Integration**: Agents can accept queue calls via browser
|
|
|
|
### Agent Management
|
|
- **Phone Number Storage**: Agent numbers stored in WordPress user profiles
|
|
- **Status Tracking**: Available/Busy/Offline states
|
|
- **SMS Commands**: Text "1" to accept calls
|
|
- **Priority Levels**: Agents have priority within groups
|
|
- **Browser Phone Mode**: Option to receive calls in browser or cell phone
|
|
|
|
## Configuration
|
|
|
|
### Initial Setup
|
|
1. **Install Plugin** and activate in WordPress
|
|
2. **Install Twilio SDK** using provided script
|
|
3. **Configure Credentials**:
|
|
- Navigate to **Twilio** → **Settings**
|
|
- Enter Twilio Account SID and Auth Token
|
|
- Set default SMS number for notifications
|
|
- Configure TwiML App SID for browser phone (optional)
|
|
|
|
### Phone Number Setup
|
|
1. **In Twilio Console**:
|
|
- Purchase or select phone number
|
|
- Configure Voice webhook: `https://yoursite.com/wp-json/twilio-webhook/v1/voice`
|
|
- Configure SMS webhook: `https://yoursite.com/wp-json/twilio-webhook/v1/sms`
|
|
- Set method to HTTP POST
|
|
|
|
2. **In WordPress Admin**:
|
|
- Go to **Twilio** → **Phone Numbers**
|
|
- Verify numbers are synchronized
|
|
- Assign workflows to numbers (multiple numbers per workflow supported)
|
|
|
|
### Creating Workflows
|
|
1. **Navigate to** Twilio → Workflows
|
|
2. **Create New Workflow**:
|
|
- Name your workflow
|
|
- Select phone numbers to assign (multiple selection supported)
|
|
- Add steps using the builder
|
|
|
|
3. **Configure Steps**:
|
|
- **Greeting**: Set welcome message and voice
|
|
- **IVR Menu**: Define options and routing
|
|
- **Queue**: Select target queue
|
|
- **Schedule**: Choose business hours schedule
|
|
|
|
### Setting Up Queues
|
|
1. **Create Queue** (Twilio → Queues):
|
|
- Queue Name: Descriptive name
|
|
- Notification Number: SMS alerts for queue activity (optional)
|
|
- Agent Group: Select assigned group
|
|
- Wait Music: URL for hold music
|
|
- Timeout: Maximum wait time
|
|
|
|
2. **Use in Workflows**:
|
|
- Add Queue step to workflow
|
|
- Select queue from dropdown
|
|
- Configure announcement message
|
|
|
|
### Browser Phone Setup
|
|
1. **Create TwiML App** in Twilio Console:
|
|
- Voice Request URL: Your server's TwiML endpoint
|
|
- Copy the Application SID
|
|
|
|
2. **Configure in WordPress**:
|
|
- Go to **Twilio** → **Settings**
|
|
- Enter TwiML App SID
|
|
- Save settings
|
|
|
|
3. **Access Browser Phone** (Admin Only):
|
|
- Navigate to **WordPress Admin** → **Twilio** → **Browser Phone**
|
|
- Select caller ID from available numbers
|
|
- Start making/receiving calls
|
|
|
|
4. **Frontend Access** (Optional):
|
|
- Use `[twp_browser_phone]` shortcode on any page
|
|
- Shortcode provides secure redirect to admin interface
|
|
- Requires user login and appropriate permissions
|
|
|
|
### Agent Configuration
|
|
1. **Create Agent Groups** (Twilio → Agent Groups)
|
|
2. **Add Agents** to groups with priorities
|
|
3. **Set Phone Numbers** in user profiles
|
|
4. **Configure Call Mode**: Browser or cell phone
|
|
5. **Train Agents** on SMS commands and browser phone
|
|
|
|
### Discord & Slack Setup
|
|
1. **Discord Configuration**:
|
|
- Create a webhook URL in your Discord server settings
|
|
- Navigate to **Twilio** → **Settings** → **Notifications**
|
|
- Paste Discord webhook URL
|
|
- Enable desired notification types
|
|
|
|
2. **Slack Configuration**:
|
|
- Create a webhook URL in your Slack workspace
|
|
- Navigate to **Twilio** → **Settings** → **Notifications**
|
|
- Paste Slack webhook URL
|
|
- Configure notification preferences
|
|
|
|
3. **Notification Types**:
|
|
- **Incoming Calls**: Alert when calls enter queues
|
|
- **Queue Timeouts**: Alert when calls wait too long (configurable threshold)
|
|
- **Missed Calls**: Alert when calls are abandoned or timeout
|
|
|
|
## Browser Phone Access
|
|
|
|
### Shortcode Usage (Redirect Interface)
|
|
The `[twp_browser_phone]` shortcode now provides a **secure redirect interface** that directs users to the WordPress admin browser phone page for enhanced security.
|
|
|
|
**Basic Usage:**
|
|
```
|
|
[twp_browser_phone]
|
|
```
|
|
|
|
**With Custom Options:**
|
|
```
|
|
[twp_browser_phone title="Customer Service Phone" button_text="Access Phone System" target="_blank"]
|
|
```
|
|
|
|
### Shortcode Parameters
|
|
- **title**: Custom title for the redirect interface (default: "Browser Phone")
|
|
- **button_text**: Text for the admin link button (default: "Access Browser Phone")
|
|
- **target**: Link target behavior (default: "_blank" - opens in new tab)
|
|
|
|
### Security Features
|
|
- **Authentication Required**: Users must be logged in to see the redirect interface
|
|
- **Permission Validation**: Requires `twp_access_browser_phone` capability or `manage_options`
|
|
- **Clear Error Messages**: Informative feedback for unauthorized access attempts
|
|
- **Admin-Only Interface**: All browser phone functionality restricted to WordPress admin area
|
|
|
|
### Browser Phone Interface (Admin Area)
|
|
Access the full browser phone interface at: **WordPress Admin → Twilio → Browser Phone**
|
|
|
|
#### Features:
|
|
- **Enhanced Security**: Protected by WordPress admin authentication
|
|
- **Full Functionality**: Complete browser phone features available in secure environment
|
|
- **Responsive Design**: Adapts to all screen sizes within admin interface
|
|
- **Professional Interface**: Integrated with WordPress admin styling
|
|
- **No Frontend Assets**: Eliminates security risks from frontend JavaScript exposure
|
|
|
|
## Voice Configuration
|
|
|
|
### ElevenLabs Integration
|
|
1. **Get API Key** from ElevenLabs dashboard
|
|
2. **Configure in Settings**: Add API key
|
|
3. **Select Voices** in workflow steps:
|
|
- Click "Load Voices" to fetch available options
|
|
- Selected voices are saved with both ID and name
|
|
- Voice names persist across edits without API calls
|
|
|
|
### Audio Options per Step
|
|
- **Say**: Default Twilio text-to-speech
|
|
- **TTS**: ElevenLabs premium voices with persistence
|
|
- **Audio**: Custom MP3 file URLs
|
|
|
|
## Troubleshooting
|
|
|
|
### Common Issues
|
|
|
|
#### Browser Phone Access Issues
|
|
- **Access via Admin Only**: Browser phone moved to WordPress admin area for security
|
|
- **Shortcode Redirect**: Frontend shortcode now provides redirect to admin interface
|
|
- **Permission Required**: Ensure user has `twp_access_browser_phone` or `manage_options` capability
|
|
- **Login Required**: Users must be logged in to access browser phone functionality
|
|
- Check TwiML App SID is configured in WordPress admin settings
|
|
|
|
#### "Twilio SDK classes not available"
|
|
```bash
|
|
# Reinstall SDK
|
|
./install-twilio-sdk.sh
|
|
# Test installation
|
|
php test-sdk.php
|
|
```
|
|
|
|
#### Calls Not Routing to Queues
|
|
- Verify queue exists and is active
|
|
- Check agent group has members
|
|
- Ensure agents have valid phone numbers
|
|
- Review workflow step configuration
|
|
- Check notification_number field (not phone_number)
|
|
|
|
#### Call Control System - Enterprise Grade (v2.3.0)
|
|
- **Extension Transfers**: COMPLETELY REDESIGNED - Queue-based system with 2-minute timeout and automatic voicemail
|
|
- **Browser Phone Support**: UNIVERSAL - Full Firefox, Chrome, Safari, and Edge compatibility with permission management
|
|
- **Agent Status**: AUTOMATED - 1-minute auto-revert prevents agents staying busy indefinitely
|
|
- **Call Statistics**: ACCURATE - Browser phone calls properly tracked in all dashboards
|
|
- **Transcription**: REAL API - Actual Twilio integration replaces placeholder system
|
|
- **Customer Disconnections**: ELIMINATED - Intelligent call leg detection prevents all disconnection issues
|
|
- **Professional Audio**: UNIVERSAL - ElevenLabs TTS throughout all voice prompts
|
|
- **Zero Configuration**: AUTOMATIC - All systems work immediately without manual setup
|
|
|
|
#### Customer Number Display Issues - RESOLVED
|
|
- **"client:agentname" in Voicemails**: FIXED - Real customer numbers now display correctly in all interfaces
|
|
- **Wrong Numbers in Recording Interface**: RESOLVED - Enhanced detection shows actual customer phone numbers
|
|
- **Missing Customer Info**: ENHANCED - Smart fallback logic retrieves customer numbers from multiple sources
|
|
- **Browser Phone Call Issues**: PERFECTED - Proper customer identification in all call scenarios
|
|
- **Admin Interface**: IMPROVED - All admin interfaces now consistently show meaningful customer information
|
|
- **Data Consistency**: ENSURED - Customer information remains accurate across all features
|
|
|
|
#### SMS Not Sending from Admin
|
|
- Test with direct PHP script: `php test-twilio-direct.php send`
|
|
- Verify Twilio credentials in settings
|
|
- Check WordPress error logs
|
|
- Ensure number is SMS-capable in Twilio
|
|
|
|
#### Voice Selections Not Saving
|
|
- Voices now save both ID and name automatically
|
|
- No API call needed to display saved voices
|
|
- Click "Load Voices" only to change selection
|
|
- Check browser console for JavaScript errors
|
|
|
|
#### IVR Options Not Working
|
|
- Ensure only active form fields are enabled
|
|
- Check queue selections are properly saved
|
|
- Verify digit mappings in workflow data
|
|
|
|
### Debug Mode
|
|
Enable WordPress debugging in `wp-config.php`:
|
|
```php
|
|
define('WP_DEBUG', true);
|
|
define('WP_DEBUG_LOG', true);
|
|
define('WP_DEBUG_DISPLAY', false);
|
|
```
|
|
|
|
### Testing Tools
|
|
- **Direct SMS Test**: `php test-twilio-direct.php send`
|
|
- **SDK Test**: `php test-sdk.php`
|
|
- **Webhook Simulator**: Use Twilio Console debugger
|
|
- **Call Logs**: Review in WordPress admin
|
|
- **Browser Phone**: Test WebRTC connectivity
|
|
|
|
## Database Structure
|
|
|
|
The plugin creates these tables:
|
|
- `twp_phone_schedules` - Business hours definitions
|
|
- `twp_call_queues` - Queue configurations (uses notification_number)
|
|
- `twp_queued_calls` - Active calls in queues
|
|
- `twp_workflows` - Call flow definitions with voice persistence
|
|
- `twp_workflow_phones` - Junction table for multiple phone numbers per workflow
|
|
- `twp_call_log` - Complete call history
|
|
- `twp_sms_log` - SMS message tracking
|
|
- `twp_voicemails` - Recordings and transcriptions
|
|
- `twp_agent_groups` - Agent group definitions
|
|
- `twp_group_members` - User-to-group relationships
|
|
- `twp_agent_status` - Real-time agent availability
|
|
- `twp_callbacks` - Callback request queue
|
|
|
|
## Webhook Endpoints
|
|
|
|
All webhooks are REST API endpoints under `/wp-json/twilio-webhook/v1/`:
|
|
- `/voice` - Main incoming call handler
|
|
- `/sms` - SMS message handler
|
|
- `/ivr-response` - IVR digit collection (fixed in latest)
|
|
- `/queue-wait` - Queue hold experience
|
|
- `/agent-connect` - Agent connection handler
|
|
- `/callback-request` - Callback system
|
|
- `/outbound-agent-with-from` - Outbound calling
|
|
|
|
## Technical Details
|
|
|
|
### Dependencies
|
|
- **Twilio PHP SDK v8.7.0** - Server-side API operations
|
|
- **Twilio Voice SDK v2** - Browser phone WebRTC
|
|
- **WordPress REST API** - Webhook handling
|
|
- **jQuery** - Admin interface interactions
|
|
|
|
### Browser Compatibility
|
|
- **Chrome/Edge**: Full support
|
|
- **Firefox**: Full support
|
|
- **Safari**: Requires HTTPS for WebRTC
|
|
- **Mobile Browsers**: Limited WebRTC support
|
|
|
|
### Security Considerations
|
|
- **Admin-Only Browser Phone**: All browser phone functionality restricted to WordPress admin area
|
|
- **Frontend Asset Elimination**: Removed 108KB of frontend JavaScript and CSS to reduce attack surface
|
|
- **Authentication Required**: Shortcode requires user login and appropriate permissions
|
|
- **Secure Redirects**: Frontend shortcode provides authenticated redirect to admin interface
|
|
- All webhooks use WordPress nonce verification
|
|
- Phone numbers validated and sanitized
|
|
- SQL queries use prepared statements
|
|
- Sensitive data encrypted in database
|
|
- HTTPS required for production use
|
|
|
|
## Version History
|
|
|
|
### v2.3.0 (Current - 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
|
|
- **ATTACK SURFACE REDUCTION**: Minimized frontend JavaScript exposure and potential security vectors
|
|
- **EXTENSION TRANSFER SYSTEM**: Complete overhaul with queue-based routing, 2-minute timeout, and automatic voicemail fallback
|
|
- **BROWSER PHONE UNIVERSAL**: Firefox support, permission management, call stability, and cross-browser compatibility
|
|
- **AGENT STATUS AUTOMATION**: 1-minute auto-revert system with WordPress cron job integration
|
|
- **CALL STATISTICS ACCURACY**: Browser phone calls now tracked properly with enhanced logging
|
|
- **TRANSCRIPTION INTEGRATION**: Real Twilio API integration replacing placeholder system
|
|
- **CLIENT NAME CONSISTENCY**: Standardized naming prevents browser phone connection mismatches
|
|
- **PERMISSION SYSTEM**: Automatic microphone/speaker requests with error recovery
|
|
- **DATABASE MIGRATION**: Version 1.6.2 with auto_busy_at column for status management
|
|
- **PROFESSIONAL GRADE**: Enterprise reliability with comprehensive error handling throughout
|
|
- **ZERO CONFIGURATION**: All systems work automatically without manual setup
|
|
|
|
### v2.2.0 - CALL CONTROL FOUNDATION
|
|
- **COMPLETE CALL CONTROL REDESIGN**: Hold, transfer, and requeue functions rebuilt from ground up
|
|
- **Automatic Queue Creation**: Personal and hold queues created automatically with unique extensions
|
|
- **Professional Audio Experience**: ElevenLabs TTS integration throughout all operations
|
|
- **Call Leg Detection**: Advanced system preventing customer disconnections in complex topologies
|
|
- **Browser Phone Enhancement**: Full support for complex call scenarios and transfers
|
|
- **Customer Number Detection**: Enhanced interfaces show real customer numbers
|
|
|
|
### v2.1.0 - WORKFLOW FOUNDATION
|
|
- **Multiple Phone Numbers**: Workflows can now handle multiple phone numbers
|
|
- **Discord & Slack Integration**: Real-time notifications for call events
|
|
- **Enhanced Monitoring**: Automated queue timeout tracking and alerts
|
|
- **Notification System**: Configurable webhook-based notifications
|
|
- **Background Processing**: Cron jobs for timeout monitoring
|
|
- **Database Enhancements**: New junction table for phone number relationships
|
|
|
|
### v2.0.0 - BROWSER PHONE BASE
|
|
- Upgraded to Twilio Voice SDK v2 for browser phone
|
|
- Fixed queue notification_number field naming
|
|
- Enhanced voice selection persistence
|
|
- Fixed IVR option saving and loading
|
|
- Improved error handling and logging
|
|
- Added automatic token refresh
|
|
|
|
### v1.3.x - INITIAL RELEASE
|
|
- Initial release with full call center features
|
|
- Browser phone with Client SDK v1.14
|
|
- Basic workflow builder
|
|
- Queue management system
|
|
|
|
## Support
|
|
|
|
- Check `CLAUDE.md` for detailed technical documentation
|
|
- Review error logs in `/wp-content/debug.log`
|
|
- Monitor Twilio Console for webhook errors
|
|
- Test components individually using provided scripts
|
|
- Report issues with specific error messages and logs
|
|
|
|
## License
|
|
|
|
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. |