feat(voip): add Daftaresoma provider tab with webhook and click-to-call

Map portal call events into CRM logs, store the API token for OutgoingCall, and surface a dedicated settings tab for wiring the webhook URL.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-07 12:31:59 +03:30
co-authored by Cursor
parent 21d2c69227
commit abb1a3a18e
13 changed files with 934 additions and 90 deletions
@@ -28,6 +28,10 @@ import {
UpdateVoipConnectionDto,
VoipClickToCallDto,
} from './dto';
import {
isDaftaresomaWebhookPayload,
mapDaftaresomaWebhook,
} from './daftareshoma-webhook';
@Controller('integrations/voip')
@UseGuards(JwtAuthGuard, RolesGuard, OrgModuleGuard)
@@ -129,11 +133,21 @@ export class VoipWebhookController {
if (!ok) throw new UnauthorizedException('امضای وب‌هوک نامعتبر است');
}
if (!body?.callId) {
let event: VoipWebhookEvent | null = null;
if (
row.provider === 'daftareshoma' ||
isDaftaresomaWebhookPayload(body)
) {
event = mapDaftaresomaWebhook(body);
} else if (body?.callId) {
event = body;
}
if (!event?.callId) {
return { ok: false, error: 'callId required' };
}
const result = await this.calls.ingestWebhook(connectionId, body);
const result = await this.calls.ingestWebhook(connectionId, event);
return { ok: true, ...result };
}
}