/** * Read recall settings from legacy dialog/call params and schedule outbound. */ import { defineScript, parseRecallCount, parseRecallDelaySeconds, } from '@voctiv/agent-sdk'; export default defineScript(async ({ context, logger, platform }) => { const params = context.dialogParams ?? {}; const rawCount = params.recall_count ?? params.recallCount; const rawDelay = params.recall_delay ?? params.recallDelay; const recallCount = parseRecallCount(rawCount) ?? context.recallCount ?? context.agent?.recallCount; const recallDelaySec = parseRecallDelaySeconds(rawDelay) ?? context.recallDelay ?? context.agent?.recallDelay; logger.log('Parsed recall from params', { rawCount, rawDelay, recallCount, recallDelaySec, attempt: context.attempt, }); const msisdn = context.msisdn || context.callerId; if (!msisdn || recallCount == null || recallDelaySec == null) { logger.warn('Missing msisdn or recall config — skipping schedule'); return; } await platform.call(msisdn, { recallCount, recallDelay: recallDelaySec, }); });