@siphon-project/control 0.7.0 → 0.9.0
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 +25 -13
- package/dist/index.cjs +205 -56
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +247 -33
- package/dist/index.d.ts +247 -33
- package/dist/index.js +205 -56
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -31,8 +31,9 @@ declare class ControlError extends Error {
|
|
|
31
31
|
status?: number;
|
|
32
32
|
});
|
|
33
33
|
/**
|
|
34
|
-
* True when this is a server-side `unsupported_verb` rejection —
|
|
35
|
-
*
|
|
34
|
+
* True when this is a server-side `unsupported_verb` rejection — what a verb
|
|
35
|
+
* answers when the configured media backend cannot carry it out (streaming
|
|
36
|
+
* and recording on anything but siphon-rtp).
|
|
36
37
|
*/
|
|
37
38
|
isUnsupportedVerb(): boolean;
|
|
38
39
|
/** A server `status:"error"` reply. */
|
|
@@ -200,11 +201,19 @@ declare const SipVerb: {
|
|
|
200
201
|
* the channel. Channel-addressed, unlike `originate`, which creates one.
|
|
201
202
|
*/
|
|
202
203
|
readonly Dial: "dial";
|
|
204
|
+
/**
|
|
205
|
+
* Give up on the dial ringing for this channel's caller and leave the caller
|
|
206
|
+
* alone: the phones are CANCELled and the dial ends in `DialFailed` with code
|
|
207
|
+
* 487. Refused (`invalid_state`) when nothing is ringing, and once a phone
|
|
208
|
+
* has answered and is being bridged.
|
|
209
|
+
*/
|
|
210
|
+
readonly CancelDial: "cancel_dial";
|
|
203
211
|
readonly SetHeader: "set_header";
|
|
204
212
|
readonly GetHeader: "get_header";
|
|
205
213
|
readonly RemoveHeader: "remove_header";
|
|
206
214
|
readonly AcceptRefer: "accept_refer";
|
|
207
215
|
readonly RejectRefer: "reject_refer";
|
|
216
|
+
readonly CompleteRefer: "complete_refer";
|
|
208
217
|
readonly Bridge: "bridge";
|
|
209
218
|
readonly Unbridge: "unbridge";
|
|
210
219
|
readonly ReplacePeer: "replace_peer";
|
|
@@ -223,7 +232,7 @@ declare const SipVerb: {
|
|
|
223
232
|
/** A value of {@link SipVerb}. */
|
|
224
233
|
type SipVerbToken = (typeof SipVerb)[keyof typeof SipVerb];
|
|
225
234
|
/** The well-known SIP-adapter event names (the ARI *Stasis* model). */
|
|
226
|
-
type SipEventKind = "StasisStart" | "StasisEnd" | "ChannelStateChange" | "ChannelHangupRequest" | "ChannelDtmfReceived" | "PlayStarted" | "TransferRequested" | "TransferProgress" | "TransferCompleted" | "TransferFailed" | "ChannelBridged" | "BridgeFailed" | "ChannelUnbridged" | "PeerReplaced" | "ReplaceFailed" | "PlayFinished" | "WsTeeStarted" | "WsTeeEnded" | "WsBridgeStarted" | "WsBridgeEnded" | "MediaSummary" | "MediaStarted" | "DialBranch" | "DialBranchFailed" | "DialAnswered" | "DialFailed" | "DialogStateChanged" | (string & {});
|
|
235
|
+
type SipEventKind = "StasisStart" | "StasisEnd" | "ChannelStateChange" | "ChannelHangupRequest" | "ChannelDtmfReceived" | "PlayStarted" | "TransferRequested" | "TransferTimedOut" | "TransferProgress" | "TransferCompleted" | "TransferFailed" | "ChannelBridged" | "BridgeFailed" | "ChannelUnbridged" | "PeerReplaced" | "ReplaceFailed" | "PlayFinished" | "WsTeeStarted" | "WsTeeEnded" | "WsBridgeStarted" | "WsBridgeEnded" | "MediaSummary" | "MediaStarted" | "DialBranch" | "DialBranchFailed" | "DialAnswered" | "DialFailed" | "DialogStateChanged" | (string & {});
|
|
227
236
|
/** Parse a wire event name; unknown names pass through verbatim (forward-compatible). */
|
|
228
237
|
declare function sipEventKind(name: string): SipEventKind;
|
|
229
238
|
/**
|
|
@@ -274,6 +283,29 @@ interface TransferReplaces {
|
|
|
274
283
|
from_tag: string;
|
|
275
284
|
to_tag: string;
|
|
276
285
|
early_only: boolean;
|
|
286
|
+
/**
|
|
287
|
+
* The dialog named, when the server hosts it — which is what lets an
|
|
288
|
+
* application act on a `Replaces` at all, since it addresses calls by channel
|
|
289
|
+
* and never sees a Call-ID or a tag. Absent or `null` for a dialog hosted
|
|
290
|
+
* elsewhere, and from a server that predates it.
|
|
291
|
+
*/
|
|
292
|
+
local?: HostedDialog | null;
|
|
293
|
+
}
|
|
294
|
+
/** A dialog the server hosts, as a `Replaces` named it. */
|
|
295
|
+
interface HostedDialog {
|
|
296
|
+
/** The call the dialog belongs to. */
|
|
297
|
+
call_actor_id: string;
|
|
298
|
+
/** The channel controlling that call, when an application owns it. */
|
|
299
|
+
channel?: string | null;
|
|
300
|
+
/** Which leg of the call the dialog is. */
|
|
301
|
+
leg: "a" | "b";
|
|
302
|
+
/**
|
|
303
|
+
* The channel that call is bridged with — the party that stays when the
|
|
304
|
+
* named one is replaced. `null` when it is not a bridge.
|
|
305
|
+
*/
|
|
306
|
+
bridged_with?: string | null;
|
|
307
|
+
/** On a `StasisStart` only: the `early-only` flag the INVITE's `Replaces` carried. */
|
|
308
|
+
early_only?: boolean;
|
|
277
309
|
}
|
|
278
310
|
/**
|
|
279
311
|
* The `payload` of a `TransferRequested` event — an inbound REFER on a
|
|
@@ -288,6 +320,36 @@ interface TransferRequestedPayload {
|
|
|
288
320
|
replaces?: TransferReplaces | null;
|
|
289
321
|
/** The From-tag of the referring party, if known. */
|
|
290
322
|
from_tag?: string | null;
|
|
323
|
+
/**
|
|
324
|
+
* Which party of the channel's call sent the REFER: `"a"` for the party the
|
|
325
|
+
* call came from, `"b"` for the party it was connected to. Absent from a
|
|
326
|
+
* server that predates it.
|
|
327
|
+
*/
|
|
328
|
+
referrer_leg?: "a" | "b" | null;
|
|
329
|
+
/**
|
|
330
|
+
* The SIP Call-ID of the dialog the REFER arrived on. For a `"b"` referrer
|
|
331
|
+
* this is the `leg_sip_call_id` its `DialBranch` named, not the channel's.
|
|
332
|
+
*/
|
|
333
|
+
referrer_sip_call_id?: string | null;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* The `payload` of a `TransferTimedOut` event — a transfer accepted with
|
|
337
|
+
* `acceptRefer({ mode: "controller" })` passed its deadline with no
|
|
338
|
+
* `completeRefer`. siphon ended the referrer's subscription for the app, with
|
|
339
|
+
* a sipfrag NOTIFY of its own (RFC 3515 §2.4.5); a `completeRefer` now is
|
|
340
|
+
* refused. Cast a {@link import("./sip").CallEvent}'s `payload` to this when
|
|
341
|
+
* `kind === "TransferTimedOut"`.
|
|
342
|
+
*/
|
|
343
|
+
interface TransferTimedOutPayload {
|
|
344
|
+
/** Why the transfer ended: `"timeout"`. */
|
|
345
|
+
reason: string;
|
|
346
|
+
/**
|
|
347
|
+
* The sipfrag status siphon reported to the referrer (`503`), or `null` when
|
|
348
|
+
* the referrer's leg had already left the call and nothing could be sent.
|
|
349
|
+
*/
|
|
350
|
+
code?: number | null;
|
|
351
|
+
/** Which party of the channel's call had referred, as on {@link TransferRequestedPayload}. */
|
|
352
|
+
referrer_leg?: "a" | "b" | null;
|
|
291
353
|
}
|
|
292
354
|
/**
|
|
293
355
|
* Where a verdict on an *outbound* REFER came from — the `stage` of a
|
|
@@ -985,10 +1047,70 @@ interface ReferReplaces {
|
|
|
985
1047
|
earlyOnly?: boolean;
|
|
986
1048
|
}
|
|
987
1049
|
/** Options for {@link Call.acceptRefer}. */
|
|
988
|
-
|
|
989
|
-
|
|
1050
|
+
/**
|
|
1051
|
+
* Who a transfer's new leg is dialled at: a SIP URI, or `{ aor }` — a
|
|
1052
|
+
* registered address-of-record, dialled over the flow its phone registered on
|
|
1053
|
+
* (the only way to reach one on TCP, TLS or WebSocket behind NAT). An AoR nobody
|
|
1054
|
+
* is registered at rejects with `not_found`. One with several registered
|
|
1055
|
+
* contacts rings them all: the first to answer is the party brought into the
|
|
1056
|
+
* call, and the server CANCELs the rest.
|
|
1057
|
+
*/
|
|
1058
|
+
type TransferTarget = string | {
|
|
1059
|
+
aor: string;
|
|
1060
|
+
};
|
|
1061
|
+
/**
|
|
1062
|
+
* The identity a transfer's new leg presents — the arguments {@link Call.dial}
|
|
1063
|
+
* takes. Unset, the leg presents what the call's own INVITE carried.
|
|
1064
|
+
*/
|
|
1065
|
+
interface TransferIdentity {
|
|
1066
|
+
/** The calling identity — the From URI (RFC 3261 §8.1.1.3). */
|
|
1067
|
+
from?: string;
|
|
1068
|
+
/** The From display name. An empty one removes the caller's. */
|
|
1069
|
+
fromDisplay?: string;
|
|
1070
|
+
/** `P-Asserted-Identity` for a trusted next hop (RFC 3325 §9.1). */
|
|
1071
|
+
pAssertedIdentity?: string;
|
|
1072
|
+
/** Whether the calling identity may be presented (RFC 3323 §4.1). */
|
|
1073
|
+
privacy?: "allowed" | "restricted";
|
|
1074
|
+
/**
|
|
1075
|
+
* The name of a number policy configured on the server, which decides how
|
|
1076
|
+
* the numbers in the new leg's identity headers are written. Unset, the
|
|
1077
|
+
* server's default for the calls it dials applies. Not together with
|
|
1078
|
+
* `format`: the server refuses the two.
|
|
1079
|
+
*/
|
|
1080
|
+
numberPolicy?: string;
|
|
1081
|
+
/**
|
|
1082
|
+
* One number format for the new leg's identity headers, in place of a named
|
|
1083
|
+
* policy.
|
|
1084
|
+
*/
|
|
1085
|
+
format?: "e164" | "plain" | "international" | "national";
|
|
1086
|
+
/** Headers for the new leg's INVITE, injected after the header policy. */
|
|
1087
|
+
headers?: Record<string, string>;
|
|
1088
|
+
}
|
|
1089
|
+
/**
|
|
1090
|
+
* Options for {@link Call.acceptRefer}. The {@link TransferIdentity} fields and
|
|
1091
|
+
* an `{ aor }` target apply to `mode: "terminate"`, which dials a leg; the
|
|
1092
|
+
* server refuses them with `"transparent"`, which relays the REFER, and with
|
|
1093
|
+
* `"controller"`, which dials nothing and takes `timeout` only.
|
|
1094
|
+
*/
|
|
1095
|
+
interface AcceptReferOptions extends TransferIdentity {
|
|
1096
|
+
target?: TransferTarget;
|
|
990
1097
|
nextHop?: string;
|
|
991
|
-
|
|
1098
|
+
/**
|
|
1099
|
+
* Who carries the transfer out. `"terminate"`: the server dials the target.
|
|
1100
|
+
* `"transparent"`: it relays the REFER to the far end. `"controller"`: it
|
|
1101
|
+
* answers `202`, sends the first sipfrag NOTIFY and dials nothing — this
|
|
1102
|
+
* application moves the parties with its other verbs and then reports with
|
|
1103
|
+
* {@link Call.completeRefer}.
|
|
1104
|
+
*/
|
|
1105
|
+
mode?: "terminate" | "transparent" | "controller";
|
|
1106
|
+
/**
|
|
1107
|
+
* With `mode: "controller"`, how many seconds there are to report in
|
|
1108
|
+
* (default 60, at most 180). Past it the server reports `503` to the
|
|
1109
|
+
* referrer itself and tells this application with a `TransferTimedOut`
|
|
1110
|
+
* event ({@link import("./protocol").TransferTimedOutPayload}). The server
|
|
1111
|
+
* refuses it with any other mode.
|
|
1112
|
+
*/
|
|
1113
|
+
timeout?: number;
|
|
992
1114
|
/**
|
|
993
1115
|
* Media profile for the pairing the transfer creates.
|
|
994
1116
|
*
|
|
@@ -1037,6 +1159,13 @@ interface RouteTargetObject {
|
|
|
1037
1159
|
* reached anyone. Default `false`, which is never sent.
|
|
1038
1160
|
*/
|
|
1039
1161
|
rerouteAfterProgress?: boolean;
|
|
1162
|
+
/**
|
|
1163
|
+
* The route set this attempt's INVITE carries, topmost first, each entry one
|
|
1164
|
+
* Route value in name-addr form (`"<sip:scscf.example;lr>"`). The attempt
|
|
1165
|
+
* goes to the topmost entry unless `nextHop` pins it. See
|
|
1166
|
+
* {@link DialTarget}'s `route`.
|
|
1167
|
+
*/
|
|
1168
|
+
route?: string[];
|
|
1040
1169
|
}
|
|
1041
1170
|
/**
|
|
1042
1171
|
* One entry in a {@link Call.route} target list: a bare URI string, or a
|
|
@@ -1120,18 +1249,6 @@ interface OriginateOptions {
|
|
|
1120
1249
|
*/
|
|
1121
1250
|
sessionTimer?: SessionTimer;
|
|
1122
1251
|
}
|
|
1123
|
-
/**
|
|
1124
|
-
* What the server answers an accepted `originate` with: the call is `calling`,
|
|
1125
|
-
* not answered — the answer arrives later as an event on the channel.
|
|
1126
|
-
*/
|
|
1127
|
-
interface Originated {
|
|
1128
|
-
/** The caller-supplied channel id the call is addressed by. */
|
|
1129
|
-
channel: string;
|
|
1130
|
-
/** siphon's internal call id. */
|
|
1131
|
-
callId?: string;
|
|
1132
|
-
/** The SIP Call-ID on the wire, for joining CDR / HEP. */
|
|
1133
|
-
sipCallId?: string;
|
|
1134
|
-
}
|
|
1135
1252
|
/**
|
|
1136
1253
|
* How {@link SipClient.originateAor} rings the phones registered at an AoR.
|
|
1137
1254
|
* Anything left out takes the server's own default.
|
|
@@ -1157,6 +1274,11 @@ interface OriginateRing {
|
|
|
1157
1274
|
interface OriginatedGroup {
|
|
1158
1275
|
/** The caller-supplied channel id the group is addressed by. */
|
|
1159
1276
|
channel: string;
|
|
1277
|
+
/**
|
|
1278
|
+
* The placed call: its events (`DialBranch`, `DialAnswered`, then the
|
|
1279
|
+
* winning phone's) and every verb on the channel.
|
|
1280
|
+
*/
|
|
1281
|
+
call: Call;
|
|
1160
1282
|
/**
|
|
1161
1283
|
* siphon's id for the group of phones. Until one answers, the channel's
|
|
1162
1284
|
* events carry it as their `call_id` / `sip_call_id`, since no single dialog
|
|
@@ -1199,15 +1321,34 @@ type DialTarget = {
|
|
|
1199
1321
|
nextHop?: string;
|
|
1200
1322
|
/** Headers injected on this branch's INVITE, over the command's. */
|
|
1201
1323
|
headers?: Record<string, string>;
|
|
1324
|
+
/**
|
|
1325
|
+
* Called party: the B-leg's `To` URI. Without it `To` keeps the caller's
|
|
1326
|
+
* user at the target's host, right for a forward and wrong for a divert,
|
|
1327
|
+
* where a next hop routing on `To` would serve the call as one to the
|
|
1328
|
+
* original number. Kept as the leg's dialog `To`, so later in-dialog
|
|
1329
|
+
* requests carry it too, which a `To` header override cannot do.
|
|
1330
|
+
*/
|
|
1331
|
+
to?: string;
|
|
1332
|
+
/**
|
|
1333
|
+
* The route set this branch's INVITE carries, topmost first, each entry
|
|
1334
|
+
* one Route value in name-addr form (`"<sip:scscf.example;lr>"`,
|
|
1335
|
+
* RFC 3261 §25.1). The branch goes to the topmost entry unless `nextHop`
|
|
1336
|
+
* pins it. This is how a controller acting as an IMS application server
|
|
1337
|
+
* continues a session through the S-CSCF with the Route the S-CSCF gave
|
|
1338
|
+
* it (TS 24.229 §5.7.5.2.1); `Route` cannot ride `headers`.
|
|
1339
|
+
*/
|
|
1340
|
+
route?: string[];
|
|
1202
1341
|
} | {
|
|
1203
1342
|
/**
|
|
1204
1343
|
* The address of record to fork to its registered contacts. It takes no
|
|
1205
|
-
* `nextHop`: each branch routes over its own binding's
|
|
1206
|
-
* there would be nothing for one to apply to.
|
|
1344
|
+
* `nextHop` or `route`: each branch routes over its own binding's
|
|
1345
|
+
* captured flow and Path, so there would be nothing for one to apply to.
|
|
1207
1346
|
*/
|
|
1208
1347
|
aor: string;
|
|
1209
1348
|
/** Headers injected on every branch the AoR expands to. */
|
|
1210
1349
|
headers?: Record<string, string>;
|
|
1350
|
+
/** Called party for every branch the AoR expands to (see the URI form). */
|
|
1351
|
+
to?: string;
|
|
1211
1352
|
};
|
|
1212
1353
|
/**
|
|
1213
1354
|
* Optional shaping for {@link Call.dial}; anything left out takes the server's
|
|
@@ -1345,21 +1486,36 @@ interface Recording {
|
|
|
1345
1486
|
declare function dialArgs(targets: DialTarget[], options?: DialOptions): Record<string, unknown>;
|
|
1346
1487
|
declare function recordStartArgs(options?: RecordOptions): Record<string, unknown>;
|
|
1347
1488
|
declare function recordStopArgs(recordingId?: string): Record<string, unknown>;
|
|
1489
|
+
/**
|
|
1490
|
+
* The audio source for {@link Call.play}: a server-side file, a media-DB id,
|
|
1491
|
+
* inline bytes, a tone the media engine generates (a preset name such as
|
|
1492
|
+
* `"ringback_eu"` or a cadence such as `"425/1000,0/4000*inf"`), or an
|
|
1493
|
+
* `http://` / `https://` URL it fetches.
|
|
1494
|
+
*/
|
|
1348
1495
|
type PlaySource = {
|
|
1349
1496
|
file: string;
|
|
1350
1497
|
} | {
|
|
1351
1498
|
dbId: number;
|
|
1352
1499
|
} | {
|
|
1353
1500
|
blob: Uint8Array;
|
|
1501
|
+
} | {
|
|
1502
|
+
tone: string;
|
|
1503
|
+
} | {
|
|
1504
|
+
url: string;
|
|
1354
1505
|
};
|
|
1355
1506
|
/** Optional shaping for {@link Call.play}. */
|
|
1356
1507
|
interface PlayOptions {
|
|
1357
|
-
/**
|
|
1358
|
-
|
|
1508
|
+
/**
|
|
1509
|
+
* How many times to play in total (undefined → once), or `"inf"` to play
|
|
1510
|
+
* until stopped — music on hold. The server refuses any other value.
|
|
1511
|
+
*/
|
|
1512
|
+
repeat?: number | "inf";
|
|
1359
1513
|
/** Start playback at this offset into the source, in milliseconds. */
|
|
1360
1514
|
startMs?: number;
|
|
1361
1515
|
/** Cap playback to this duration, in milliseconds. */
|
|
1362
1516
|
durationMs?: number;
|
|
1517
|
+
/** Play louder (positive) or quieter (negative) by this many decibels. */
|
|
1518
|
+
gainDecibels?: number;
|
|
1363
1519
|
/** Scope the prompt to one peer of an MPTY bridge (its To-tag). */
|
|
1364
1520
|
toTag?: string;
|
|
1365
1521
|
}
|
|
@@ -1432,7 +1588,10 @@ declare class Call {
|
|
|
1432
1588
|
readonly sipCallId: string | null;
|
|
1433
1589
|
/** The application this call was handed to. */
|
|
1434
1590
|
readonly app: string | null;
|
|
1435
|
-
/**
|
|
1591
|
+
/**
|
|
1592
|
+
* The `StasisStart` payload (full SIP context), the `resync` snapshot, or
|
|
1593
|
+
* the `originate` reply for a call this client placed.
|
|
1594
|
+
*/
|
|
1436
1595
|
readonly payload: unknown;
|
|
1437
1596
|
/** True when this call came from a `resync` re-attach after a reconnect. */
|
|
1438
1597
|
readonly reattached: boolean;
|
|
@@ -1446,7 +1605,10 @@ declare class Call {
|
|
|
1446
1605
|
sipCallId: string | null,
|
|
1447
1606
|
/** The application this call was handed to. */
|
|
1448
1607
|
app: string | null,
|
|
1449
|
-
/**
|
|
1608
|
+
/**
|
|
1609
|
+
* The `StasisStart` payload (full SIP context), the `resync` snapshot, or
|
|
1610
|
+
* the `originate` reply for a call this client placed.
|
|
1611
|
+
*/
|
|
1450
1612
|
payload: unknown,
|
|
1451
1613
|
/** True when this call came from a `resync` re-attach after a reconnect. */
|
|
1452
1614
|
reattached: boolean, eventQueue: AsyncQueue<CallEvent>);
|
|
@@ -1534,6 +1696,26 @@ declare class Call {
|
|
|
1534
1696
|
drop(reason?: string, options?: {
|
|
1535
1697
|
ban?: boolean;
|
|
1536
1698
|
}): Promise<void>;
|
|
1699
|
+
/**
|
|
1700
|
+
* Give up on the dial ringing for this call and leave the caller alone.
|
|
1701
|
+
*
|
|
1702
|
+
* Every phone still ringing is CANCELled (RFC 3261 §9.1), each reported by
|
|
1703
|
+
* `DialBranchFailed` with cause `cancelled`, and the dial ends in
|
|
1704
|
+
* `DialFailed` with code 487. The caller is exactly as the dial found it —
|
|
1705
|
+
* answered and anchored for an `onAnswer: "bridge"` dial, unanswered and
|
|
1706
|
+
* parked otherwise — still this app's, and free to be dialled for again.
|
|
1707
|
+
* {@link Call.hangup} ends the caller as well.
|
|
1708
|
+
*
|
|
1709
|
+
* `reason` is reported as the `cause` of a bridging dial's `DialFailed`
|
|
1710
|
+
* (default `cancelled`), so the handler that hears it can tell its own cancel
|
|
1711
|
+
* from a dial that failed by itself.
|
|
1712
|
+
*
|
|
1713
|
+
* Rejects with `invalid_state` when nothing is ringing (`details.reason` is
|
|
1714
|
+
* `no_dial_in_progress`), and once a phone has answered and is being bridged
|
|
1715
|
+
* (`dial_answered`), whose outcome arrives as `DialAnswered` or
|
|
1716
|
+
* `BridgeFailed`.
|
|
1717
|
+
*/
|
|
1718
|
+
cancelDial(reason?: string): Promise<void>;
|
|
1537
1719
|
/**
|
|
1538
1720
|
* Send an in-dialog REFER on the A-leg (blind transfer).
|
|
1539
1721
|
*
|
|
@@ -1556,7 +1738,7 @@ declare class Call {
|
|
|
1556
1738
|
*
|
|
1557
1739
|
* `targets` is a non-empty list of carriers tried cheapest-first: each entry
|
|
1558
1740
|
* is a bare URI string or a {@link RouteTargetObject}
|
|
1559
|
-
* (`{uri, nextHop?, headers?, timeout?, rerouteAfterProgress?}`). A target
|
|
1741
|
+
* (`{uri, nextHop?, headers?, timeout?, rerouteAfterProgress?, route?}`). A target
|
|
1560
1742
|
* that has shown progress keeps the call past its `timeout` unless it sets
|
|
1561
1743
|
* `rerouteAfterProgress`. `strategy` defaults to
|
|
1562
1744
|
* `"sequential"` (v1 supports only sequential/single — anything else rejects
|
|
@@ -1630,10 +1812,27 @@ declare class Call {
|
|
|
1630
1812
|
* `b2bua.default_refer_mode`. No pending REFER (already decided, timed out, or
|
|
1631
1813
|
* the call is gone) rejects with `code === "not_found"`.
|
|
1632
1814
|
*
|
|
1815
|
+
* `mode: "controller"` leaves the transfer to this application — see
|
|
1816
|
+
* {@link AcceptReferOptions.mode} and {@link Call.completeRefer}.
|
|
1817
|
+
*
|
|
1633
1818
|
* `profile` names the media profile for the pairing the transfer creates —
|
|
1634
1819
|
* see {@link AcceptReferOptions.profile}, which is required at an SRTP edge.
|
|
1635
1820
|
*/
|
|
1636
1821
|
acceptRefer(options?: AcceptReferOptions): Promise<void>;
|
|
1822
|
+
/**
|
|
1823
|
+
* Report how a transfer accepted with `acceptRefer({ mode: "controller" })`
|
|
1824
|
+
* went: the server sends the referrer the sipfrag NOTIFY that ends its
|
|
1825
|
+
* subscription. `code` is the status in it (200-699), a 2xx for a transfer
|
|
1826
|
+
* that succeeded, and `reason` its reason phrase, used as given. Nothing
|
|
1827
|
+
* else happens to the call.
|
|
1828
|
+
*
|
|
1829
|
+
* **Report before releasing the referrer's leg.** The NOTIFY travels on its
|
|
1830
|
+
* dialog, so once that leg is hung up or replaced this rejects with
|
|
1831
|
+
* `code === "not_found"`. With no such transfer open on the call — already
|
|
1832
|
+
* reported, past its deadline, or its referrer hung up — it rejects with
|
|
1833
|
+
* `code === "invalid_state"` (`details.reason === "no_transfer_pending"`).
|
|
1834
|
+
*/
|
|
1835
|
+
completeRefer(code: number, reason?: string): Promise<void>;
|
|
1637
1836
|
/**
|
|
1638
1837
|
* Reject a *pending inbound* REFER with a final non-2xx (default
|
|
1639
1838
|
* `603 Decline`). No pending REFER rejects with `code === "not_found"`.
|
|
@@ -1720,12 +1919,12 @@ declare class Call {
|
|
|
1720
1919
|
* answered, no peer leg, or a replacement already in flight — all worth
|
|
1721
1920
|
* retrying later) or `"bad_request"` (the target will not parse or route).
|
|
1722
1921
|
*/
|
|
1723
|
-
replacePeer(target:
|
|
1922
|
+
replacePeer(target: TransferTarget, options?: {
|
|
1724
1923
|
nextHop?: string;
|
|
1725
1924
|
replaceALeg?: boolean;
|
|
1726
1925
|
profile?: string;
|
|
1727
1926
|
timeout?: number;
|
|
1728
|
-
}): Promise<unknown>;
|
|
1927
|
+
} & TransferIdentity): Promise<unknown>;
|
|
1729
1928
|
/** Set a header on the stored A-leg INVITE. */
|
|
1730
1929
|
setHeader(name: string, value: string): Promise<void>;
|
|
1731
1930
|
/** Read a header from the stored A-leg INVITE (`null` when absent). */
|
|
@@ -1752,9 +1951,15 @@ declare class Call {
|
|
|
1752
1951
|
* optional `durationMs` / `volumeDbm0` / `pauseMs` / `toTag` shaping.
|
|
1753
1952
|
*/
|
|
1754
1953
|
dtmf(digits: string, options?: DtmfOptions): Promise<void>;
|
|
1755
|
-
/**
|
|
1954
|
+
/**
|
|
1955
|
+
* Silence the call's media in both directions on the media engine.
|
|
1956
|
+
*
|
|
1957
|
+
* A media gate, not a SIP hold: nothing is sent on either dialog, so no
|
|
1958
|
+
* phone shows a held call. Rejects with `invalid_state` on a call the engine
|
|
1959
|
+
* only relays; to hold one party of a bridge, use {@link Call.unbridge}.
|
|
1960
|
+
*/
|
|
1756
1961
|
hold(): Promise<void>;
|
|
1757
|
-
/**
|
|
1962
|
+
/** Restore the call's media after a {@link Call.hold}. */
|
|
1758
1963
|
unhold(): Promise<void>;
|
|
1759
1964
|
/**
|
|
1760
1965
|
* Attach a WebSocket audio stream to `wsUri`: an additive tee (the default)
|
|
@@ -1884,8 +2089,14 @@ declare class SipClient {
|
|
|
1884
2089
|
*
|
|
1885
2090
|
* The one verb that *creates* a channel rather than addressing one, which is
|
|
1886
2091
|
* why it lives here and not on {@link Call}. It resolves as soon as the
|
|
1887
|
-
* INVITE is on the wire — the call is `calling
|
|
1888
|
-
*
|
|
2092
|
+
* INVITE is on the wire — the call is `calling` — to the {@link Call} it
|
|
2093
|
+
* placed: the answer, failure or timeout arrives on {@link Call.nextEvent},
|
|
2094
|
+
* exactly as a handed-over call's does, and `hangup` CANCELs or BYEs it.
|
|
2095
|
+
*
|
|
2096
|
+
* siphon sends no `StasisStart` for a channel its controller created, so the
|
|
2097
|
+
* channel is opened here before the command goes out (a fast 180 can
|
|
2098
|
+
* overtake the reply). An id still live on this client rejects with
|
|
2099
|
+
* `code === "conflict"` before anything is sent.
|
|
1889
2100
|
*
|
|
1890
2101
|
* ```ts
|
|
1891
2102
|
* const call = await client.originate(
|
|
@@ -1896,7 +2107,7 @@ declare class SipClient {
|
|
|
1896
2107
|
* );
|
|
1897
2108
|
* ```
|
|
1898
2109
|
*/
|
|
1899
|
-
originate(channel: string, to: string, media: OriginateMedia, options?: OriginateOptions): Promise<
|
|
2110
|
+
originate(channel: string, to: string, media: OriginateMedia, options?: OriginateOptions): Promise<Call>;
|
|
1900
2111
|
/**
|
|
1901
2112
|
* Ring every phone registered at `aor` under a caller-supplied channel id —
|
|
1902
2113
|
* {@link SipClient.originate} for a phone rather than a URI.
|
|
@@ -1930,6 +2141,9 @@ declare class SipClient {
|
|
|
1930
2141
|
* ```
|
|
1931
2142
|
*/
|
|
1932
2143
|
originateAor(channel: string, aor: string, media: OriginateMedia, options?: OriginateOptions, ring?: OriginateRing): Promise<OriginatedGroup>;
|
|
2144
|
+
/** Open `channel`, send the originate, and close it again if the server refuses. */
|
|
2145
|
+
private place;
|
|
2146
|
+
private placedCall;
|
|
1933
2147
|
/** Send a raw command on any module (the generic escape hatch). */
|
|
1934
2148
|
command(module: string | null, verb: string, target: unknown, args: unknown): Promise<unknown>;
|
|
1935
2149
|
/** Stop the client. */
|
|
@@ -1956,4 +2170,4 @@ declare class SipServer {
|
|
|
1956
2170
|
close(): Promise<void>;
|
|
1957
2171
|
}
|
|
1958
2172
|
|
|
1959
|
-
export { type AcceptReferOptions, type AnchoredAnswerOptions, type AppEvent, type AppEventHandler, type BridgeFailedPayload, type BridgeOptions, type BridgeRole, type BridgeStage, Call, type CallEvent, type CallHandler, CallStream, type ChannelBridgedPayload, type ChannelDtmfPayload, type ChannelSnapshot, type ChannelUnbridgedPayload, type ClientConfig, type ClientEvent, type CommandTransport, type ConnectionEventSink, ControlClient, ControlError, type ControlErrorCode, type ControlErrorKind, ControlServer, DESCRIBE, type DialAnsweredPayload, type DialBranchCause, type DialBranchOutcome, type DialBranchPayload, type DialFailedPayload, type DialOptions, type DialTarget, type Dialing, type DialogDirection, type DialogIdentity, type DialogState, type DialogStateChangedPayload, type DtmfOptions, type EventFrame, type EventSink, EventStream, type FrameType, GET_VAR, HELLO, type HelloArgs, type HelloResult, MODULE_SIP, MODULE_SMPP, MODULE_SS7, type MediaLegSummary, type MediaStartedPayload, type MediaSummaryPayload, type OriginateMedia, type OriginateOptions, type OriginateRing, type
|
|
2173
|
+
export { type AcceptReferOptions, type AnchoredAnswerOptions, type AppEvent, type AppEventHandler, type BridgeFailedPayload, type BridgeOptions, type BridgeRole, type BridgeStage, Call, type CallEvent, type CallHandler, CallStream, type ChannelBridgedPayload, type ChannelDtmfPayload, type ChannelSnapshot, type ChannelUnbridgedPayload, type ClientConfig, type ClientEvent, type CommandTransport, type ConnectionEventSink, ControlClient, ControlError, type ControlErrorCode, type ControlErrorKind, ControlServer, DESCRIBE, type DialAnsweredPayload, type DialBranchCause, type DialBranchOutcome, type DialBranchPayload, type DialFailedPayload, type DialOptions, type DialTarget, type Dialing, type DialogDirection, type DialogIdentity, type DialogState, type DialogStateChangedPayload, type DtmfOptions, type EventFrame, type EventSink, EventStream, type FrameType, GET_VAR, HELLO, type HelloArgs, type HelloResult, MODULE_SIP, MODULE_SMPP, MODULE_SS7, type MediaLegSummary, type MediaStartedPayload, type MediaSummaryPayload, type OriginateMedia, type OriginateOptions, type OriginateRing, type OriginatedGroup, PROTOCOL_VERSION, type PeerHangupPolicy, type PlayFinishedPayload, type PlayOptions, type PlaySource, type PlayStartedPayload, RESYNC, type RecordChannels, type RecordDirection, type RecordOptions, type Recording, type ReferReplaces, type ReplyError, type ReplyFrame, type ReplyStatus, type ResponseOptions, type ResyncResult, type RouteTarget, type RouteTargetObject, SET_VAR, SUBPROTOCOL, type ServerConfig, type SessionRefresher, type SessionTimer, SipClient, type SipEventKind, SipServer, SipVerb, type SipVerbToken, type StreamMode, type StreamOptions, type StreamStopOptions, type TransferOutcomePayload, type TransferReplaces, type TransferRequestedPayload, type TransferStage, type TransferTimedOutPayload, type WsBridgeEndedPayload, type WsBridgeStartedPayload, type WsTeeEndedPayload, type WsTeeStartedPayload, dialArgs, encodeCommand, isBridgeFinal, isDialFinal, isTransferFinal, originateAorArgs, originateArgs, parseInboundFrame, recordStartArgs, recordStopArgs, sipEventKind, transferOutcome };
|