## Hold Logic Fix - Now correctly identifies which call leg to put on hold - For browser phone calls (client: prefix), looks for parent call to hold customer - For regular calls, puts the call recipient on hold - Agent remains connected and can hear when customer speaks ## Smart Call Leg Detection - Detects browser phone calls by 'client:' prefix in 'To' field - Uses parentCallSid to find the customer's call leg - Falls back gracefully if parent call structure isn't available - Added detailed error logging to help debug call structures ## Improved User Experience - Customer hears "Please hold while we assist you" before hold music - Agent stays connected and can monitor the call - Resume includes "Thank you for holding" message - Better messaging tailored to who is actually being put on hold ## Technical Details - Added call structure analysis and logging - Proper handling of Twilio's call hierarchy - Different TwiML logic for browser vs regular phone calls - Maintains backwards compatibility with existing call flows This resolves the issue where agents were being put on hold instead of customers when using the browser phone interface. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
337 KiB
337 KiB