@siphon-project/control 0.10.1 → 0.11.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/dist/index.d.cts CHANGED
@@ -1206,6 +1206,42 @@ interface RouteOptions {
1206
1206
  */
1207
1207
  callerContactUser?: string;
1208
1208
  }
1209
+ /**
1210
+ * Per-call overrides of a media profile's processing settings, merged over the
1211
+ * profile (its answer half) for one call only and sent as `media_flags`, each
1212
+ * key in snake_case. A key left unset keeps the profile's value. The server
1213
+ * refuses an unknown key, a `null` or a value the engine would refuse with
1214
+ * `bad_request` whose `details.field` names the key.
1215
+ */
1216
+ interface MediaFlags {
1217
+ /** Echo cancellation on the leg's uplink. */
1218
+ echoCancellation?: boolean;
1219
+ /**
1220
+ * How far the canceller searches for the echo, in ms: 16-1000 as a search
1221
+ * window, or as a tail length when the merged `echoLongTail` is set.
1222
+ */
1223
+ echoDelaySearchMs?: number;
1224
+ /** Span the echo path with the adaptive filter (a tail length). */
1225
+ echoLongTail?: boolean;
1226
+ /** Chain the residual-echo suppressor after the canceller. */
1227
+ echoResidualSuppression?: boolean;
1228
+ /** Noise suppression on the leg's uplink. */
1229
+ noiseSuppression?: boolean;
1230
+ /** The WebSocket uplink voice-activity detector. */
1231
+ wsVad?: boolean;
1232
+ /** Which detector `wsVad` runs. */
1233
+ wsVadEngine?: "energy" | "neural";
1234
+ /** Leading speech run, in ms, before `speech_started` (and barge-in). */
1235
+ wsVadMinSpeechMs?: number;
1236
+ /** Energy threshold for the energy detector; higher is less sensitive. */
1237
+ wsVadThreshold?: number;
1238
+ /** Trailing hangover, in ms, before `speech_stopped`. */
1239
+ wsVadHangoverMs?: number;
1240
+ /** Flush the queued downlink when the caller starts speaking. */
1241
+ wsBargeIn?: boolean;
1242
+ /** L16 wire rate of a WebSocket bridge in Hz: a multiple of 1000 in 8000-48000. */
1243
+ wsSampleRate?: number;
1244
+ }
1209
1245
  /** Options for an anchored answer ({@link Call.answerAnchored}). */
