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,24 @@
import { Controller, Post, Body, Logger, HttpCode } from '@nestjs/common';
import { ExotelService } from './exotel.service';
import type { ExotelWebhookPayload } from './exotel.types';
@Controller('webhooks/exotel')
export class ExotelController {
private readonly logger = new Logger(ExotelController.name);
constructor(private readonly exotelService: ExotelService) {}
@Post('call-status')
@HttpCode(200)
async handleCallStatus(@Body() payload: ExotelWebhookPayload) {
this.logger.log(`Received Exotel webhook: ${payload.event_details?.event_type}`);
const callEvent = this.exotelService.parseWebhook(payload);
// TODO: Forward to CallEventsService (Task 4)
// For now, just log
this.logger.log(`Call event: ${JSON.stringify(callEvent)}`);
return { status: 'received' };
}
}