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>
This commit is contained in:
2025-08-13 10:21:57 -07:00
parent c0f0ea8158
commit 30b0cd355f
3 changed files with 24 additions and 4 deletions

View File

@@ -458,7 +458,12 @@ class TWP_Workflow {
));
foreach ($agents as $agent) {
$client_name = 'agent_' . $agent->ID . '_' . sanitize_title($agent->display_name);
// Twilio requires alphanumeric characters only
$clean_name = preg_replace('/[^a-zA-Z0-9]/', '', $agent->display_name);
if (empty($clean_name)) {
$clean_name = 'user';
}
$client_name = 'agent' . $agent->ID . $clean_name;
$client = $dial->addChild('Client', $client_name);
}
} else {