@voctiv/agent-sdk 0.2.12 → 0.2.13
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.
- package/README.md +119 -5
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/types/events.d.ts +13 -8
- package/dist/types/events.d.ts.map +1 -1
- package/dist/types/nlu.d.ts +9 -11
- package/dist/types/nlu.d.ts.map +1 -1
- package/dist/types/platform.d.ts +18 -9
- package/dist/types/platform.d.ts.map +1 -1
- package/dist/types/script-context.d.ts +42 -7
- package/dist/types/script-context.d.ts.map +1 -1
- package/dist/types/script-context.js.map +1 -1
- package/dist/types/sip.d.ts +79 -5
- package/dist/types/sip.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -173,6 +173,70 @@ On SIP channels, `channel.audio.say()` and `channel.audio.play()` automatically
|
|
|
173
173
|
|
|
174
174
|
If the call terminates before media becomes available, deferred audio resolves as a no-op.
|
|
175
175
|
|
|
176
|
+
### SIP Signalling Metadata
|
|
177
|
+
|
|
178
|
+
On **SIP channels**, `channel.sip` exposes raw signalling beyond call state — useful for
|
|
179
|
+
carrier routing, diversion chains, and vendor SDP attributes.
|
|
180
|
+
|
|
181
|
+
#### INVITE headers (`inviteSipHeaders`)
|
|
182
|
+
|
|
183
|
+
Snapshot of SIP headers from an **inbound INVITE** at call setup. Includes standard and
|
|
184
|
+
extension headers (`Diversion`, `P-Asserted-Identity`, `X-Trunk-Id`, `X-Neuro-UUID`, …).
|
|
185
|
+
|
|
186
|
+
| Property | Updates during call? |
|
|
187
|
+
| --- | --- |
|
|
188
|
+
| `inviteSipHeaders` | **No** — INVITE snapshot only; outbound B-legs usually `undefined` |
|
|
189
|
+
|
|
190
|
+
```ts
|
|
191
|
+
const h = channel.sip.inviteSipHeaders;
|
|
192
|
+
const diversion = h?.Diversion; // string | string[] when multiple hops
|
|
193
|
+
const trunkId = h?.['X-Trunk-Id'];
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Header names match what the host stack exposes (case-sensitive). Duplicate headers become
|
|
197
|
+
`string[]`.
|
|
198
|
+
|
|
199
|
+
#### Remote SDP (`remoteSdp`, `getRemoteSdpDetails()`)
|
|
200
|
+
|
|
201
|
+
| Property / method | Updates during call? |
|
|
202
|
+
| --- | --- |
|
|
203
|
+
| `remoteSdp` | **Yes** — latest negotiated remote SDP (INVITE, 183, 200, re-INVITE) |
|
|
204
|
+
| `getRemoteSdpDetails()` | **Yes** — re-parses current `remoteSdp` on each call |
|
|
205
|
+
|
|
206
|
+
```ts
|
|
207
|
+
const raw = channel.sip.remoteSdp;
|
|
208
|
+
const details = channel.sip.getRemoteSdpDetails();
|
|
209
|
+
|
|
210
|
+
details?.session.connection; // e.g. "IN IP4 203.0.113.5"
|
|
211
|
+
details?.attributes.rtpmap; // e.g. "0 PCMU/8000"
|
|
212
|
+
details?.attributes['x-vendor-tag']; // custom a=x-vendor-tag:...
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
`getRemoteSdpDetails()` parses session lines (`o=`, `s=`, `c=`, `m=audio`) and all `a=`
|
|
216
|
+
attributes. It is not a full SDP validator — use `remoteSdp` when you need the raw body.
|
|
217
|
+
|
|
218
|
+
#### SIP INFO (`sipInfo$`)
|
|
219
|
+
|
|
220
|
+
Live stream of incoming SIP INFO messages (`contentType` + `body`). Prefer `dtmf$` for DTMF.
|
|
221
|
+
|
|
222
|
+
```ts
|
|
223
|
+
channel.sip.sipInfo$.subscribe(({ contentType, body }) => {
|
|
224
|
+
logger.log('SIP INFO', { contentType, body });
|
|
225
|
+
});
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Events before subscribe are not replayed.
|
|
229
|
+
|
|
230
|
+
#### Relating streams to SDP
|
|
231
|
+
|
|
232
|
+
| Stream | `sdp` field |
|
|
233
|
+
| --- | --- |
|
|
234
|
+
| `progress$` | Present when a 1xx response carries SDP (e.g. 183 early media) |
|
|
235
|
+
| `sipSignal$` | Present only on callbacks that include SDP; often empty on final `active` |
|
|
236
|
+
|
|
237
|
+
For the **persisted** negotiated SDP, use `remoteSdp` / `getRemoteSdpDetails()`, not only
|
|
238
|
+
the per-event `sdp` on `sipSignal$`.
|
|
239
|
+
|
|
176
240
|
### SIP Controls
|
|
177
241
|
|
|
178
242
|
`channel.sip` also supports:
|
|
@@ -202,8 +266,11 @@ SIP-only unless noted. WS/headless: most methods are no-ops; `state` behaves as
|
|
|
202
266
|
| `early$` | Emits once when RTP is up before final answer |
|
|
203
267
|
| `answered$` | Emits once on 200 OK |
|
|
204
268
|
| `dtmf$` | Remote DTMF digits (`DtmfEvent`: `digit`, `duration`) |
|
|
205
|
-
| `sipInfo$` |
|
|
206
|
-
| `sipSignal$` | Low-level SIP stack events (`SipSignal`) |
|
|
269
|
+
| `sipInfo$` | Live incoming SIP INFO (`SipInfo`: `contentType`, `body`) |
|
|
270
|
+
| `sipSignal$` | Low-level SIP stack events (`SipSignal`; `sdp` only on that callback) |
|
|
271
|
+
| `remoteSdp` | Latest negotiated remote SDP body; updates when new SDP arrives |
|
|
272
|
+
| `inviteSipHeaders` | Inbound INVITE header snapshot (`SipInviteHeaders`); does not update |
|
|
273
|
+
| `getRemoteSdpDetails()` | Parse `remoteSdp` → `ParsedSdpDetails` (session + `a=` attributes) |
|
|
207
274
|
| `sendProgress()` | Inbound: send 183 Session Progress → `early` |
|
|
208
275
|
| `waitForEarly()` | Await `early` or `active` (Promise) |
|
|
209
276
|
| `waitForAnswer()` | Await final 200 OK (Promise) |
|
|
@@ -216,7 +283,10 @@ SIP-only unless noted. WS/headless: most methods are no-ops; `state` behaves as
|
|
|
216
283
|
| `makeCall(opts)` | Outbound B-leg (`MediaChannel`); `sipUri` or `msisdn` |
|
|
217
284
|
| `bridge(other)` | Cross-connect two SIP calls; returns teardown `() => void` |
|
|
218
285
|
|
|
219
|
-
Prefer `dtmf$` over `sipInfo$` for DTMF. Prefer `state$` / `early$` / `answered$` over raw
|
|
286
|
+
Prefer `dtmf$` over `sipInfo$` for DTMF. Prefer `state$` / `early$` / `answered$` over raw
|
|
287
|
+
`sipSignal$` for call lifecycle. Use `remoteSdp` / `getRemoteSdpDetails()` for negotiated
|
|
288
|
+
media description; use `inviteSipHeaders` for routing headers from the inbound INVITE.
|
|
289
|
+
See **SIP Signalling Metadata** above.
|
|
220
290
|
|
|
221
291
|
### SIP Bridge
|
|
222
292
|
|
|
@@ -926,6 +996,11 @@ await platform.call('+12025551234', {
|
|
|
926
996
|
|
|
927
997
|
This means the platform may retry up to three times, waiting about five minutes between attempts.
|
|
928
998
|
|
|
999
|
+
When you omit these options, the host fills defaults from `context.recallCount` / `context.recallDelay`
|
|
1000
|
+
(effective values for the current dialog). Those in turn fall back to CMS agent contact-rules
|
|
1001
|
+
(`context.agent?.recallCount` / `context.agent?.recallDelay`, legacy `nn.get_recall_count()` /
|
|
1002
|
+
`nn.get_recall_delay()`).
|
|
1003
|
+
|
|
929
1004
|
Other scheduling options:
|
|
930
1005
|
|
|
931
1006
|
- `priority`: higher-priority calls can be processed earlier by the dialer.
|
|
@@ -1085,9 +1160,9 @@ export default defineScript(async ({ channel, context, platform }) => {
|
|
|
1085
1160
|
|
|
1086
1161
|
`context` includes identity, telephony fields, params, routing metadata, and runtime helpers.
|
|
1087
1162
|
|
|
1088
|
-
### Agent env and storage
|
|
1163
|
+
### Agent env, recall defaults, and storage
|
|
1089
1164
|
|
|
1090
|
-
When the host exposes agent identity, `context.agent` provides agent-scoped
|
|
1165
|
+
When the host exposes agent identity, `context.agent` provides agent-scoped helpers:
|
|
1091
1166
|
|
|
1092
1167
|
```ts
|
|
1093
1168
|
// Read all agent env keys
|
|
@@ -1100,6 +1175,42 @@ const counter = await context.agent?.env?.<number>('visitCount');
|
|
|
1100
1175
|
await context.agent?.env?.('visitCount', 42, { expire: 30 });
|
|
1101
1176
|
```
|
|
1102
1177
|
|
|
1178
|
+
#### Recall settings (agent defaults vs effective)
|
|
1179
|
+
|
|
1180
|
+
Recall behavior uses **two layers** on `context`:
|
|
1181
|
+
|
|
1182
|
+
| Layer | Fields | Source | Use when |
|
|
1183
|
+
|-------|--------|--------|----------|
|
|
1184
|
+
| Agent defaults | `context.agent?.recallCount`, `context.agent?.recallDelay` | CMS contact-rules (`agent.recall_count`, `agent.delay` → seconds) | Compare with CMS settings; legacy `nn.get_recall_count()` / `get_recall_delay()` parity |
|
|
1185
|
+
| Effective for this run | `context.recallCount`, `context.recallDelay` | `dialog.params` / `call.params`, then agent defaults | Schedule outbound calls, recall routing logic |
|
|
1186
|
+
|
|
1187
|
+
Precedence for effective values: **dialog/call params** (`recall_count`, `recall_delay`) **>** agent CMS defaults.
|
|
1188
|
+
|
|
1189
|
+
`context.attempt` is the current recall attempt counter from `dialog.params.attempt` (starts at 0).
|
|
1190
|
+
`context.entryPoint` is the routing branch for this run (e.g. after a failed call).
|
|
1191
|
+
|
|
1192
|
+
```ts
|
|
1193
|
+
// Use effective values when scheduling the next outbound leg
|
|
1194
|
+
await context.platform?.call?.(msisdn, {
|
|
1195
|
+
recallCount: context.recallCount,
|
|
1196
|
+
recallDelay: context.recallDelay,
|
|
1197
|
+
entryPoint: 'on_follow_up',
|
|
1198
|
+
});
|
|
1199
|
+
|
|
1200
|
+
// Log CMS defaults vs per-dialog override
|
|
1201
|
+
logger.log('recall config', {
|
|
1202
|
+
effective: { count: context.recallCount, delay: context.recallDelay },
|
|
1203
|
+
agentDefault: {
|
|
1204
|
+
count: context.agent?.recallCount,
|
|
1205
|
+
delay: context.agent?.recallDelay,
|
|
1206
|
+
},
|
|
1207
|
+
attempt: context.attempt,
|
|
1208
|
+
});
|
|
1209
|
+
```
|
|
1210
|
+
|
|
1211
|
+
Values are loaded once at script start from the legacy agent row (cached with other LE agent
|
|
1212
|
+
resolution). They are plain snapshots — not `BehaviorSubject`s and not re-fetched during the run.
|
|
1213
|
+
|
|
1103
1214
|
`context.storage('key1', 'key2')` reads CMS/global variables from agent settings, then company-level
|
|
1104
1215
|
fallback. Always returns an object with every requested key (value or `null`).
|
|
1105
1216
|
|
|
@@ -1125,6 +1236,9 @@ Important fields:
|
|
|
1125
1236
|
- `context.initialData`: shallow snapshot of params at script start.
|
|
1126
1237
|
- `context.dialogParams`: live param map for the run.
|
|
1127
1238
|
- `context.entryPoint`: current routing entry point.
|
|
1239
|
+
- `context.attempt`: current recall attempt number (`dialog.params.attempt`).
|
|
1240
|
+
- `context.recallCount` / `context.recallDelay`: effective recall settings for this dialog/call.
|
|
1241
|
+
- `context.agent?.recallCount` / `context.agent?.recallDelay`: CMS agent defaults (immutable snapshot).
|
|
1128
1242
|
- `context.headless`: true for offline/queue/messaging sessions without a real media channel.
|
|
1129
1243
|
- `context.runTime`: async execution budget helper.
|
|
1130
1244
|
- `context.env$`: persisted dialog environment as an RxJS `BehaviorSubject`.
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,13 @@
|
|
|
19
19
|
*
|
|
20
20
|
* Platform APIs (`platform.nlu`, `platform.call`, messaging, dialog writes, phrase records)
|
|
21
21
|
* are available when the host enables platform integration.
|
|
22
|
+
*
|
|
23
|
+
* ### SIP metadata on live calls
|
|
24
|
+
*
|
|
25
|
+
* On SIP channels, {@link import('./types/sip').ChannelSip} exposes INVITE header snapshots
|
|
26
|
+
* ({@link import('./types/sip').SipInviteHeaders}), negotiated {@link import('./types/sip').ChannelSip.remoteSdp},
|
|
27
|
+
* parsed SDP attributes ({@link import('./types/sip').ParsedSdpDetails} via `getRemoteSdpDetails()`),
|
|
28
|
+
* and live SIP INFO ({@link import('./types/events').SipInfo} on `sipInfo$`). See **`README.md`** → SIP Signalling Metadata.
|
|
22
29
|
*/
|
|
23
30
|
export { defineScript } from './define-script';
|
|
24
31
|
export type { ScriptContext, ScriptFn } from './define-script';
|
|
@@ -28,7 +35,7 @@ export type { NluScriptApi, PlatformApi, DialogApi, ScheduleCallOptions, SendMes
|
|
|
28
35
|
export type { ScriptLogger } from './types/logger';
|
|
29
36
|
export type { MediaChannel, ChannelAudio, ChannelEvents, } from './types/media-channel';
|
|
30
37
|
export type { ChannelLlm, LlmOptions, LlmStreamChunk, ExtractOptions, PersistentLlmStreamHandle, } from './types/llm';
|
|
31
|
-
export type { ChannelSip, SipState, SipProgressEvent, } from './types/sip';
|
|
38
|
+
export type { ChannelSip, SipState, SipProgressEvent, SipInviteHeaders, ParsedSdpDetails, } from './types/sip';
|
|
32
39
|
export type { MediaError } from './types/errors';
|
|
33
40
|
export type { AsrHandle, AsrConfig, AsrVadConfig, AsrSmartTurnConfig } from './types/asr-handle';
|
|
34
41
|
export type { MixerQueueControl, PlayOptions, PresayOptions, PreloadOptions, TtsStrategy, TtsVendor } from './types/mixer';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE/D,YAAY,EACV,mBAAmB,EACnB,WAAW,EACX,aAAa,EACb,YAAY,EACZ,qBAAqB,EACrB,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,YAAY,EACV,YAAY,EACZ,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,YAAY,GACb,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,YAAY,EACV,YAAY,EACZ,YAAY,EACZ,aAAa,GACd,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EACV,UAAU,EACV,UAAU,EACV,cAAc,EACd,cAAc,EACd,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACjG,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC3H,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,YAAY,GACb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,YAAY,EACV,SAAS,EACT,OAAO,EACP,SAAS,EACT,WAAW,GACZ,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,13 @@
|
|
|
20
20
|
*
|
|
21
21
|
* Platform APIs (`platform.nlu`, `platform.call`, messaging, dialog writes, phrase records)
|
|
22
22
|
* are available when the host enables platform integration.
|
|
23
|
+
*
|
|
24
|
+
* ### SIP metadata on live calls
|
|
25
|
+
*
|
|
26
|
+
* On SIP channels, {@link import('./types/sip').ChannelSip} exposes INVITE header snapshots
|
|
27
|
+
* ({@link import('./types/sip').SipInviteHeaders}), negotiated {@link import('./types/sip').ChannelSip.remoteSdp},
|
|
28
|
+
* parsed SDP attributes ({@link import('./types/sip').ParsedSdpDetails} via `getRemoteSdpDetails()`),
|
|
29
|
+
* and live SIP INFO ({@link import('./types/events').SipInfo} on `sipInfo$`). See **`README.md`** → SIP Signalling Metadata.
|
|
23
30
|
*/
|
|
24
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
32
|
exports.isLegacyPhraseRecord = exports.LEGACY_PHRASE_RECORD_BRAND = exports.getScriptPhase = exports.defineScript = void 0;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;;AAEH,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;AAerB,yDAAwD;AAA/C,gHAAA,cAAc,OAAA;AA4CvB,uDAG+B;AAF7B,2HAAA,0BAA0B,OAAA;AAC1B,qHAAA,oBAAoB,OAAA"}
|
package/dist/types/events.d.ts
CHANGED
|
@@ -5,22 +5,27 @@ 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. */
|
|
8
|
+
/** Incoming SIP INFO message on a live SIP call leg. */
|
|
9
9
|
export interface SipInfo {
|
|
10
|
-
/** MIME content type (e.g. `"application/dtmf-relay"`).
|
|
10
|
+
/** MIME content type (e.g. `"application/dtmf-relay"`, `"application/xml"`). */
|
|
11
11
|
contentType: string;
|
|
12
|
-
/**
|
|
12
|
+
/** Raw message body as received from the stack. */
|
|
13
13
|
body: string;
|
|
14
14
|
}
|
|
15
|
-
/** SIP
|
|
15
|
+
/** Low-level Sofia SIP stack state-change event (see also {@link import('./sip').SipState}). */
|
|
16
16
|
export interface SipSignal {
|
|
17
|
-
/** Raw telephony/Sofia call state
|
|
17
|
+
/** Raw telephony/Sofia call state string (not normalized to SDK {@link import('./sip').SipState}). */
|
|
18
18
|
state: string;
|
|
19
|
-
/** SIP response status code (e.g. `200`, `486`). */
|
|
19
|
+
/** SIP response status code when present (e.g. `180`, `183`, `200`, `486`). */
|
|
20
20
|
statusCode?: number;
|
|
21
|
-
/** SIP response reason phrase. */
|
|
21
|
+
/** SIP response reason phrase when present. */
|
|
22
22
|
statusPhrase?: string;
|
|
23
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* SDP body attached to **this** state callback only.
|
|
25
|
+
*
|
|
26
|
+
* Often empty on `active` (200 OK) when SDP was already received on an earlier 183/INVITE.
|
|
27
|
+
* Use {@link import('./sip').ChannelSip.remoteSdp} for the persisted negotiated SDP.
|
|
28
|
+
*/
|
|
24
29
|
sdp?: string;
|
|
25
30
|
}
|
|
26
31
|
/** Arbitrary data message used for WS data-channel communication between script and client. */
|
|
@@ -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,
|
|
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"}
|
package/dist/types/nlu.d.ts
CHANGED
|
@@ -2,32 +2,30 @@
|
|
|
2
2
|
* Options for `platform.nlu.extract()`.
|
|
3
3
|
*
|
|
4
4
|
* Compatible with logic-executor `NeuroNluRecognitionRequest`. ScriptEngine forwards
|
|
5
|
-
*
|
|
6
|
-
* `
|
|
7
|
-
* kept in the SDK for source compatibility with older scripts, but are not
|
|
8
|
-
* part of the default ScriptEngine request payload.
|
|
5
|
+
* all fields to nlu-engine `/nlu_engine`. Exclude fields (`entities_exclude`,
|
|
6
|
+
* `intents_exclude`) are mapped to `entities_policy` / `intents_policy`.
|
|
9
7
|
*/
|
|
10
8
|
export interface NluExtractOptions {
|
|
11
9
|
/** Include only these entity types (e.g. `"date"`, `"phone"`); forwarded as `entities`. */
|
|
12
10
|
entities?: string | string[] | null;
|
|
13
|
-
/** Legacy compatibility field;
|
|
11
|
+
/** Legacy compatibility field; mapped to exclude policy on nlu-engine. */
|
|
14
12
|
entities_exclude?: string | string[] | null;
|
|
15
13
|
/** Include only these intent names; forwarded as `intents`. */
|
|
16
14
|
intents?: string | string[] | null;
|
|
17
|
-
/** Legacy compatibility field;
|
|
15
|
+
/** Legacy compatibility field; mapped to exclude policy on nlu-engine. */
|
|
18
16
|
intents_exclude?: string | string[] | null;
|
|
19
17
|
/**
|
|
20
18
|
* Additional context for disambiguation.
|
|
21
19
|
*
|
|
22
|
-
* Objects and arrays are JSON-stringified before sending.
|
|
23
|
-
*
|
|
20
|
+
* Objects and arrays are JSON-stringified before sending. Omitted when not set
|
|
21
|
+
* (logic-executor default).
|
|
24
22
|
*/
|
|
25
23
|
context?: string | unknown[] | Record<string, unknown> | null;
|
|
26
|
-
/** Forwarded as `use_neuro_api`;
|
|
24
|
+
/** Forwarded as `use_neuro_api`; nlu-engine may call remote NLU API when true. */
|
|
27
25
|
use_neuro_api?: boolean;
|
|
28
|
-
/** Forwarded as `use_synonyms`; enables synonym expansion in
|
|
26
|
+
/** Forwarded as `use_synonyms`; enables synonym expansion in nlu-engine. */
|
|
29
27
|
use_synonyms?: boolean;
|
|
30
28
|
}
|
|
31
|
-
/** Raw parsed JSON response from
|
|
29
|
+
/** Raw parsed JSON response from nlu-engine `/nlu_engine` endpoint. */
|
|
32
30
|
export type NluInferResult = Record<string, unknown>;
|
|
33
31
|
//# sourceMappingURL=nlu.d.ts.map
|
package/dist/types/nlu.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nlu.d.ts","sourceRoot":"","sources":["../../src/types/nlu.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"nlu.d.ts","sourceRoot":"","sources":["../../src/types/nlu.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;IACpC,0EAA0E;IAC1E,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;IAC5C,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;IACnC,0EAA0E;IAC1E,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;IAC3C;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC9D,kFAAkF;IAClF,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,uEAAuE;AACvE,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC"}
|
package/dist/types/platform.d.ts
CHANGED
|
@@ -4,9 +4,11 @@ import type { LegacyGetRecordsParams, LegacyPhraseRecord } from './legacy-phrase
|
|
|
4
4
|
/**
|
|
5
5
|
* NLU (Natural Language Understanding) API.
|
|
6
6
|
*
|
|
7
|
-
* Provides intent/entity extraction through the
|
|
7
|
+
* Provides intent/entity extraction through the pool-local nlu-engine
|
|
8
|
+
* (`POST /nlu_engine?agent_id=…`), same path as logic-executor
|
|
9
|
+
* `NeuroNluClient.recognize_with_proxy`.
|
|
8
10
|
* ScriptEngine allows this API when `context.legacyV3Compat` is `true` and NLU
|
|
9
|
-
* runtime settings are configured (`
|
|
11
|
+
* runtime settings are configured (`NLU_ENGINE_BASE_URL` plus a resolved numeric
|
|
10
12
|
* agent id). Calls fail fast with a descriptive error otherwise.
|
|
11
13
|
*
|
|
12
14
|
* Compatible with logic-executor `nn.extract()` request/response shape.
|
|
@@ -15,14 +17,14 @@ export interface NluScriptApi {
|
|
|
15
17
|
/**
|
|
16
18
|
* Extract intents and entities from one user utterance.
|
|
17
19
|
*
|
|
18
|
-
* The runtime sends
|
|
19
|
-
*
|
|
20
|
-
*
|
|
20
|
+
* The runtime sends a logic-executor-compatible recognition request to
|
|
21
|
+
* nlu-engine (`/nlu_engine?agent_id=…`). Context is included only when
|
|
22
|
+
* `options.context` is set explicitly.
|
|
21
23
|
*
|
|
22
24
|
* @param utterance - User input text to analyze.
|
|
23
25
|
* @param options - Optional NLU filters and flags. `entities`, `intents`,
|
|
24
26
|
* `use_neuro_api`, and `use_synonyms` are forwarded by ScriptEngine.
|
|
25
|
-
* @returns Raw parsed JSON response from
|
|
27
|
+
* @returns Raw parsed JSON response from nlu-engine (recognition result dump).
|
|
26
28
|
*/
|
|
27
29
|
extract(utterance: string, options?: NluExtractOptions): Promise<NluInferResult>;
|
|
28
30
|
/**
|
|
@@ -58,9 +60,15 @@ export interface ScheduleCallOptions {
|
|
|
58
60
|
* Forwarded to the dialer for `X-Via-Trunk` / gateway routing.
|
|
59
61
|
*/
|
|
60
62
|
channel?: string | number;
|
|
61
|
-
/**
|
|
63
|
+
/**
|
|
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}.
|
|
66
|
+
*/
|
|
62
67
|
recallCount?: number;
|
|
63
|
-
/**
|
|
68
|
+
/**
|
|
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}.
|
|
71
|
+
*/
|
|
64
72
|
recallDelay?: number;
|
|
65
73
|
/** Entry point to use after a successful call. Stored as `on_success_call`. */
|
|
66
74
|
onSuccessCall?: string;
|
|
@@ -174,7 +182,8 @@ export interface PlatformApi {
|
|
|
174
182
|
/**
|
|
175
183
|
* Voctiv platform only: load `record_phrase` / `record_phrase_file` rows from the LE PostgreSQL database
|
|
176
184
|
* (same filters as old `RecordPhrase.get_records`). Returns playable phrase record objects.
|
|
177
|
-
* Requires numeric `
|
|
185
|
+
* Requires a resolved numeric LE `agent.id` (dialog / leAgentId / Omni nlu.agentId).
|
|
186
|
+
* Optional dev fallback: `NLU_DEFAULT_AGENT_ID`.
|
|
178
187
|
* `LEGACY_V3_RECORD_PHRASE_ROOT` pointing at the phrase file storage root.
|
|
179
188
|
*/
|
|
180
189
|
getRecords?(params: LegacyGetRecordsParams): Promise<LegacyPhraseRecord[]>;
|
|
@@ -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,KA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;IAC3B;;;OAGG;IACH,IAAI,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,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,wDAAwD;IACxD,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"}
|
|
@@ -5,7 +5,7 @@ export interface AgentEnvSetOptions {
|
|
|
5
5
|
/** TTL in days, matching legacy `nn.agent.env(..., expire=days)`. */
|
|
6
6
|
expire?: number;
|
|
7
7
|
}
|
|
8
|
-
/** Legacy LE-style global
|
|
8
|
+
/** Legacy LE-style agent profile and global env shared by all dialogs of the agent. */
|
|
9
9
|
export interface AgentContext {
|
|
10
10
|
/** Numeric NLU / LE agent id, when resolved by the host. */
|
|
11
11
|
id?: number;
|
|
@@ -18,6 +18,22 @@ export interface AgentContext {
|
|
|
18
18
|
(key: string, value: unknown, options?: AgentEnvSetOptions): Promise<void>;
|
|
19
19
|
(values: Record<string, unknown>, options?: AgentEnvSetOptions): Promise<void>;
|
|
20
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* CMS / LE contact-rules default: `agent.recall_count`.
|
|
23
|
+
*
|
|
24
|
+
* Snapshot at script start (immutable for this session). Legacy parity: `nn.get_recall_count()`.
|
|
25
|
+
* For the value that applies to the **current** dialog/call (including per-dialog overrides),
|
|
26
|
+
* use top-level {@link ScriptDialogContext.recallCount}.
|
|
27
|
+
*/
|
|
28
|
+
recallCount?: number;
|
|
29
|
+
/**
|
|
30
|
+
* CMS / LE contact-rules default: `agent.delay`, converted to **seconds**.
|
|
31
|
+
*
|
|
32
|
+
* Snapshot at script start (immutable for this session). Legacy parity: `nn.get_recall_delay()`
|
|
33
|
+
* (LE returns a time string; the host normalizes to seconds here).
|
|
34
|
+
* For the effective delay on this dialog/call, use top-level {@link ScriptDialogContext.recallDelay}.
|
|
35
|
+
*/
|
|
36
|
+
recallDelay?: number;
|
|
21
37
|
}
|
|
22
38
|
/** Read LE/CMS global variables from `storage` with agent → company fallback. */
|
|
23
39
|
export type StorageContextApi = (...keys: string[]) => Promise<Record<string, string | null>>;
|
|
@@ -52,13 +68,19 @@ export interface ScriptDialogContext {
|
|
|
52
68
|
/**
|
|
53
69
|
* Numeric NLU agent id used for `platform.nlu.extract()` and legacy DB operations.
|
|
54
70
|
*
|
|
55
|
-
* Resolved by the server from
|
|
56
|
-
* `AGENT_ID`). Client/session params named `agent_id`, `agentId`, `agentUuid`,
|
|
71
|
+
* Resolved by the server from LE dialog/call, Omni `nlu.agentId`, or optional env
|
|
72
|
+
* (`NLU_DEFAULT_AGENT_ID` / `AGENT_ID`). Client/session params named `agent_id`, `agentId`, `agentUuid`,
|
|
57
73
|
* and `agent_uuid` are stripped before context construction and cannot spoof it.
|
|
58
74
|
* May be `0` when no agent id is configured; NLU and `platform.call()` will then fail.
|
|
59
75
|
*/
|
|
60
76
|
agentId: number;
|
|
61
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* Agent identity, CMS recall defaults, and legacy global agent env (`context.agent.env`).
|
|
79
|
+
*
|
|
80
|
+
* {@link AgentContext.recallCount} / {@link AgentContext.recallDelay} are agent-wide settings
|
|
81
|
+
* from CMS. Top-level {@link ScriptDialogContext.recallCount} / {@link ScriptDialogContext.recallDelay}
|
|
82
|
+
* are the **effective** values for this run (dialog/call params override agent defaults).
|
|
83
|
+
*/
|
|
62
84
|
agent?: AgentContext;
|
|
63
85
|
/**
|
|
64
86
|
* Read global variables configured in agent settings, then company-level globals.
|
|
@@ -125,11 +147,24 @@ export interface ScriptDialogContext {
|
|
|
125
147
|
availableMediaKeys?: string[];
|
|
126
148
|
/** Script entry point for routing (e.g. `"on_recall"`, `"on_message_api_received"`). */
|
|
127
149
|
entryPoint?: string;
|
|
128
|
-
/** Current recall attempt number (starts at 0). */
|
|
150
|
+
/** Current recall attempt number for this dialog (from `dialog.params.attempt`, starts at 0). */
|
|
129
151
|
attempt?: number;
|
|
130
|
-
/**
|
|
152
|
+
/**
|
|
153
|
+
* Effective max recall attempts for **this** dialog/call.
|
|
154
|
+
*
|
|
155
|
+
* Resolved at script start: `dialog.params` / `call.params` (`recall_count`) override
|
|
156
|
+
* {@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.
|
|
159
|
+
*/
|
|
131
160
|
recallCount?: number;
|
|
132
|
-
/**
|
|
161
|
+
/**
|
|
162
|
+
* Effective delay in **seconds** between recall attempts for **this** dialog/call.
|
|
163
|
+
*
|
|
164
|
+
* Resolved at script start: `dialog.params` / `call.params` (`recall_delay`) override
|
|
165
|
+
* {@link AgentContext.recallDelay} from CMS (`agent.delay` converted to seconds).
|
|
166
|
+
* Omitted when no value is configured.
|
|
167
|
+
*/
|
|
133
168
|
recallDelay?: number;
|
|
134
169
|
/**
|
|
135
170
|
* Inbound message that triggered this headless session.
|
|
@@ -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;AAE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MAAM,WAAW,YAAY;IAC3B,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,uEAAuE;IACvE,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAsB,SAAQ,YAAY;IACzD,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"script-context.js","sourceRoot":"","sources":["../../src/types/script-context.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"script-context.js","sourceRoot":"","sources":["../../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"}
|
package/dist/types/sip.d.ts
CHANGED
|
@@ -132,6 +132,49 @@ export interface SipProgressEvent {
|
|
|
132
132
|
* `waitForAnswer()` await points are useful when you need to **sequence logic** around
|
|
133
133
|
* call state (e.g. create ASR only after media is available).
|
|
134
134
|
*/
|
|
135
|
+
/**
|
|
136
|
+
* SIP headers captured from an **inbound INVITE** at call setup.
|
|
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).
|
|
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.
|
|
145
|
+
*/
|
|
146
|
+
export type SipInviteHeaders = Record<string, string | string[]>;
|
|
147
|
+
/**
|
|
148
|
+
* Structured parse of {@link ChannelSip.remoteSdp}.
|
|
149
|
+
*
|
|
150
|
+
* Parses selected session lines (`o=`, `s=`, `c=`, `m=audio`) and all `a=` attribute lines.
|
|
151
|
+
* Attribute keys are the part **before** the first colon in `a=name:value` (e.g. `rtpmap`,
|
|
152
|
+
* `fmtp`, vendor `x-custom`). Flag attributes without a colon (e.g. `sendrecv`) map to `""`.
|
|
153
|
+
* Duplicate attribute names become `string[]`.
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```ts
|
|
157
|
+
* const d = channel.sip.getRemoteSdpDetails();
|
|
158
|
+
* d?.session.connection; // "IN IP4 203.0.113.5"
|
|
159
|
+
* d?.attributes.rtpmap; // "0 PCMU/8000"
|
|
160
|
+
* d?.attributes['x-vendor-id']; // custom a=x-vendor-id:abc
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
export interface ParsedSdpDetails {
|
|
164
|
+
/** Selected SDP session description lines (not a full SDP grammar parse). */
|
|
165
|
+
session: {
|
|
166
|
+
/** `o=` origin line (without prefix). */
|
|
167
|
+
origin?: string;
|
|
168
|
+
/** `s=` session name. */
|
|
169
|
+
sessionName?: string;
|
|
170
|
+
/** Last `c=` connection line seen (session or media level). */
|
|
171
|
+
connection?: string;
|
|
172
|
+
/** `m=audio` media line (without prefix). */
|
|
173
|
+
mediaAudio?: string;
|
|
174
|
+
};
|
|
175
|
+
/** SDP `a=` attributes keyed by attribute name. */
|
|
176
|
+
attributes: Record<string, string | string[]>;
|
|
177
|
+
}
|
|
135
178
|
export interface ChannelSip {
|
|
136
179
|
/**
|
|
137
180
|
* Emits every time the remote party sends a DTMF digit (RFC 2833 in-band or SIP INFO).
|
|
@@ -144,20 +187,51 @@ export interface ChannelSip {
|
|
|
144
187
|
*/
|
|
145
188
|
readonly dtmf$: Observable<DtmfEvent>;
|
|
146
189
|
/**
|
|
147
|
-
*
|
|
190
|
+
* Emits each incoming SIP INFO on this call leg (`contentType` + `body`).
|
|
191
|
+
*
|
|
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.
|
|
148
194
|
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
195
|
+
* ```ts
|
|
196
|
+
* sip.sipInfo$.subscribe(({ contentType, body }) => {
|
|
197
|
+
* logger.log('SIP INFO', { contentType, body });
|
|
198
|
+
* });
|
|
199
|
+
* ```
|
|
152
200
|
*/
|
|
153
201
|
readonly sipInfo$: Observable<SipInfo>;
|
|
154
202
|
/**
|
|
155
203
|
* Low-level SIP state-change events from the underlying Sofia stack.
|
|
156
204
|
*
|
|
157
205
|
* Prefer the higher-level **`state$`**, **`progress$`**, **`early$`**, **`answered$`**
|
|
158
|
-
* observables unless you need raw Sofia event details.
|
|
206
|
+
* observables unless you need raw Sofia event details. The `sdp` field is present
|
|
207
|
+
* only when that specific state callback carries an SDP body.
|
|
159
208
|
*/
|
|
160
209
|
readonly sipSignal$: Observable<SipSignal>;
|
|
210
|
+
/**
|
|
211
|
+
* Latest negotiated **remote party SDP** body (raw text).
|
|
212
|
+
*
|
|
213
|
+
* **Inbound:** usually present from INVITE. **Outbound:** often empty until 183/200
|
|
214
|
+
* with SDP; may change on re-INVITE. Synchronous getter — re-read after
|
|
215
|
+
* {@link progress$} / {@link sipSignal$} events that carry `sdp`. Undefined on WS/headless.
|
|
216
|
+
*/
|
|
217
|
+
readonly remoteSdp?: string;
|
|
218
|
+
/**
|
|
219
|
+
* Snapshot of SIP headers from the **inbound INVITE** — see {@link SipInviteHeaders}.
|
|
220
|
+
*
|
|
221
|
+
* ```ts
|
|
222
|
+
* const h = channel.sip.inviteSipHeaders;
|
|
223
|
+
* const diversion = h?.Diversion; // string | string[] | undefined
|
|
224
|
+
* const trunk = h?.['X-Trunk-Id'];
|
|
225
|
+
* ```
|
|
226
|
+
*/
|
|
227
|
+
readonly inviteSipHeaders?: SipInviteHeaders;
|
|
228
|
+
/**
|
|
229
|
+
* Parse the current {@link remoteSdp} into {@link ParsedSdpDetails}.
|
|
230
|
+
*
|
|
231
|
+
* Returns `null` when no remote SDP is available yet. Re-parses on every call from the
|
|
232
|
+
* latest `remoteSdp` value (no separate cache in the host channel).
|
|
233
|
+
*/
|
|
234
|
+
getRemoteSdpDetails(): ParsedSdpDetails | null;
|
|
161
235
|
/**
|
|
162
236
|
* Live observable of the current call state.
|
|
163
237
|
*
|
package/dist/types/sip.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sip.d.ts","sourceRoot":"","sources":["../../src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