@voctiv/agent-sdk 0.2.14 → 0.2.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseRecallDelaySeconds = parseRecallDelaySeconds;
4
+ exports.parseRecallCount = parseRecallCount;
5
+ /**
6
+ * Parse recall delay to seconds — parity with logic-executor `agent.delay` / `recall_delay`
7
+ * in call params (`HH:mm:ss`, integer seconds).
8
+ */
9
+ function parseRecallDelaySeconds(value) {
10
+ if (value == null)
11
+ return undefined;
12
+ if (typeof value === 'number' && Number.isFinite(value) && value >= 0) {
13
+ return Math.floor(value);
14
+ }
15
+ if (typeof value !== 'string')
16
+ return undefined;
17
+ const trimmed = value.trim();
18
+ if (!trimmed)
19
+ return undefined;
20
+ if (/^\d+$/.test(trimmed)) {
21
+ return parseInt(trimmed, 10);
22
+ }
23
+ const match = trimmed.match(/^(\d{1,2}):(\d{2})(?::(\d{2}))?$/);
24
+ if (!match)
25
+ return undefined;
26
+ const hours = parseInt(match[1], 10);
27
+ const minutes = parseInt(match[2], 10);
28
+ const seconds = match[3] ? parseInt(match[3], 10) : 0;
29
+ if (!Number.isFinite(hours) ||
30
+ !Number.isFinite(minutes) ||
31
+ !Number.isFinite(seconds)) {
32
+ return undefined;
33
+ }
34
+ return hours * 3600 + minutes * 60 + seconds;
35
+ }
36
+ /** Parse recall attempt limit from call/dialog params. */
37
+ function parseRecallCount(value) {
38
+ if (typeof value === 'number' && Number.isFinite(value) && value >= 0) {
39
+ return Math.floor(value);
40
+ }
41
+ if (typeof value === 'string') {
42
+ const trimmed = value.trim();
43
+ if (!trimmed)
44
+ return undefined;
45
+ const n = parseInt(trimmed, 10);
46
+ if (Number.isFinite(n) && n >= 0)
47
+ return n;
48
+ }
49
+ return undefined;
50
+ }
51
+ //# sourceMappingURL=recall-utils.js.map
@@ -0,0 +1 @@
1
+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MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EACzB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,KAAK,GAAG,IAAI,GAAG,OAAO,GAAG,EAAE,GAAG,OAAO,CAAC;AAC/C,CAAC;AAED,0DAA0D;AAC1D,SAAgB,gBAAgB,CAAC,KAAc;IAC7C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QACtE,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;QAC7B,IAAI,CAAC,OAAO;YAAE,OAAO,SAAS,CAAC;QAC/B,MAAM,CAAC,GAAG,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAChC,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;YAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -5,11 +5,18 @@ export interface DtmfEvent {
5
5
  /** Duration of the tone in milliseconds, normalized by the channel when available. */
6
6
  duration: number;
7
7
  }
8
- /** Incoming SIP INFO message on a live SIP call leg. */
8
+ /**
9
+ * Incoming SIP INFO on a live call leg — mid-call signalling only.
10
+ *
11
+ * The host exposes **`contentType` + `body` only**. SIP headers on the INFO
12
+ * request (e.g. `X-language`) are **not** forwarded. Prefer
13
+ * {@link import('./sip').ChannelSip.dtmf$} for DTMF. Start-of-call INVITE
14
+ * headers are {@link import('./sip').ChannelSip.inviteSipHeaders}, not this type.
15
+ */
9
16
  export interface SipInfo {
10
17
  /** MIME content type (e.g. `"application/dtmf-relay"`, `"application/xml"`). */
11
18
  contentType: string;
12
- /** Raw message body as received from the stack. */
19
+ /** Raw message body as received from the stack (not INFO SIP headers). */
13
20
  body: string;
14
21
  }
