Skip to content

Implement Call Center Business Logic for VoyceLink#6

Open
franco148 wants to merge 10 commits into
development-voycelink:mainfrom
franco148:CallService-CallsMoveThroughALifecycleShouldAppearInTheDashboard
Open

Implement Call Center Business Logic for VoyceLink#6
franco148 wants to merge 10 commits into
development-voycelink:mainfrom
franco148:CallService-CallsMoveThroughALifecycleShouldAppearInTheDashboard

Conversation

@franco148
Copy link
Copy Markdown

Implemented complete call lifecycle management and business rules for the VoyceLink call-center system as specified in README.md:

Call Lifecycle Events

  • call_initiated: Validates queueId, creates call record, sets initial waiting status
  • call_routed: Assigns agent ID, updates call to active status, stores routing time
  • call_answered: Updates call to active status, records wait time, flags SLA breaches (>30 sec)
  • call_hold: Updates call to on_hold status, records hold duration, flags excessive holds (>60 sec)
  • call_ended: Marks call as ended, records end reason and duration, flags short calls (<10 sec)

Features Implemented

  • Event processing with state transitions
  • Persistence layer with PostgreSQL integration
  • Real-time event publishing via Redis pub/sub
  • Business rule enforcement (SLA times, hold limits, short call detection)
  • Input validation (queue IDs, call existence)
  • Error handling with specific error types
  • Full test coverage (14/14 unit tests passing)

Technical Implementation

  • Separated concerns: CallService orchestrates, CallRepository handles persistence, EventHandlers process specific events
  • Used Strategy pattern for extensible event handling
  • Eliminated magic values through constants and error classes
  • Maintained compatibility with existing API endpoints:
    • POST /api/events (event ingestion)
    • GET /api/calls (call listing with filtering)
    • GET /api/calls/:id/events (event history)

This implementation fulfills all business logic requirements for the call-service package, enabling the dashboard to display live calls and event history with accurate state transitions and real-time updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant