Add mobile-friendly browser phone shortcode for frontend use

- Created TWP_Shortcodes class with [twp_browser_phone] shortcode
- Mobile-first responsive CSS design with touch-friendly interface
- Frontend JavaScript integration with Twilio Voice SDK v2
- Permission checks for logged-in users with twp_access_browser_phone capability
- Haptic feedback and dark mode support
- Configurable shortcode parameters (title, show_title, compact)
- Updated plugin version to 2.1.0 in main file
- Added comprehensive documentation to README.md

Features:
- Visual dialpad with DTMF support
- Real-time connection status indicators
- Call timer and queue management
- Auto-scaling for mobile devices (320px+)
- Optimized for both desktop and mobile use

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-08-13 13:45:25 -07:00
parent bef2259943
commit 4c353096fe
6 changed files with 1183 additions and 2 deletions

View File

@@ -46,13 +46,15 @@ This plugin **requires** the Twilio PHP SDK v8.7.0 to function. The plugin will
- **Queue Notifications**: SMS alerts to designated numbers when calls enter queues
### 🌐 Browser Phone (WebRTC)
- **In-Browser Calling**: Make and receive calls directly from WordPress admin
- **In-Browser Calling**: Make and receive calls directly from WordPress admin or frontend
- **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 Support**: Embed browser phone on any page with `[twp_browser_phone]`
### 🕒 Business Hours Management
- **Schedule-based Routing**: Different call flows for business hours vs after-hours
@@ -258,6 +260,38 @@ This plugin **requires** the Twilio PHP SDK v8.7.0 to function. The plugin will
- **Queue Timeouts**: Alert when calls wait too long (configurable threshold)
- **Missed Calls**: Alert when calls are abandoned or timeout
## Frontend Browser Phone
### Shortcode Usage
The browser phone can be embedded on any WordPress page using the `[twp_browser_phone]` shortcode. This is perfect for creating dedicated agent pages or customer service portals.
**Basic Usage:**
```
[twp_browser_phone]
```
**With Options:**
```
[twp_browser_phone title="Customer Service Phone" show_title="true" compact="false"]
```
### Shortcode Parameters
- **title**: Custom title for the phone widget (default: "Browser Phone")
- **show_title**: Display the title above the phone (default: "true")
- **compact**: Use compact layout for smaller spaces (default: "false")
### Permission Requirements
- Users must be **logged in** to access the browser phone
- Users need the **`twp_access_browser_phone`** capability or **`manage_options`**
- Phone Agent role users have access by default
### Mobile Optimization
- **Responsive Design**: Adapts to all screen sizes
- **Touch-Friendly**: Large buttons optimized for mobile devices
- **Haptic Feedback**: Vibration on button press (where supported)
- **Auto-Zoom Prevention**: Proper viewport handling for mobile browsers
- **Dark Mode Support**: Automatically adapts to user's system preference
## Voice Configuration
### ElevenLabs Integration