From 7a539df27aecc523e2568858a5759c953650f147 Mon Sep 17 00:00:00 2001 From: jknapp Date: Wed, 13 Aug 2025 09:47:10 -0700 Subject: [PATCH] Fix voicemail access and ElevenLabs voice loading issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Changed create_voicemail_twiml() from private to public method to fix fatal error when accessing voicemail from IVR - Added auto-loading of ElevenLabs voices when switching to TTS option for new workflow steps - Voices now load automatically when user selects "Use Text-to-Speech" radio button 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- assets/js/admin.js | 9 +++++++++ includes/class-twp-workflow.php | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/assets/js/admin.js b/assets/js/admin.js index dd7d980..2416380 100644 --- a/assets/js/admin.js +++ b/assets/js/admin.js @@ -1701,6 +1701,15 @@ jQuery(document).ready(function($) { // Show the appropriate options based on selection if (audioType === 'tts') { $ttsOptions.show(); + + // Auto-load voices if they haven't been loaded yet + var $voiceSelect = $ttsOptions.find('.voice-select'); + if ($voiceSelect.length && $voiceSelect.find('option').length <= 1) { + // Check if API key exists before auto-loading + if (twp_ajax.has_elevenlabs_key) { + loadWorkflowVoices($voiceSelect[0]); + } + } } else if (audioType === 'audio') { $audioOptions.show(); } diff --git a/includes/class-twp-workflow.php b/includes/class-twp-workflow.php index 075ae37..673e4bf 100644 --- a/includes/class-twp-workflow.php +++ b/includes/class-twp-workflow.php @@ -697,7 +697,7 @@ class TWP_Workflow { /** * Create voicemail TwiML */ - private static function create_voicemail_twiml($step, $elevenlabs) { + public static function create_voicemail_twiml($step, $elevenlabs) { $twiml = new SimpleXMLElement(''); // Debug logging