Fix voicemail and queue announcement issues

- Fixed phone agents getting 'Unauthorized' error when accessing voicemails by checking for twp_access_voicemails capability
- Fixed missing ElevenLabs parameter in queue TwiML generation that prevented announcement messages
- Fixed IVR voicemail messages not being saved correctly - now properly assigns message field based on action type
- Added proper permission checks for both ajax_get_voicemail and ajax_get_voicemail_audio functions

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-08-13 10:04:20 -07:00
parent 7a539df27a
commit 7beb0aa4f3
3 changed files with 29 additions and 5 deletions

View File

@@ -3432,6 +3432,11 @@ class TWP_Admin {
public function ajax_get_voicemail() {
check_ajax_referer('twp_ajax_nonce', 'nonce');
if (!current_user_can('manage_options') && !current_user_can('twp_access_voicemails')) {
wp_send_json_error('Unauthorized');
return;
}
$voicemail_id = intval($_POST['voicemail_id']);
if (!$voicemail_id) {
@@ -3487,7 +3492,7 @@ class TWP_Admin {
public function ajax_get_voicemail_audio() {
check_ajax_referer('twp_ajax_nonce', 'nonce');
if (!current_user_can('manage_options')) {
if (!current_user_can('manage_options') && !current_user_can('twp_access_voicemails')) {
wp_send_json_error('Unauthorized');
return;
}