Commit Graph

14 Commits

Author SHA1 Message Date
ae92ea2c81 Fix hold/resume functionality and customer number detection
CRITICAL FIXES:
- Fixed hold/resume functions to use proper Hold Queue system instead of empty TwiML
- Enhanced customer number detection for voicemail and call recording interfaces
- Resolved customer disconnections during hold/resume operations on outbound calls

Hold/Resume System Improvements:
- Updated ajax_toggle_hold() to use TWP_User_Queue_Manager for proper queue management
- Fixed resume function to redirect calls back to appropriate queues (personal/shared)
- Added comprehensive logging for hold queue operations and call leg detection
- Enhanced hold experience with proper TTS messages and queue tracking

Customer Number Detection Enhancements:
- Enhanced handle_voicemail_callback() with fallback logic for missing From parameters
- Added browser phone detection to identify client: calls and find real customer numbers
- Enhanced call recording to use find_customer_call_leg() for proper customer identification
- Fixed admin interfaces to show actual phone numbers instead of "client:agentname"

Technical Improvements:
- Integrated Hold Queue system with existing call leg detection infrastructure
- Added proper TwiML generation for hold/resume operations
- Enhanced error handling and logging for debugging complex call topologies
- Maintains database consistency with queue position tracking

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-01 09:34:07 -07:00
82e591b367 Enhance recording debugging and fix outbound call number detection
Recording Proxy Improvements:
- Enhanced error handling to prevent JSON responses instead of audio
- Added comprehensive logging for Twilio API calls
- Added fallback URL construction from recording SID if URL missing
- Improved error responses with proper HTTP headers

Outbound Call Phone Number Detection:
- Enhanced logic to find customer numbers in complex call structures
- Added search through related calls to find customer phone numbers
- Comprehensive logging for debugging outbound call number assignment
- Handles cases where 'to' field might be empty or contain client identifiers

These changes should resolve:
1. Recording playback returning JSON instead of audio files
2. Missing customer phone numbers in outbound call recordings
3. Better error reporting and debugging capabilities

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-30 17:26:55 -07:00
ae9c6f5e8c Fix recording playback authentication and phone number display
Recording Playback Fixes:
- Added proxy_recording_audio endpoint to handle authenticated playback
- Recordings now play through WordPress proxy like voicemails
- Updated Play/Download buttons to use proxy URLs instead of direct Twilio URLs
- No more Twilio login prompts when playing recordings

Phone Number Display Fixes:
- Fixed outbound call recording display to show customer numbers properly
- For browser phone outbound calls, customer number now shows in "From" field
- Added logic to detect client: calls and swap number display appropriately
- Enhanced logging for debugging outbound call number handling

The recording system now works consistently with the voicemail system,
providing seamless authenticated playback without exposing Twilio credentials.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-30 16:54:19 -07:00
308e4851ac Add default queue music setting and improve hold music fallback
## New Settings
- Added "Default Queue Music URL" setting in admin settings
- This setting provides fallback music for both queue waits and call hold
- Hold Music URL field can now be left empty to use default queue music
- Better organization of music settings with clear descriptions

## Hold Music Improvements
- Hold music now falls back to default queue music if no specific hold music is set
- Maintains backwards compatibility with existing hold music URLs
- Provides consistent music experience across hold and queue functions

## Queue Music Enhancements
- Queue wait music now uses default queue music as fallback
- No more silent pauses when no queue-specific music is configured
- Improved user experience with continuous music during waits

## Settings Organization
- Default Queue Music is shown first as the primary setting
- Hold Music field has placeholder text indicating it's optional
- Clear descriptions explain the fallback behavior
- Both settings properly registered in WordPress settings API

This creates a more cohesive audio experience where:
1. Admin sets default queue music for system-wide use
2. Individual queues can override with their own music
3. Hold music can be customized or fall back to default
4. No more silent pauses during queue waits

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-30 15:51:48 -07:00
dc3c12e006 Add comprehensive call control features and web phone transfer capabilities
## New Call Control Features
- Call hold/unhold with music playback
- Call transfer with agent selection dialog
- Call requeue to different queues
- Call recording with start/stop controls
- Real-time recording status tracking

## Enhanced Transfer System
- Transfer to agents with cell phones (direct)
- Transfer to web phone agents via personal queues
- Automatic queue creation for each user
- Real-time agent availability status
- Visual agent selection with status indicators (📱 phone, 💻 web)

## Call Recordings Management
- New database table for call recordings
- Recordings tab in voicemail interface
- Play/download recordings functionality
- Admin-only delete capability
- Integration with Twilio recording webhooks

## Agent Queue System
- Personal queues (agent_[user_id]) for web phone transfers
- Automatic polling for incoming transfers
- Transfer notifications with browser alerts
- Agent status tracking (available/busy/offline)

## Technical Enhancements
- 8 new AJAX endpoints for call controls
- Recording status webhooks
- Enhanced transfer dialogs with agent selection
- Improved error handling and user feedback
- Mobile-responsive call control interface

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-30 11:52:50 -07:00
8c78e0cb11 Fix urgent voicemail SMS from number and add Discord/Slack notifications
- Fix SMS notifications to use Default SMS From Number instead of destination
- Add Discord webhook notifications for urgent keyword voicemails
- Add Slack webhook notifications for urgent keyword voicemails
- Make notification methods public to allow external calls
- Add urgent_voicemail type support with custom formatting
- Include transcription, keyword, and admin link in notifications
- Use bright red color for urgent alerts in both Discord and Slack

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-13 20:30:58 -07:00
534d343526 Implement Discord and Slack notifications for call events
Settings & Configuration:
- Added Discord webhook URL, Slack webhook URL settings in admin
- Added notification type toggles (incoming calls, queue timeouts, missed calls)
- Added queue timeout threshold setting (30-1800 seconds)
- Registered all new settings with WordPress options system

Notification System:
- Created TWP_Notifications class for Discord/Slack webhook handling
- Rich message formatting with embeds/attachments for both platforms
- Color-coded notifications (blue=incoming, yellow=timeout, red=missed)
- Comprehensive error handling and logging

Integration Points:
- Incoming calls: Notifications sent when calls enter queues
- Queue timeouts: Automated monitoring via cron job (every minute)
- Missed calls: Notifications for browser phone and general missed calls
- Added notified_timeout column to prevent duplicate timeout notifications

Features:
- Professional Discord embeds with fields and timestamps
- Slack attachments with proper formatting and colors
- Automatic cron job setup for queue timeout monitoring
- Fallback to SMS notifications while Discord/Slack also work
- Configurable notification types and timeout thresholds

This provides real-time call notifications to Discord channels and Slack channels,
helping teams stay informed about incoming calls and queue issues even when
SMS notifications aren't working due to validation delays.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-13 10:47:59 -07:00
30b0cd355f Fix browser phone client name mismatch causing immediate disconnection
- Standardized client name generation across all files to use alphanumeric only
- Fixed mismatch between token generation and call routing that caused calls to disconnect
- Updated TWP_Workflow, TWP_Webhooks, and TWP_Agent_Manager to use same format
- Client names now consistently formatted as 'agent123Username' without underscores

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-13 10:21:57 -07:00
e18e046431 testing progress 2025-08-12 09:12:54 -07:00
51dd3077d2 testing progress 2025-08-12 07:05:47 -07:00
304b5de40b progress made 2025-08-11 20:31:48 -07:00
3b499e2074 code push 2025-08-07 15:24:29 -07:00
b5e091d845 twilio project revision 2025-08-06 16:04:03 -07:00
c6edbbeba7 code revision 2025-08-06 15:25:47 -07:00