feat: add Exotel webhook controller and service for call event parsing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-17 09:04:15 +05:30
parent 5b35c65e6e
commit 30df1d0158
7 changed files with 215 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
// Exotel webhook payload (from their API docs)
export type ExotelWebhookPayload = {
event_details: {
event_type: 'answered' | 'terminal';
};
call_details: {
call_sid: string;
direction: 'inbound' | 'outbound';
call_status?: string;
total_talk_time?: number;
assigned_agent_details?: {
name: string;
number: string;
};
customer_details?: {
number: string;
name?: string;
};
recordings?: { url: string }[];
};
};
// Internal call event (normalized)
export type CallEvent = {
exotelCallSid: string;
eventType: 'ringing' | 'answered' | 'ended';
direction: 'inbound' | 'outbound';
callerPhone: string;
agentName: string;
agentPhone: string;
duration?: number;
recordingUrl?: string;
callStatus?: string;
timestamp: string;
};