Call Log & Cross-Call Alerts
The Call Log system (CallLogBO.cs) is the foundational component that records all telecaller interactions. It provides critical functionality for tracking calls, normalizing contact information, and preventing duplicate efforts through intelligent cross-call alerts.
Call Logging Process
When a telecaller completes a call, the system records comprehensive details:
- StaffId: The unique identifier of the telecaller who made the call
- Mobile: The contact phone number (normalized to 10-digit format)
- CallStatus: The outcome status of the call (see Lead Status Lifecycle)
- Notes: Any relevant remarks or observations from the call
- DateTime: Exact timestamp of when the call was logged
- Duration: Length of the actual call in seconds
Call Logging Flow
Mobile Rectification
The system automatically normalizes mobile numbers to ensure consistency and prevent false negatives in the cross-call alert system.
Rectification Process:
- Strip leading zeros from the number
- Remove country code prefix (if present, typically +91 or 91)
- Validate resulting number is exactly 10 digits
- Reject invalid formats with user feedback
This ensures that the same contact (e.g., 9876543210, 09876543210, +919876543210) is treated as identical across all records.
Cross-Call Alert System
This is a critical feature that prevents duplicate calls to the same contact and provides visibility into previous interactions.
Alert Logic
When a call is logged, the system executes this query:
SELECT TOP 1
sl.StaffId,
s.StaffName,
cl.CallDate,
cl.CallStatus
FROM CallLog cl
INNER JOIN Staff s ON cl.StaffId = s.StaffId
WHERE cl.Mobile = @currentMobile
AND cl.StaffId != @currentStaffId
AND cl.CallDate >= DATEADD(DAY, -5, GETDATE())
ORDER BY cl.CallDate DESCAlert Conditions:
- Only shows when ANOTHER telecaller (different StaffId) handled the same number
- Only considers calls from the past 5 days
- Returns the most recent prior call if multiple matches exist
- Does NOT alert for calls by the same telecaller (allows follow-ups)
Cross-Call Alert Sequence
Alert Display Format
When an alert is triggered, the telecaller sees:
⚠️ Alert: Previous Call Detected
This number was previously handled by Rajesh Kumar on 2026-03-18 with status "Call Back"
Status Details:
- Outcome: Call Back required
- Original Notes: Customer requested follow-up after project quotation
[Acknowledge] [Continue]Data Model
The CallLog table structure:
| Column | Type | Notes |
|---|---|---|
| CallLogId | INT PK | Auto-increment primary key |
| StaffId | INT FK | References Staff.StaffId |
| Mobile | VARCHAR(10) | Normalized 10-digit number |
| CallStatus | VARCHAR(50) | Status code (SV Fixed, CP, etc.) |
| Notes | NVARCHAR(MAX) | Call notes and observations |
| CallDateTime | DATETIME | When the call was logged |
| Duration | INT | Call duration in seconds |
| CreatedDate | DATETIME | Record creation timestamp |
Business Rules
- Mobile Normalization: All mobile numbers are automatically rectified before storage
- 5-Day Window: Cross-call alerts only check the past 5 calendar days
- Self-Exclusion: A telecaller's own previous calls do not trigger alerts
- Most Recent: If multiple prior calls exist, only the most recent is shown
- Alert is Informational: The alert does not block call logging; it's purely advisory
- No Cascade Blocks: A telecaller can still log a call to the same number regardless of alerts
Error Handling
| Error | Handling |
|---|---|
| Invalid mobile format | User prompted to correct format |
| Duplicate call in same session | System warns but allows (short delay) |
| Database unavailable | Graceful fallback, alert skipped |
| Cross-call query timeout | Timeout after 5 seconds, alert skipped |
Performance Considerations
- The cross-call alert query has an index on
(Mobile, StaffId, CallDate)for fast lookups - Result is cached for 30 seconds to prevent repeated queries for the same mobile
- Alert popup is non-blocking; user can dismiss and continue