@siphon-project/control 0.11.0 → 0.13.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
@@ -165,7 +165,14 @@ var SipVerb = {
165
165
  /** Record the call's decoded audio to a wav file (siphon-rtp backend only). */
166
166
  RecordStart: "record_start",
167
167
  /** Stop one recording by id, or every recording on the call. */
168
- RecordStop: "record_stop"
168
+ RecordStop: "record_stop",
169
+ /**
170
+ * Accept a recording session (a channel whose `StasisStart` has
171
+ * `kind: "siprec"`): siphon answers the recording client 200 and records each
172
+ * stream. {@link SipVerb.Reject} refuses one; neither within the handoff
173
+ * deadline refuses it `503`.
174
+ */
175
+ Accept: "accept"
169
176
  };
170
177
  function sipEventKind(name) {
171
178
  return name;
@@ -952,6 +959,8 @@ function recordStartArgs(options) {
952
959
  if (options.maxDurationMs !== void 0) args.max_duration_ms = options.maxDurationMs;
953
960
  if (options.silenceMs !== void 0) args.silence_ms = options.silenceMs;
954
961
  if (options.path !== void 0) args.path = options.path;
962
+ if (options.format !== void 0) args.format = options.format;
963
+ if (options.bitrateBps !== void 0) args.bitrate_bps = options.bitrateBps;
955
964
  return args;
956
965
  }
957
966
  function recordStopArgs(recordingId) {
@@ -1106,6 +1115,31 @@ var Call = class {
1106
1115
  async progress(options) {
1107
1116
  await this.sip(SipVerb.Progress, options ? responseArgs(options) : {});
1108
1117
  }
1118
+ /**
1119
+ * Accept a recording session (`StasisStart` with `kind: "siprec"`): siphon
1120
+ * answers the recording client and records each stream as `options` say.
1121
+ * Unset fields take siphon's `srs:` configuration. Refuse one with
1122
+ * {@link Call.reject}.
1123
+ */
1124
+ async acceptRecording(options = {}) {
1125
+ const args = {};
1126
+ if (options.profile !== void 0) {
1127
+ args.profile = options.profile;
1128
+ }
1129
+ if (options.format !== void 0) {
1130
+ args.format = options.format;
1131
+ }
1132
+ if (options.bitrateBps !== void 0) {
1133
+ args.bitrate_bps = options.bitrateBps;
1134
+ }
1135
+ if (options.channels !== void 0) {
1136
+ args.channels = options.channels;
1137
+ }
1138
+ if (options.path !== void 0) {
1139
+ args.path = options.path;
1140
+ }
1141
+ await this.sip(SipVerb.Accept, args);
1142
+ }
1109
1143
  /** Send a final non-2xx and tear the call down. */
1110
1144
  async reject(code, reason) {
1111
1145
  const args = { code };
@@ -1620,7 +1654,8 @@ var Call = class {
1620
1654
  await this.sip(SipVerb.StreamStop, { mode: options?.mode ?? "tee" });
1621
1655
  }
1622
1656
  /**
1623
- * Record this call's decoded audio to a wav file.
1657
+ * Record this call's decoded audio to a file: wav by default, or Ogg Opus
1658
+ * with `format: "ogg_opus"`.
1624
1659
  *
1625
1660
  * The reply names the `recordingId` a later {@link Call.recordStop}
1626
1661
  * addresses. It is **not** the file: `RecordingFinished` fires when the file