Add twilio softphone with integrated AI assistant

This commit is contained in:
Francisco Gaona
2026-01-04 08:48:43 +01:00
parent 6593fecca7
commit fd989648fc
42 changed files with 5689 additions and 923 deletions

116
validate-softphone.sh Executable file
View File

@@ -0,0 +1,116 @@
#!/bin/bash
# Softphone Incoming Call System Validation Script
# This script verifies that all components are properly configured and running
echo "╔════════════════════════════════════════════════════════════════╗"
echo "║ SOFTPHONE INCOMING CALL SYSTEM VALIDATION ║"
echo "╚════════════════════════════════════════════════════════════════╝"
echo ""
# Colors for output
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
PASS=0
FAIL=0
check() {
local name=$1
local command=$2
local expected=$3
if eval "$command" > /dev/null 2>&1; then
if [ -z "$expected" ] || eval "$command" | grep -q "$expected"; then
echo -e "${GREEN}${NC} $name"
((PASS++))
return 0
fi
fi
echo -e "${RED}${NC} $name"
((FAIL++))
return 1
}
echo "🔍 Checking Services..."
echo ""
# Check backend is running
check "Backend running on port 3000" "netstat -tuln | grep ':3000'" "3000"
# Check frontend is running
check "Frontend running on port 3001" "netstat -tuln | grep ':3001'" "3001"
echo ""
echo "🔍 Checking Backend Configuration..."
echo ""
# Check backend files exist
check "Voice controller exists" "test -f /root/neo/backend/src/voice/voice.controller.ts"
check "Voice gateway exists" "test -f /root/neo/backend/src/voice/voice.gateway.ts"
# Check for inbound TwiML handler
check "inboundTwiml handler defined" "grep -q '@Post.*twiml/inbound' /root/neo/backend/src/voice/voice.controller.ts"
# Check for notifyIncomingCall method
check "notifyIncomingCall method exists" "grep -q 'notifyIncomingCall' /root/neo/backend/src/voice/voice.gateway.ts"
# Check for Socket.IO emit in notifyIncomingCall
check "notifyIncomingCall emits call:incoming" "grep -A3 'notifyIncomingCall' /root/neo/backend/src/voice/voice.gateway.ts | grep -q \"call:incoming\""
echo ""
echo "🔍 Checking Frontend Configuration..."
echo ""
# Check frontend files exist
check "Softphone composable exists" "test -f /root/neo/frontend/composables/useSoftphone.ts"
check "Softphone dialog component exists" "test -f /root/neo/frontend/components/SoftphoneDialog.vue"
# Check for Socket.IO listener
check "call:incoming event listener registered" "grep -q \"'call:incoming'\" /root/neo/frontend/composables/useSoftphone.ts"
# Check for handler function
check "handleIncomingCall function defined" "grep -q 'const handleIncomingCall' /root/neo/frontend/composables/useSoftphone.ts"
# Check that handler updates incomingCall ref
check "Handler updates incomingCall.value" "grep -A5 'const handleIncomingCall' /root/neo/frontend/composables/useSoftphone.ts | grep -q 'incomingCall.value = data'"
echo ""
echo "🔍 Checking End-to-End Flow..."
echo ""
# Check that backend calls notifyIncomingCall in handler
check "inboundTwiml calls notifyIncomingCall" "grep -A50 '@Post.*twiml/inbound' /root/neo/backend/src/voice/voice.controller.ts | grep -q 'notifyIncomingCall'"
# Check TwiML generation includes Dial
check "TwiML includes Dial element" "grep -A50 '@Post.*twiml/inbound' /root/neo/backend/src/voice/voice.controller.ts | grep -q '<Dial'"
# Check TwiML includes Client elements
check "TwiML includes Client dial targets" "grep -A50 '@Post.*twiml/inbound' /root/neo/backend/src/voice/voice.controller.ts | grep -q '<Client>'"
echo ""
echo "╔════════════════════════════════════════════════════════════════╗"
echo "║ VALIDATION SUMMARY ║"
echo "╠════════════════════════════════════════════════════════════════╣"
printf "║ %-50s %s ║\n" "Tests Passed" "${GREEN}${PASS}${NC}"
printf "║ %-50s %s ║\n" "Tests Failed" "${RED}${FAIL}${NC}"
echo "╚════════════════════════════════════════════════════════════════╝"
if [ $FAIL -eq 0 ]; then
echo ""
echo -e "${GREEN}✓ All checks passed! System is properly configured.${NC}"
echo ""
echo "Next Steps:"
echo "1. Connect to softphone at http://localhost:3001"
echo "2. Open softphone dialog and verify it shows 'Connected' status"
echo "3. Make an inbound call to your Twilio number"
echo "4. Verify incoming call dialog appears in softphone UI"
echo "5. Test accepting/rejecting the call"
exit 0
else
echo ""
echo -e "${RED}✗ Some checks failed. Review the configuration.${NC}"
exit 1
fi