15
22
  /** Low-level Sofia SIP stack state-change event (see also {@link import('./sip').SipState}). */
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/types/events.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,MAAM,WAAW,SAAS;IACxB,qFAAqF;IACrF,KAAK,EAAE,MAAM,CAAC;IACd,sFAAsF;IACtF,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wDAAwD;AACxD,MAAM,WAAW,OAAO;IACtB,gFAAgF;IAChF,WAAW,EAAE,MAAM,CAAC;IACpB,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;CACd;AAED,gGAAgG;AAChG,MAAM,WAAW,SAAS;IACxB,sGAAsG;IACtG,KAAK,EAAE,MAAM,CAAC;IACd,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,+FAA+F;AAC/F,MAAM,WAAW,WAAW;IAC1B,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,mFAAmF;IACnF,OAAO,EAAE,OAAO,CAAC;CAClB"}
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/types/events.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,MAAM,WAAW,SAAS;IACxB,qFAAqF;IACrF,KAAK,EAAE,MAAM,CAAC;IACd,sFAAsF;IACtF,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,OAAO;IACtB,gFAAgF;IAChF,WAAW,EAAE,MAAM,CAAC;IACpB,0EAA0E;IAC1E,IAAI,EAAE,MAAM,CAAC;CACd;AAED,gGAAgG;AAChG,MAAM,WAAW,SAAS;IACxB,sGAAsG;IACtG,KAAK,EAAE,MAAM,CAAC;IACd,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,+FAA+F;AAC/F,MAAM,WAAW,WAAW;IAC1B,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,mFAAmF;IACnF,OAAO,EAAE,OAAO,CAAC;CAClB"}
@@ -1,3 +1,13 @@
1
+ /**
2
+ * Role for {@link ScriptLogger.transcript} lines that land in the CMS call transcript.
3
+ *
4
+ * Wire values stay `'user'` / `'agent'` for dialog-consumer mapping
5
+ * (`human_phrase` / `agent_phrase`).
6
+ */
7
+ export declare enum TranscriptionRole {
8
+ User = "user",
9
+ Agent = "agent"
10
+ }
1
11
  /**
2
12
  * Structured logger available to scripts.
3
13
  *
@@ -15,6 +25,26 @@ export interface ScriptLogger {
15
25
  error(message: string, data?: Record<string, unknown>): void;
16
26
  /** Debug-level log entry; intended for process/debug stream output rather than legacy DB stats. */
17
27
  debug(message: string, data?: Record<string, unknown>): void;
28
+ /**
29
+ * Write a phrase into the CMS call transcript.
30
+ *
31
+ * In Voctiv legacy mode:
32
+ * - {@link TranscriptionRole.User} → `nv.listen` / `stop` in `dialog_stats` (Mongo `human_phrase`)
33
+ * - {@link TranscriptionRole.Agent} → `nv.synthesize` (Mongo `agent_phrase`)
34
+ *
35
+ * Also logs as `USER: …` / `AGENT: …`. Empty / whitespace-only text is ignored.
36
+ *
37
+ * Does **not** mutate the script's `call_transcript` output entity — scripts
38
+ * that keep their own transcript buffer should still update it explicitly.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * import { TranscriptionRole } from '@lib/scripting-sdk';
43
+ * logger.transcript(TranscriptionRole.User, userText);
44
+ * logger.transcript(TranscriptionRole.Agent, '¿Hola?');
45
+ * ```
46
+ */
47
+ transcript(role: TranscriptionRole, message: string): void;
18
48
  /**
19
49
  * Enable real-time log streaming to a remote debug endpoint.
20
50
  * Opens a Socket.IO connection from this API pod to the debug server.
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/types/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,4BAA4B;IAC5B,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC3D,+BAA+B;IAC/B,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC5D,6BAA6B;IAC7B,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC7D,mGAAmG;IACnG,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAE7D;;;;;;OAMG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpC,kEAAkE;IAClE,YAAY,IAAI,IAAI,CAAC;IAErB;;;;;;;;;OASG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9E"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/types/logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,oBAAY,iBAAiB;IAC3B,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,4BAA4B;IAC5B,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC3D,+BAA+B;IAC/B,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC5D,6BAA6B;IAC7B,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC7D,mGAAmG;IACnG,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAE7D;;;;;;;;;;;;;;;;;;OAkBG;IACH,UAAU,CAAC,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAE3D;;;;;;OAMG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpC,kEAAkE;IAClE,YAAY,IAAI,IAAI,CAAC;IAErB;;;;;;;;;OASG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9E"}
@@ -1,3 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TranscriptionRole = void 0;
4
+ /**
5
+ * Role for {@link ScriptLogger.transcript} lines that land in the CMS call transcript.
6
+ *
7
+ * Wire values stay `'user'` / `'agent'` for dialog-consumer mapping
8
+ * (`human_phrase` / `agent_phrase`).
9
+ */
10
+ var TranscriptionRole;
11
+ (function (TranscriptionRole) {
12
+ TranscriptionRole["User"] = "user";
13
+ TranscriptionRole["Agent"] = "agent";
14
+ })(TranscriptionRole || (exports.TranscriptionRole = TranscriptionRole = {}));
3
15
  //# sourceMappingURL=logger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/types/logger.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/types/logger.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,kCAAa,CAAA;IACb,oCAAe,CAAA;AACjB,CAAC,EAHW,iBAAiB,iCAAjB,iBAAiB,QAG5B"}
