mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage-server
synced 2026-05-18 20:08:19 +00:00
fix: clinicId on all appointment paths + startedAt on call records
- AI chat book_appointment tool: accepts optional clinicId - Widget booking: passes clinicId from request - LiveKit agent: passes clinicId from doctor context if available - Dispose endpoint: sets startedAt/endedAt on outbound call records (computed from durationSec). Fixes null timestamps in call history. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -147,14 +147,21 @@ export class OzonetelAgentController {
|
||||
// only place that creates the call record for outbound dials.
|
||||
if (body.direction === 'OUTBOUND' && body.callerPhone) {
|
||||
try {
|
||||
const durationSec = body.durationSec ?? 0;
|
||||
const endedAt = new Date().toISOString();
|
||||
const startedAt = durationSec > 0
|
||||
? new Date(Date.now() - durationSec * 1000).toISOString()
|
||||
: endedAt;
|
||||
const callData: Record<string, any> = {
|
||||
name: `Outbound — ${body.callerPhone}`,
|
||||
direction: 'OUTBOUND',
|
||||
callStatus: 'COMPLETED',
|
||||
callerNumber: { primaryPhoneNumber: `+91${body.callerPhone.replace(/^\+?91/, '')}` },
|
||||
agentName: agentId,
|
||||
durationSec: body.durationSec ?? 0,
|
||||
durationSec,
|
||||
disposition: body.disposition,
|
||||
startedAt,
|
||||
endedAt,
|
||||
};
|
||||
if (body.leadId) callData.leadId = body.leadId;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user