@siphon-project/control 0.10.1 → 0.12.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.cjs CHANGED
@@ -659,6 +659,28 @@ function responseArgs(options) {
659
659
  }
660
660
  return args;
661
661
  }
662
+ var MEDIA_FLAG_WIRE_NAMES = [
663
+ ["echoCancellation", "echo_cancellation"],
664
+ ["echoDelaySearchMs", "echo_delay_search_ms"],
665
+ ["echoLongTail", "echo_long_tail"],
666
+ ["echoResidualSuppression", "echo_residual_suppression"],
667
+ ["noiseSuppression", "noise_suppression"],
668
+ ["wsVad", "ws_vad"],
669
+ ["wsVadEngine", "ws_vad_engine"],
670
+ ["wsVadMinSpeechMs", "ws_vad_min_speech_ms"],
671
+ ["wsVadThreshold", "ws_vad_threshold"],
672
+ ["wsVadHangoverMs", "ws_vad_hangover_ms"],
673
+ ["wsBargeIn", "ws_barge_in"],
674
+ ["wsSampleRate", "ws_sample_rate"]
675
+ ];
676
+ function mediaFlagsArg(flags) {
677
+ const wire = {};
678
+ for (const [name, wireName] of MEDIA_FLAG_WIRE_NAMES) {
679
+ const value = flags[name];
680
+ if (value !== void 0) wire[wireName] = value;
681
+ }
682
+ return wire;
683
+ }
662
684
  function insertTransferIdentity(args, identity) {
663
685
  if (identity?.from !== void 0) args.from = identity.from;
664
686
  if (identity?.fromDisplay !== void 0) args.from_display = identity.fromDisplay;
@@ -760,6 +782,7 @@ function originateCommonArgs(args, media, options) {
760
782
  args.media = true;
761
783
  if (media.profile !== void 0) args.profile = media.profile;
762
784
  if (media.wsUri !== void 0) args.ws_uri = media.wsUri;
785
+ if (media.mediaFlags !== void 0) args.media_flags = mediaFlagsArg(media.mediaFlags);
763
786
  } else if ("sdp" in media) {
764
787
  args.sdp = media.sdp;
765
788
  } else {
@@ -929,6 +952,8 @@ function recordStartArgs(options) {
929
952
  if (options.maxDurationMs !== void 0) args.max_duration_ms = options.maxDurationMs;
930
953
  if (options.silenceMs !== void 0) args.silence_ms = options.silenceMs;
931
954
  if (options.path !== void 0) args.path = options.path;
955
+ if (options.format !== void 0) args.format = options.format;
956
+ if (options.bitrateBps !== void 0) args.bitrate_bps = options.bitrateBps;
932
957
  return args;
933
958
  }
934
959
  function recordStopArgs(recordingId) {
@@ -1046,6 +1071,9 @@ var Call = class {
1046
1071
  if (options?.wsUri !== void 0) {
1047
1072
  args.ws_uri = options.wsUri;
1048
1073
  }
1074
+ if (options?.mediaFlags !== void 0) {
1075
+ args.media_flags = mediaFlagsArg(options.mediaFlags);
1076
+ }
1049
1077
  if (options?.contactHost !== void 0) {
1050
1078
  args.contact_host = options.contactHost;
1051
1079
  }
@@ -1579,6 +1607,9 @@ var Call = class {
1579
1607
  if (options?.profile !== void 0) {
1580
1608
  args.profile = options.profile;
1581
1609
  }
1610
+ if (options?.mediaFlags !== void 0) {
1611
+ args.media_flags = mediaFlagsArg(options.mediaFlags);
1612
+ }
1582
1613
  await this.sip(SipVerb.StreamStart, args);
1583
1614
  }
1584
1615
  /**
@@ -1591,7 +1622,8 @@ var Call = class {
1591
1622
  await this.sip(SipVerb.StreamStop, { mode: options?.mode ?? "tee" });
1592
1623
  }
1593
1624
  /**
1594
- * Record this call's decoded audio to a wav file.
1625
+ * Record this call's decoded audio to a file: wav by default, or Ogg Opus
1626
+ * with `format: "ogg_opus"`.
1595
1627
  *
1596
1628
  * The reply names the `recordingId` a later {@link Call.recordStop}
1597
1629
  * addresses. It is **not** the file: `RecordingFinished` fires when the file