Commit Graph

12 Commits

Author SHA1 Message Date
e475e68a5f Implement bridged forwarding with agent call control features
Major enhancement to workflow forwarding that solves voicemail issues and adds agent call control capabilities.

Key improvements:
- Converted direct forwarding to bridged forwarding to avoid self-call voicemail issues
- Added DTMF-based agent features during calls:
  * *9 - Hold/Unhold customer
  * *0 - Start/Stop call recording
  * *5 - Transfer to another extension
  * *1 - Mute/Unmute (placeholder for future conference mode)
- Added webhook handlers for agent features and forward results
- Agent features URL attached to Number elements for DTMF detection
- Continuous DTMF listening during active calls
- Proper call leg detection for hold/resume operations

Technical details:
- Added /agent-features webhook for DTMF capture
- Added /agent-action webhook for processing commands
- Added /forward-result webhook for handling dial outcomes
- Modified append_twiml_element to preserve Number attributes (url, method)
- Enhanced logging throughout for debugging

This eliminates the issue where calling yourself would go straight to voicemail and provides professional call control features for agents.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-18 18:29:20 -07:00
0ee8210fef Fix caller ID for workflow forward and ring group tasks
Updated forward and ring group tasks to use the incoming number (To) as the caller ID for outbound calls instead of the original caller's number (From).

Changes:
- Forward task now sets callerId attribute to the number that was called
- Ring group task also defaults to using the incoming number as caller ID
- Both functions check multiple sources for the To number (GLOBALS, POST, REQUEST)
- Added detailed logging for caller ID selection

This ensures that when calls are forwarded, the receiving party sees the business number that was called, not the original caller's personal number.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-18 16:46:52 -07:00
90cb03acfd Fix workflow forward task immediate disconnection issue
Fixed critical bug where forward tasks in workflows would immediately disconnect calls instead of forwarding them properly.

Changes:
- Fixed append_twiml_element function to properly handle Dial elements with child Number elements
- Enhanced create_forward_twiml to extract numbers from nested data structures
- Added comprehensive error handling for missing forward numbers
- Added detailed logging throughout workflow execution for debugging
- Set default timeout of 30 seconds for forward operations

The issue was caused by the Dial element being converted to string which lost all child Number elements, resulting in an empty dial that would immediately disconnect.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-18 16:27:51 -07:00
aa58b45501 Implement multiple phone numbers per workflow feature
Database Changes:
- Added twp_workflow_phones junction table for many-to-many relationship
- Updated activator to create and manage new table
- Maintained backward compatibility with existing phone_number field

Workflow Management:
- Added set_workflow_phone_numbers() and get_workflow_phone_numbers() methods
- Updated get_workflow_by_phone_number() to check both old and new structures
- Enhanced save/update handlers to support phone_numbers array
- Added AJAX endpoint for retrieving workflow phone numbers

User Interface:
- Replaced single phone number select with dynamic multi-select interface
- Added "Add Number" and "Remove" buttons for managing multiple numbers
- Updated workflow listing to display all assigned phone numbers
- Enhanced JavaScript for phone number management and validation

The webhook routing already supports multiple numbers since get_workflow_by_phone_number()
was updated to check both structures. This feature allows users to assign multiple
Twilio phone numbers to trigger the same workflow.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-13 10:35:21 -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
7beb0aa4f3 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>
2025-08-13 10:04:20 -07:00
7a539df27a Fix voicemail access and ElevenLabs voice loading issues
- 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 <noreply@anthropic.com>
2025-08-13 09:47:10 -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
c6edbbeba7 code revision 2025-08-06 15:25:47 -07:00