1210
1246
  interface AnchoredAnswerOptions {
1211
1247
  /** UAS 2xx code (default `200`). */
@@ -1221,6 +1257,8 @@ interface AnchoredAnswerOptions {
1221
1257
  * `callId`.
1222
1258
  */
1223
1259
  wsUri?: string;
1260
+ /** Overrides of the profile's processing settings for this call. */
1261
+ mediaFlags?: MediaFlags;
1224
1262
  /** Host of siphon's own `Contact` toward the caller; see {@link ResponseOptions}. */
1225
1263
  contactHost?: string;
1226
1264
  /** User part of siphon's own `Contact` toward the caller; see {@link ResponseOptions}. */
@@ -1395,6 +1433,7 @@ type OriginateMedia =
1395
1433
  anchor: true;
1396
1434
  profile?: string;
1397
1435
  wsUri?: string;
1436
+ mediaFlags?: MediaFlags;
1398
1437
  }
1399
1438
  /** Your own SDP offer (`application/sdp` by definition). */
1400
1439
  | {
@@ -1884,6 +1923,11 @@ interface StreamOptions {
1884
1923
  * and an unknown name rejects with `bad_request`.
1885
1924
  */
1886
1925
  profile?: string;
1926
+ /**
1927
+ * Bridge only: overrides of `profile`'s settings for this bridge. They need a
1928
+ * `profile` to merge over; without one, or on a tee, the server refuses them.
1929
+ */
1930
+ mediaFlags?: MediaFlags;
1887
1931
  }
1888
1932
  /** Options for {@link Call.streamStop}. */
1889
1933
  interface StreamStopOptions {
@@ -2501,4 +2545,4 @@ declare class SipServer {
2501
2545
  close(): Promise<void>;
2502
2546
  }
2503
2547
 
2504
- 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 DialOffer, 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, OUTBOUND_REGISTRATIONS, type OriginateMedia, type OriginateOptions, type OriginateRing, type OriginatedGroup, type OutboundRegistration, type OutboundRegistrationsReply, PROTOCOL_VERSION, type PeerHangupPolicy, type PlayFinishedPayload, type PlayOptions, type PlaySource, type PlayStartedPayload, REGISTRATIONS, RESYNC, type RecordChannels, type RecordDirection, type RecordOptions, type Recording, type ReferReplaces, type RegistrantChangedPayload, type RegistrationChangedPayload, type RegistrationContact, type RegistrationsReply, type ReplyError, type ReplyFrame, type ReplyStatus, type ResponseOptions, type ResyncResult, type RingOptions, type RouteOptions, 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 };
2548
+ 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 DialOffer, 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 MediaFlags, type MediaLegSummary, type MediaStartedPayload, type MediaSummaryPayload, OUTBOUND_REGISTRATIONS, type OriginateMedia, type OriginateOptions, type OriginateRing, type OriginatedGroup, type OutboundRegistration, type OutboundRegistrationsReply, PROTOCOL_VERSION, type PeerHangupPolicy, type PlayFinishedPayload, type PlayOptions, type PlaySource, type PlayStartedPayload, REGISTRATIONS, RESYNC, type RecordChannels, type RecordDirection, type RecordOptions, type Recording, type ReferReplaces, type RegistrantChangedPayload, type RegistrationChangedPayload, type RegistrationContact, type RegistrationsReply, type ReplyError, type ReplyFrame, type ReplyStatus, type ResponseOptions, type ResyncResult, type RingOptions, type RouteOptions, 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 };
package/dist/index.d.ts CHANGED
@@ -1206,6 +1206,42 @@ interface RouteOptions {
1206
1206
  */
1207
1207
  callerContactUser?: string;
1208
1208
  }
1209
+ /**
1210
+ * Per-call overrides of a media profile's processing settings, merged over the
1211
+ * profile (its answer half) for one call only and sent as `media_flags`, each
1212
+ * key in snake_case. A key left unset keeps the profile's value. The server
1213
+ * refuses an unknown key, a `null` or a value the engine would refuse with
1214
+ * `bad_request` whose `details.field` names the key.
1215
+ */
1216
+ interface MediaFlags {
1217
+ /** Echo cancellation on the leg's uplink. */
1218
+ echoCancellation?: boolean;
1219
+ /**
1220
+ * How far the canceller searches for the echo, in ms: 16-1000 as a search
1221
+ * window, or as a tail length when the merged `echoLongTail` is set.
1222
+ */
1223
+ echoDelaySearchMs?: number;
1224
+ /** Span the echo path with the adaptive filter (a tail length). */
1225
+ echoLongTail?: boolean;
1226
+ /** Chain the residual-echo suppressor after the canceller. */
1227
+ echoResidualSuppression?: boolean;
1228
+ /** Noise suppression on the leg's uplink. */
1229
+ noiseSuppression?: boolean;
1230
+ /** The WebSocket uplink voice-activity detector. */
1231
+ wsVad?: boolean;
1232
+ /** Which detector `wsVad` runs. */
1233
+ wsVadEngine?: "energy" | "neural";
1234
+ /** Leading speech run, in ms, before `speech_started` (and barge-in). */
1235
+ wsVadMinSpeechMs?: number;
1236
+ /** Energy threshold for the energy detector; higher is less sensitive. */
1237
+ wsVadThreshold?: number;
1238
+ /** Trailing hangover, in ms, before `speech_stopped`. */
1239
+ wsVadHangoverMs?: number;
1240
+ /** Flush the queued downlink when the caller starts speaking. */
1241
+ wsBargeIn?: boolean;
1242
+ /** L16 wire rate of a WebSocket bridge in Hz: a multiple of 1000 in 8000-48000. */
1243
+ wsSampleRate?: number;
1244
+ }
1209
1245
  /** Options for an anchored answer ({@link Call.answerAnchored}). */
1210
1246
  interface AnchoredAnswerOptions {
1211
1247
  /** UAS 2xx code (default `200`). */
@@ -1221,6 +1257,8 @@ interface AnchoredAnswerOptions {
1221
1257
  * `callId`.
1222
1258
  */
1223
1259
  wsUri?: string;
1260
+ /** Overrides of the profile's processing settings for this call. */
1261
+ mediaFlags?: MediaFlags;
1224
1262
  /** Host of siphon's own `Contact` toward the caller; see {@link ResponseOptions}. */
1225
1263
  contactHost?: string;
1226
1264
  /** User part of siphon's own `Contact` toward the caller; see {@link ResponseOptions}. */
@@ -1395,6 +1433,7 @@ type OriginateMedia =
1395
1433
  anchor: true;
1396
1434
  profile?: string;
1397
1435
  wsUri?: string;
1436
+ mediaFlags?: MediaFlags;
1398
1437
  }
1399
1438
  /** Your own SDP offer (`application/sdp` by definition). */
1400
1439
  | {
@@ -1884,6 +1923,11 @@ interface StreamOptions {
1884
1923
  * and an unknown name rejects with `bad_request`.
1885
1924
  */
1886
1925
  profile?: string;
1926
+ /**
1927
+ * Bridge only: overrides of `profile`'s settings for this bridge. They need a
1928
+ * `profile` to merge over; without one, or on a tee, the server refuses them.
1929
+ */
1930
+ mediaFlags?: MediaFlags;
1887
1931
  }
1888
1932
  /** Options for {@link Call.streamStop}. */
1889
1933
  interface StreamStopOptions {
@@ -2501,4 +2545,4 @@ declare class SipServer {
2501
2545
  close(): Promise<void>;
2502
2546
  }
2503
2547
 
2504
- 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 DialOffer, 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, OUTBOUND_REGISTRATIONS, type OriginateMedia, type OriginateOptions, type OriginateRing, type OriginatedGroup, type OutboundRegistration, type OutboundRegistrationsReply, PROTOCOL_VERSION, type PeerHangupPolicy, type PlayFinishedPayload, type PlayOptions, type PlaySource, type PlayStartedPayload, REGISTRATIONS, RESYNC, type RecordChannels, type RecordDirection, type RecordOptions, type Recording, type ReferReplaces, type RegistrantChangedPayload, type RegistrationChangedPayload, type RegistrationContact, type RegistrationsReply, type ReplyError, type ReplyFrame, type ReplyStatus, type ResponseOptions, type ResyncResult, type RingOptions, type RouteOptions, 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 };
2548
+ 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 DialOffer, 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 MediaFlags, type MediaLegSummary, type MediaStartedPayload, type MediaSummaryPayload, OUTBOUND_REGISTRATIONS, type OriginateMedia, type OriginateOptions, type OriginateRing, type OriginatedGroup, type OutboundRegistration, type OutboundRegistrationsReply, PROTOCOL_VERSION, type PeerHangupPolicy, type PlayFinishedPayload, type PlayOptions, type PlaySource, type PlayStartedPayload, REGISTRATIONS, RESYNC, type RecordChannels, type RecordDirection, type RecordOptions, type Recording, type ReferReplaces, type RegistrantChangedPayload, type RegistrationChangedPayload, type RegistrationContact, type RegistrationsReply, type ReplyError, type ReplyFrame, type ReplyStatus, type ResponseOptions, type ResyncResult, type RingOptions, type RouteOptions, 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 };
package/dist/index.js CHANGED
@@ -653,6 +653,28 @@ function responseArgs(options) {
653
653
  }
654
654
  return args;
655
655
  }
656
+ var MEDIA_FLAG_WIRE_NAMES = [
657
+ ["echoCancellation", "echo_cancellation"],
658
+ ["echoDelaySearchMs", "echo_delay_search_ms"],
659
+ ["echoLongTail", "echo_long_tail"],
660
+ ["echoResidualSuppression", "echo_residual_suppression"],
661
+ ["noiseSuppression", "noise_suppression"],
662
+ ["wsVad", "ws_vad"],
663
+ ["wsVadEngine", "ws_vad_engine"],
664
+ ["wsVadMinSpeechMs", "ws_vad_min_speech_ms"],
665
+ ["wsVadThreshold", "ws_vad_threshold"],
666
+ ["wsVadHangoverMs", "ws_vad_hangover_ms"],
667
+ ["wsBargeIn", "ws_barge_in"],
668
+ ["wsSampleRate", "ws_sample_rate"]
669
+ ];
670
+ function mediaFlagsArg(flags) {
671
+ const wire = {};
672
+ for (const [name, wireName] of MEDIA_FLAG_WIRE_NAMES) {
673
+ const value = flags[name];
674
+ if (value !== void 0) wire[wireName] = value;
675
+ }
676
+ return wire;
677
+ }
656
678
  function insertTransferIdentity(args, identity) {
657
679
  if (identity?.from !== void 0) args.from = identity.from;
658
680
  if (identity?.fromDisplay !== void 0) args.from_display = identity.fromDisplay;
@@ -754,6 +776,7 @@ function originateCommonArgs(args, media, options) {
754
776
  args.media = true;
755
777
  if (media.profile !== void 0) args.profile = media.profile;
756
778
  if (media.wsUri !== void 0) args.ws_uri = media.wsUri;
779
+ if (media.mediaFlags !== void 0) args.media_flags = mediaFlagsArg(media.mediaFlags);
757
780
  } else if ("sdp" in media) {
758
781
  args.sdp = media.sdp;
759
782
  } else {
@@ -1040,6 +1063,9 @@ var Call = class {
1040
1063
  if (options?.wsUri !== void 0) {
1041
1064
  args.ws_uri = options.wsUri;
1042
1065
  }
1066
+ if (options?.mediaFlags !== void 0) {
1067
+ args.media_flags = mediaFlagsArg(options.mediaFlags);
1068
+ }
1043
1069
  if (options?.contactHost !== void 0) {
1044
1070
  args.contact_host = options.contactHost;
1045
1071
  }
@@ -1573,6 +1599,9 @@ var Call = class {
1573
1599
  if (options?.profile !== void 0) {
1574
1600
  args.profile = options.profile;
1575
1601
  }
1602
+ if (options?.mediaFlags !== void 0) {
1603
+ args.media_flags = mediaFlagsArg(options.mediaFlags);
1604
+ }
1576
1605
  await this.sip(SipVerb.StreamStart, args);
1577
1606
  }
1578
1607
  /**