@@ -21,10 +21,12 @@ export interface NluExtractOptions {
21
21
  /** Legacy compatibility field; mapped to exclude policy on nlu-engine. */
22
22
  intents_exclude?: string | string[] | null;
23
23
  /**
24
- * Additional context for disambiguation.
24
+ * Opaque NLU disambiguation context (not {@link import('./script-context').ScriptDialogContext}).
25
25
  *
26
- * Objects and arrays are JSON-stringified before sending. When omitted, the runtime
27
- * uses dialog `flag` (logic-executor scripts usually pass the same value explicitly).
26
+ * Objects and arrays are JSON-stringified before sending. When omitted or `null`,
27
+ * the runtime sends **no** NLU context (`null`) there is no auto-fill from dialog
28
+ * params or `flag`. Pass explicitly when needed (logic-executor scripts usually pass
29
+ * `context.flag`).
28
30
  */
29
31
  context?: string | unknown[] | Record<string, unknown> | null;
30
32
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"nlu.d.ts","sourceRoot":"","sources":["../../src/types/nlu.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;IACpC,0EAA0E;IAC1E,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;IAC5C;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;IACnC,0EAA0E;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pC,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;IACxC,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;IACxC,YAAY,IAAI,OAAO,CAAC;IACxB,WAAW,IAAI,OAAO,CAAC;IACvB,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,mBAAmB,GAAG,IAAI,CAAC;IACxE,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,mBAAmB,GAAG,IAAI,CAAC;IACxE,yBAAyB,IAAI,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IACjE,wBAAwB,IAAI,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAChE,IAAI,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,SAAS,IAAI,MAAM,CAAC;CACrB"}
@@ -42,9 +42,15 @@ export interface ScheduleCallOptions {
42
42
  /** Deadline — don't call after this time. */
43
43
  dateEnd?: string | Date;
44
44
  /**
45
- * Entry point to pass to the script when the call connects.
45
+ * Optional label stored on the **call** row as `call.params.entry_point` (LE DB compatibility)
46
+ * at schedule time. This is not the same as assigning {@link DialogApi.entryPoint} mid-script
47
+ * (that writes `dialog.params.entry_point`).
46
48
  *
47
- * Stored in the created call params as `entry_point`.
49
+ * The host always runs your single `defineScript` export — it does **not** invoke a
50
+ * separate function by this name (unlike logic-executor Python `run_unit(entry_point=...)`).
51
+ * Use {@link import('./script-context').ScriptDialogContext.entryPoint} inside the handler
52
+ * if you branch manually (e.g. headless after-call via
53
+ * {@link import('./script-context').getScriptPhase}).
48
54
  */
49
55
  entryPoint?: string;
50
56
  /**
@@ -61,18 +67,43 @@ export interface ScheduleCallOptions {
61
67
  */
62
68
  channel?: string | number;
63
69
  /**
64
- * How many times to retry on failure. Stored as `recall_count` in call params.
65
- * When omitted, the host defaults from {@link import('./script-context').ScriptDialogContext.recallCount}.
70
+ * Max failed-call retries. Stored as `recall_count` in call params.
71
+ * When omitted, the host defaults from {@link import('./script-context').ScriptDialogContext.recallCount}
72
+ * only if {@link onFailedCall} is not configured for this scheduled call.
73
+ *
74
+ * Activates **automatic recall**: on each failed outbound the dialer schedules another call after
75
+ * {@link recallDelay} and increments `context.attempt`. Mutually exclusive with {@link onFailedCall}
76
+ * — if both are present, the host keeps {@link onFailedCall} and drops recall. Requires both
77
+ * `recallCount` and `recallDelay` on the `call` row when used alone.
66
78
  */
67
79
  recallCount?: number;
68
80
  /**
69
- * Delay in seconds between retries. Stored as `recall_delay` in call params.
70
- * When omitted, the host defaults from {@link import('./script-context').ScriptDialogContext.recallDelay}.
81
+ * Delay before the next recall attempt, in **seconds**.
82
+ * Stored as `recall_delay` in call params (numeric seconds from SDK; LE may also
83
+ * use `HH:MM:SS` strings in legacy rows — the host normalizes both on schedule).
84
+ *
85
+ * When omitted, the host defaults from {@link import('./script-context').ScriptDialogContext.recallDelay}
86
+ * only if {@link onFailedCall} is not configured for this scheduled call.
87
+ *
88
+ * Mutually exclusive with {@link onFailedCall}.
71
89
  */
72
90
  recallDelay?: number;
73
- /** Entry point to use after a successful call. Stored as `on_success_call`. */
91
+ /**
92
+ * Headless handler name after a successful call. Stored as `on_success_call`.
93
+ * On shutdown the host may set `dialog.result = null` and `dialog.params.entry_point` to this
94
+ * value so the dialog re-enters the offline queue for continuation.
95
+ */
74
96
  onSuccessCall?: string;
75
- /** Entry point to use after a failed call. Stored as `on_failed_call`. */
97
+ /**
98
+ * Headless handler after a failed outbound. Stored as `on_failed_call`.
99
+ *
100
+ * Activates **after-call continuation**: the host sets `dialog.params.entry_point` (and typically
101
+ * `dialog.result = null`) and re-runs this script with
102
+ * {@link import('./script-context').getScriptPhase} → `after_call_failed`. Mutually exclusive
103
+ * with automatic recall ({@link recallCount} + {@link recallDelay}) on the same `platform.call()`.
104
+ * If both are present, the host keeps this option and drops recall. When set (including via Omni
105
+ * `scheduleOutbound` defaults), CMS recall is not auto-copied onto the `call` row.
106
+ */
76
107
  onFailedCall?: string;
77
108
  /** Call priority (higher = processed sooner by dialer). */
78
109
  priority?: number;
@@ -92,21 +123,44 @@ export interface ScheduleCallOptions {
92
123
  bulkUuid?: string;
93
124
  }
94
125
  /**
95
- * Dialog state APIread and update dialog routing metadata.
126
+ * LE **dialog row** helpers lifecycle status (`result`) and routing (`entryPoint`).
96
127
  *
128
+ * These fields map to the Voctiv platform `dialog` table, not to SIP media.
97
129
  * Setting `entryPoint` or `result` updates the local value immediately and asks
98
- * the Voctiv platform database to persist the change asynchronously. In worker
99
- * sessions the setter sends an RPC to the main thread; in direct sessions errors
100
- * are logged. There is no awaitable setter, so do not use it for transactional flow.
130
+ * the database to persist asynchronously (worker RPC or direct session). Setters
131
+ * are not awaitable do not use them for transactional flow.
132
+ *
133
+ * Do **not** confuse with {@link import('./sip').ChannelSip.hangup}, SIP
134
+ * `call.result`, or {@link import('./script-context').ScriptResult}.
101
135
  */
102
136
  export interface DialogApi {
103
- /** Current script entry point (e.g. `"on_recall"`). Set to change routing for the next call. */
137
+ /**
138
+ * Writable routing hint persisted as `dialog.params.entry_point`.
139
+ *
140
+ * Distinct from the read-only snapshot
141
+ * {@link import('./script-context').ScriptDialogContext.entryPoint} taken at
142
+ * script start. Assigning here does **not** select a different script export —
143
+ * the host always runs the same `defineScript` handler; branch with
144
+ * {@link import('./script-context').getScriptPhase} / `context.entryPoint`.
145
+ */
104
146
  entryPoint: string | undefined;
105
- /** Dialog outcome (e.g. `"done"`, `"busy"`, `"no_answer"`). Set to finalize dialog. */
147
+ /**
148
+ * Lifecycle status of the LE **`dialog.result`** column (queue / CMS), not the
149
+ * SIP call outcome.
150
+ *
151
+ * Typical values: `"pending"` (in progress), `"queued"` (offline queue),
152
+ * `"done"` / `"error"` (terminal), or `null` (e.g. after-call continuation so
153
+ * the dialog re-enters the queue). The host also sets these on live session
154
+ * start and shutdown.
155
+ *
156
+ * Does **not** hang up SIP or change `channel.sip.state`. Not
157
+ * {@link import('./script-context').ScriptResult}, not `call.result` (per-leg
158
+ * SIP code/phrase for CMS logs).
159
+ */
106
160
  result: string | undefined;
107
- /** Dialog UUID (read-only). */
161
+ /** Same dialog UUID as {@link import('./script-context').ScriptDialogContext.dialogUuid}. */
108
162
  readonly uuid: string;
109
- /** Caller msisdn (read-only). */
163
+ /** Same caller identity as {@link import('./script-context').ScriptDialogContext.msisdn}. */
110
164
  readonly msisdn: string;
111
165
  }
112
166
  /** Options for sending an outbound message via {@link MessagingApi.send}. */
@@ -168,7 +222,10 @@ export interface MessagingApi {
168
222
  export interface PlatformApi {
169
223
  /** NLU intent/entity extraction API; throws outside legacy V3 compatibility mode. */
170
224
  readonly nlu: NluScriptApi;
171
- /** Dialog state — read/write entry point and result. */
225
+ /**
226
+ * LE dialog lifecycle and routing ({@link DialogApi.result}, {@link DialogApi.entryPoint}).
227
+ * Not SIP hangup / media — see {@link import('./sip').ChannelSip}.
228
+ */
172
229
  readonly dialog: DialogApi;
173
230
  /** Messaging API — send and receive external messages. */
174
231
  readonly messaging: MessagingApi;
@@ -1 +1 @@
1
- {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../src/types/platform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;;;;;;OAWG;IACH,OAAO,CACL,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,cAAc,CAAC,CAAC;IAC3B;;;;;OAKG;IACH,QAA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AC,CAAC;IACjD;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC;CAC/C;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,WAAW;IAC1B,qFAAqF;IACrF,QAAQ,CAAC,GAAG,EAAE,YAAY,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,0DAA0D;IAC1D,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IACjC;;;;;OAKG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnE;;;;;;OAMG;IACH,UAAU,CAAC,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;CAC5E"}
@@ -145,7 +145,13 @@ export interface ScriptDialogContext {
145
145
  * {@link import('./mixer').PlayOptions} to select **`key_storage.name`** when LE credential maps exist.
146
146
  */
147
147
  availableMediaKeys?: string[];
148
- /** Script entry point for routing (e.g. `"on_recall"`, `"on_message_api_received"`). */
148
+ /**
149
+ * Routing hint from `dialog.params.entry_point` **at script start** (snapshot).
150
+ *
151
+ * Use with {@link getScriptPhase} to branch inside the same `defineScript` export.
152
+ * Assigning this property does **not** persist — write via
153
+ * {@link import('./platform').DialogApi.entryPoint} (`platform.dialog.entryPoint`).
154
+ */
149
155
  entryPoint?: string;
150
156
  /** Current recall attempt number for this dialog (from `dialog.params.attempt`, starts at 0). */
151
157
  attempt?: number;
@@ -154,8 +160,9 @@ export interface ScriptDialogContext {
154
160
  *
155
161
  * Resolved at script start: `dialog.params` / `call.params` (`recall_count`) override
156
162
  * {@link AgentContext.recallCount} from CMS. Omitted when no value is configured.
157
- * Passed to {@link import('./platform').ScheduleCallOptions.recallCount} when scheduling
158
- * outbound calls without explicit options.
163
+ * The host may default {@link import('./platform').ScheduleCallOptions.recallCount} from this
164
+ * field when scheduling outbound calls without explicit recall options and without
165
+ * {@link import('./platform').ScheduleCallOptions.onFailedCall}.
159
166
  */
160
167
  recallCount?: number;
161
168
  /**
@@ -163,7 +170,9 @@ export interface ScriptDialogContext {
163
170
  *
164
171
  * Resolved at script start: `dialog.params` / `call.params` (`recall_delay`) override
165
172
  * {@link AgentContext.recallDelay} from CMS (`agent.delay` converted to seconds).
166
- * Omitted when no value is configured.
173
+ * Omitted when no value is configured. The host may default
174
+ * {@link import('./platform').ScheduleCallOptions.recallDelay} from this field under the same
175
+ * conditions as {@link recallCount}.
167
176
  */
168
177
  recallDelay?: number;
169
178
  /**
@@ -234,9 +243,15 @@ export interface ScriptError {
234
243
  /**
235
244
  * Value returned by a script function. Only `output` and `error` are valid fields.
236
245
  * Session state is updated via `context.env$`; the runtime snapshots it separately.
246
+ *
247
+ * This is **not** the LE `dialog.result` lifecycle column — that is
248
+ * {@link import('./platform').DialogApi.result} (`platform.dialog.result`).
237
249
  */
238
250
  export interface ScriptResult {
239
- /** Output data to store in dialog_stats. */
251
+ /**
252
+ * Output data for dialog_stats / host persistence.
253
+ * Not {@link import('./platform').DialogApi.result}.
254
+ */
240
255
  output?: Record<string, unknown>;
241
256
  /** Error details (auto-populated on script crash, or set manually). */
242
257
  error?: ScriptError;
@@ -1 +1 @@
1
- {"version":3,"file":"script-context.d.ts","sourceRoot":"","sources":["../../src/types/script-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,oEAAoE;AACpE,MAAM,WAAW,kBAAkB;IACjC,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,uFAAuF;AACvF,MAAM,WAAW,YAAY;IAC3B,4DAA4D;IAC5D,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,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src/types/script-context.ts"],"names":[],"mappings":";;AAoQA,wCAcC;AApCD,MAAM,+BAA+B,GAAG,IAAI,GAAG,CAAC;IAC9C,iBAAiB;IACjB,oBAAoB;IACpB,cAAc;CACf,CAAC,CAAC;AACH,MAAM,8BAA8B,GAAG,IAAI,GAAG,CAAC;IAC7C,gBAAgB;IAChB,mBAAmB;CACpB,CAAC,CAAC;AACH,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;AAE7D;;;;;;;;;;GAUG;AACH,SAAgB,cAAc,CAAC,OAA4B;IACzD,IAAI,CAAC,OAAO,CAAC,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAEvC,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC;IAE1D,IAAI,+BAA+B,CAAC,GAAG,CAAC,EAAE,CAAC;QAAE,OAAO,oBAAoB,CAAC;IACzE,IAAI,8BAA8B,CAAC,GAAG,CAAC,EAAE,CAAC;QAAE,OAAO,mBAAmB,CAAC;IACvE,IAAI,mBAAmB,CAAC,GAAG,CAAC,EAAE,CAAC;QAAE,OAAO,QAAQ,CAAC;IACjD,IAAI,EAAE,KAAK,yBAAyB,IAAI,OAAO,CAAC,cAAc;QAC5D,OAAO,WAAW,CAAC;IAErB,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,MAAM,IAAI,EAAE,KAAK,SAAS;QAAE,OAAO,aAAa,CAAC;IAEnE,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
1
+ {"version":3,"file":"script-context.js","sourceRoot":"","sources":["../../src/types/script-context.ts"],"names":[],"mappings":";;AA6QA,wCAcC;AApCD,MAAM,+BAA+B,GAAG,IAAI,GAAG,CAAC;IAC9C,iBAAiB;IACjB,oBAAoB;IACpB,cAAc;CACf,CAAC,CAAC;AACH,MAAM,8BAA8B,GAAG,IAAI,GAAG,CAAC;IAC7C,gBAAgB;IAChB,mBAAmB;CACpB,CAAC,CAAC;AACH,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;AAE7D;;;;;;;;;;GAUG;AACH,SAAgB,cAAc,CAAC,OAA4B;IACzD,IAAI,CAAC,OAAO,CAAC,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAEvC,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC;IAE1D,IAAI,+BAA+B,CAAC,GAAG,CAAC,EAAE,CAAC;QAAE,OAAO,oBAAoB,CAAC;IACzE,IAAI,8BAA8B,CAAC,GAAG,CAAC,EAAE,CAAC;QAAE,OAAO,mBAAmB,CAAC;IACvE,IAAI,mBAAmB,CAAC,GAAG,CAAC,EAAE,CAAC;QAAE,OAAO,QAAQ,CAAC;IACjD,IAAI,EAAE,KAAK,yBAAyB,IAAI,OAAO,CAAC,cAAc;QAC5D,OAAO,WAAW,CAAC;IAErB,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,MAAM,IAAI,EAAE,KAAK,SAAS;QAAE,OAAO,aAAa,CAAC;IAEnE,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
@@ -133,15 +133,15 @@ export interface SipProgressEvent {
133
133
  * call state (e.g. create ASR only after media is available).
134
134
  */
135
135
  /**
136
- * SIP headers captured from an **inbound INVITE** at call setup.
136
+ * SIP headers captured from an **inbound INVITE** at call setup (start-of-call only).
137
137
  *
138
- * Keys use the on-wire header name (`Diversion`, `P-Asserted-Identity`, `X-Trunk-Id`, …).
139
- * Values are a single string or a string array when the same header appears multiple times
140
- * (e.g. several `Diversion` hops).
138
+ * Keys use the on-wire header name (`Diversion`, `P-Asserted-Identity`, `X-Trunk-Id`,
139
+ * `X-language`, …). Values are a single string or a string array when the same header
140
+ * appears multiple times (e.g. several `Diversion` hops).
141
141
  *
142
- * **Snapshot only** — does not update on 180/200, re-INVITE, or BYE. Outbound B-legs
143
- * typically have no INVITE snapshot (`undefined`). For carrier-specific extension headers,
144
- * prefer exact key names from your SBC; casing matches what Sofia exposes.
142
+ * **Snapshot only** — does not update on 180/200, re-INVITE, or BYE. Outbound B-legs /
143
+ * WS / headless typically have no snapshot (`undefined`). For mid-call peer signals use
144
+ * {@link ChannelSip.sipInfo$} (body/contentType only). Casing matches what Sofia exposes.
145
145
  */
146
146
  export type SipInviteHeaders = Record<string, string | string[]>;
147
147
  /**
@@ -187,10 +187,13 @@ export interface ChannelSip {
187
187
  */
188
188
  readonly dtmf$: Observable<DtmfEvent>;
189
189
  /**
190
- * Emits each incoming SIP INFO on this call leg (`contentType` + `body`).
190
+ * Mid-call SIP INFO stream use when the peer signals **during** the call
191
+ * (language change, vendor payload, etc.).
191
192
  *
192
- * Useful for carrier-specific signalling (e.g. `application/dtmf-relay`, XML payloads).
193
- * **Hot stream** events before subscribe are not replayed. Prefer {@link dtmf$} for DTMF.
193
+ * Each event is {@link SipInfo}: **`contentType` + `body` only**. Headers on
194
+ * the INFO request are not exposed. This does **not** update
195
+ * {@link inviteSipHeaders}. Prefer {@link dtmf$} for DTMF.
196
+ * **Hot stream** — events before subscribe are not replayed.
194
197
  *
195
198
  * ```ts
196
199
  * sip.sipInfo$.subscribe(({ contentType, body }) => {
@@ -216,7 +219,13 @@ export interface ChannelSip {
216
219
  */
217
220
  readonly remoteSdp?: string;
218
221
  /**
219
- * Snapshot of SIP headers from the **inbound INVITE** — see {@link SipInviteHeaders}.
222
+ * **Start-of-call** snapshot of SIP headers from the **inbound INVITE**
223
+ * (routing, `X-Trunk-Id`, `X-Neuro-UUID`, `X-language`, …). See {@link SipInviteHeaders}.
224
+ *
225
+ * Does **not** update on 180/200/re-INVITE/BYE. Outbound B-legs, WS, and headless
226
+ * usually have `undefined`. For mid-call peer signals use {@link sipInfo$}
227
+ * (body/contentType only — INFO headers are not available). Live response
228
+ * headers are not exposed; {@link sipSignal$} has status code/phrase/SDP only.
220
229
  *
221
230
  * ```ts
222
231
  * const h = channel.sip.inviteSipHeaders;
@@ -1 +1 @@
1
- {"version":3,"file":"sip.d.ts","sourceRoot":"","sources":["../../src/types/sip.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,MAAM,QAAQ,GAChB,MAAM,GACN,SAAS,GACT,OAAO,GACP,QAAQ,GACR,SAAS,GACT,YAAY,CAAC;AAEjB;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,gBAAgB;IAC/B,iCAAiC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,4EAA4E;IAC5E,YAAY,EAAE,MAAM,CAAC;IACrB,8EAA8E;IAC9E,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8EG;AACH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;AAEjE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,gBAAgB;IAC/B,6EAA6E;IAC7E,OAAO,EAAE;QACP,yCAAyC;QACzC,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,yBAAyB;QACzB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,+DAA+D;QAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,6CAA6C;QAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,mDAAmD;IACnD,UAAU,E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;;;OAOG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAElD;;;;;OAKG;IACH,IAAI,IAAI,IAAI,CAAC;IAEb;;OAEG;IACH,MAAM,IAAI,IAAI,CAAC;IAEf;;;;;;OAMG;IACH,IAAI,IAAI,IAAI,CAAC;IAEb,8EAA8E;IAC9E,MAAM,IAAI,IAAI,CAAC;IAEf;;;;;OAKG;IACH,MAAM,IAAI,IAAI,CAAC;IAEf;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,MAAM,IAAI,IAAI,CAAC;IAEf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;IACH,YAAY,IAAI,IAAI,CAAC;IAErB;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,QAAQ,CAAC,IAAI,EAAE;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACzC,mBAAmB,CAAC,EAAE;YACpB,SAAS,EAAE,MAAM,CAAC;YAClB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;SAC1C,CAAC;KACH,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAE1B;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,IAAI,CAAC;CACzC"}
@@ -0,0 +1,43 @@
1
+ # SDK usage examples
2
+
3
+ Runnable-style snippets for `@voctiv/agent-sdk`. Copy into your script project or use as reference.
4
+
5
+ Each file exports one `defineScript` handler. The host **always** invokes that single export — unlike logic-executor Python, it does **not** call separate functions by `entry_point` name.
6
+
7
+ | File | Topic |
8
+ |------|--------|
9
+ | [outbound-with-recall.ts](./outbound-with-recall.ts) | Outbound with `recallCount` / `recallDelay` |
10
+ | [recall-routing-by-attempt.ts](./recall-routing-by-attempt.ts) | Branch on `context.attempt` during online recall legs |
11
+ | [schedule-call-with-defaults.ts](./schedule-call-with-defaults.ts) | `platform.call()` using CMS defaults from `context` |
12
+ | [after-call-continuation.ts](./after-call-continuation.ts) | `onSuccessCall` / `onFailedCall` + `getScriptPhase()` |
13
+ | [read-recall-from-params.ts](./read-recall-from-params.ts) | `parseRecallDelaySeconds()` / `parseRecallCount()` |
14
+
15
+ ## Recall flow
16
+
17
+ 1. Script calls `platform.call(msisdn, { recallCount, recallDelay })`.
18
+ 2. Host stores params on the `call` row.
19
+ 3. On failed outbound, host schedules a new `call` with `date_added = now + recallDelay`.
20
+ 4. Dialer runs the **same script** again; `context.attempt` is incremented.
21
+ 5. Branch inside `defineScript` with `context.attempt`, not with a separate entry function.
22
+
23
+ Do **not** combine step 1 with `onFailedCall` on the same `platform.call()` — use one strategy per
24
+ scheduled outbound leg. See [after-call-continuation.ts](./after-call-continuation.ts) for the
25
+ script-driven failure path (`after_call_failed`).
26
+
27
+ ## Failed outbound: pick one strategy
28
+
29
+ | Need | Use | Avoid on the same `platform.call()` |
30
+ |------|-----|--------------------------------------|
31
+ | CMS-style automatic redials | `recallCount` + `recallDelay` (or omit both and let host default from `context` when no `onFailedCall`) | `onFailedCall` |
32
+ | Diagram / custom logic after failure | `onFailedCall` (+ branch on `getScriptPhase` → `after_call_failed`) | `recallCount` + `recallDelay` |
33
+
34
+ When `onFailedCall` is passed **explicitly** in `platform.call()` options, the host does
35
+ **not** auto-apply CMS `context.recallCount` / `context.recallDelay` to the new `call` row.
36
+ `on_failed_call` in dialog/Omni defaults is ignored for scheduling. If the script passes both
37
+ strategies in options, the host **drops recall** and keeps `onFailedCall`.
38
+
39
+ ## `entryPoint` vs logic-executor
40
+
41
+ In LE Python, `entry_point='main'` selects which script function runs.
42
+
43
+ In this host, `platform.call({ entryPoint })` only writes `entry_point` to DB params and sets `context.entryPoint` so **your** `defineScript` can branch (e.g. `getScriptPhase(context)` for headless after-call). Omit it when recall/online logic uses `context.attempt` only.
@@ -0,0 +1,47 @@
1
+ /**
2
+ * After-call routing with `onSuccessCall` / `onFailedCall` (headless continuation).
3
+ *
4
+ * Mutually exclusive with automatic recall (`recallCount` + `recallDelay`) on the same
5
+ * `platform.call()`. If both are passed, the host keeps `onFailedCall` and drops recall.
6
+ *
7
+ * When `onFailedCall` is set, CMS `context.recallCount` / `context.recallDelay` are not
8
+ * auto-applied to the scheduled `call` row; the after-call branch runs on failure instead.
9
+ *
10
+ * On call end the host sets `dialog.params.entry_point` to the configured handler name
11
+ * and runs the **same** `defineScript` export headlessly. Branch with
12
+ * `getScriptPhase(context)` (`after_call_success` / `after_call_failed`).
13
+ */
14
+ import { defineScript, getScriptPhase } from '@voctiv/agent-sdk';
15
+
16
+ export default defineScript(async ({ channel, context, logger, platform }) => {
17
+ const phase = getScriptPhase(context);
18
+
19
+ if (context.headless && phase === 'after_call_failed') {
20
+ logger.log('Post-call offline branch after failed outbound');
21
+ await platform.messaging.send({
22
+ src: 'bot',
23
+ destination: context.msisdn || '',
24
+ text: 'Sorry we missed you. Reply to reschedule.',
25
+ });
26
+ platform.dialog.result = 'done';
27
+ return { output: { phase } };
28
+ }
29
+
30
+ if (context.headless && phase === 'after_call_success') {
31
+ logger.log('Post-call offline branch after successful call');
32
+ return { output: { phase } };
33
+ }
34
+
35
+ channel.sip.answer();
36
+ await channel.audio.say('Starting outbound attempt.');
37
+
38
+ const msisdn = context.msisdn || context.callerId;
39
+ if (!msisdn) return;
40
+
41
+ await platform.call(msisdn, {
42
+ onSuccessCall: 'on_success_call',
43
+ onFailedCall: 'on_failed_call',
44
+ });
45
+
46
+ logger.log('Scheduled outbound with after-call headless handlers (no automatic recall)');
47
+ });
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Schedule an outbound call that the platform will retry on failure.
3
+ *
4
+ * The host runs a single `defineScript` handler — there is no separate runtime
5
+ * entry per `entry_point` like logic-executor Python `run_unit(entry_point=...)`.
6
+ * Recall legs are the same script again with an incremented `context.attempt`.
7
+ *
8
+ * Do not combine recall options with `onFailedCall` on the same `platform.call()`.
9
+ * When `onFailedCall` is configured, CMS recall is not auto-applied to the call row.
10
+ * See README § "Failed outbound: automatic recall vs after-call continuation".
11
+ */
12
+ import { defineScript } from '@voctiv/agent-sdk';
13
+
14
+ const RECALL_COUNT = 3;
15
+ /** Delay between failed attempts, in seconds (5 minutes). */
16
+ const RECALL_DELAY_SEC = 300;
17
+
18
+ export default defineScript(async ({ channel, context, logger, platform }) => {
19
+ channel.sip.answer();
20
+
21
+ const msisdn = context.msisdn || context.callerId;
22
+ if (!msisdn) {
23
+ logger.error('No msisdn on context');
24
+ return;
25
+ }
26
+
27
+ await channel.audio.say(
28
+ 'We will call you back shortly. If we cannot reach you, we will retry a few times.',
29
+ );
30
+
31
+ await platform.call(msisdn, {
32
+ recallCount: RECALL_COUNT,
33
+ recallDelay: RECALL_DELAY_SEC,
34
+ });
35
+
36
+ logger.log('Outbound scheduled with recall', {
37
+ msisdn,
38
+ recallCount: RECALL_COUNT,
39
+ recallDelaySec: RECALL_DELAY_SEC,
40
+ });
41
+
42
+ return { output: { scheduled: true } };
43
+ });