@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.d.cts CHANGED
@@ -238,6 +238,13 @@ declare const SipVerb: {
238
238
  readonly RecordStart: "record_start";
239
239
  /** Stop one recording by id, or every recording on the call. */
240
240
  readonly RecordStop: "record_stop";
241
+ /**
242
+ * Accept a recording session (a channel whose `StasisStart` has
243
+ * `kind: "siprec"`): siphon answers the recording client 200 and records each
244
+ * stream. {@link SipVerb.Reject} refuses one; neither within the handoff
245
+ * deadline refuses it `503`.
246
+ */
247
+ readonly Accept: "accept";
241
248
  };
242
249
  /** A value of {@link SipVerb}. */
243
250
  type SipVerbToken = (typeof SipVerb)[keyof typeof SipVerb];
@@ -1815,6 +1822,28 @@ interface Dialing {
1815
1822
  type RecordDirection = "ingress" | "egress" | "both";
1816
1823
  /** The channel layout of the recorded file. */
1817
1824
  type RecordChannels = "mono" | "stereo";
1825
+ /**
1826
+ * The file a recording is written as: `"wav"` (the server's default) or
1827
+ * `"ogg_opus"` (RFC 7845), about a seventh of the size. An engine that cannot
1828
+ * write Ogg Opus refuses the verb.
1829
+ */
1830
+ type RecordFormat = "wav" | "ogg_opus";
1831
+ /** How an accepted recording session is recorded ({@link Call.acceptRecording}). */
1832
+ interface RecordingAcceptOptions {
1833
+ /** A media profile in place of `srs.rtpengine_profile`. */
1834
+ profile?: string;
1835
+ /** The file format; unset is `wav`. */
1836
+ format?: RecordFormat;
1837
+ /** Opus target bitrate (`ogg_opus` only). */
1838
+ bitrateBps?: number;
1839
+ /**
1840
+ * `"stereo"` writes a two-stream session as one file, a participant per
1841
+ * channel; unset or `"mono"` is a file per stream.
1842
+ */
1843
+ channels?: "mono" | "stereo";
1844
+ /** An absolute directory siphon writes the files to; it names them. */
1845
+ path?: string;
1846
+ }
1818
1847
  /** Optional shaping for {@link Call.recordStart}. */
1819
1848
  interface RecordOptions {
1820
1849
  /** Which side to record (`"ingress"` server-side when unset). */
@@ -1827,6 +1856,14 @@ interface RecordOptions {
1827
1856
  silenceMs?: number;
1828
1857
  /** Where the engine writes the file. */
1829
1858
  path?: string;
1859
+ /** The file format (`"wav"` server-side when unset). */
1860
+ format?: RecordFormat;
1861
+ /**
1862
+ * Opus target bitrate in bits per second, `"ogg_opus"` only. The server
1863
+ * refuses it with `"wav"` and outside 6000 to 510000 (RFC 6716 §2.1.1);
1864
+ * unset is its per-channel default.
1865
+ */
1866
+ bitrateBps?: number;
1830
1867
  }
1831
1868
  /** What the server answers an accepted `record_start` with. */
1832
1869
  interface Recording {
@@ -2012,6 +2049,13 @@ declare class Call {
2012
2049
  * `183 Session Progress`). For plain alerting use {@link Call.ring}.
2013
2050
  */
2014
2051
  progress(options?: ResponseOptions): Promise<void>;
2052
+ /**
2053
+ * Accept a recording session (`StasisStart` with `kind: "siprec"`): siphon
2054
+ * answers the recording client and records each stream as `options` say.
2055
+ * Unset fields take siphon's `srs:` configuration. Refuse one with
2056
+ * {@link Call.reject}.
2057
+ */
2058
+ acceptRecording(options?: RecordingAcceptOptions): Promise<void>;
2015
2059
  /** Send a final non-2xx and tear the call down. */
2016
2060
  reject(code: number, reason?: string): Promise<void>;
2017
2061
  /**
@@ -2353,7 +2397,8 @@ declare class Call {
2353
2397
  */
2354
2398
  streamStop(options?: StreamStopOptions): Promise<void>;
2355
2399
  /**
2356
- * Record this call's decoded audio to a wav file.
2400
+ * Record this call's decoded audio to a file: wav by default, or Ogg Opus
2401
+ * with `format: "ogg_opus"`.
2357
2402
  *
2358
2403
  * The reply names the `recordingId` a later {@link Call.recordStop}
2359
2404
  * addresses. It is **not** the file: `RecordingFinished` fires when the file
@@ -2545,4 +2590,4 @@ declare class SipServer {
2545
2590
  close(): Promise<void>;
2546
2591
  }
2547
2592
 
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 };
2593
+ 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 RecordFormat, type RecordOptions, type Recording, type RecordingAcceptOptions, 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
@@ -238,6 +238,13 @@ declare const SipVerb: {
238
238
  readonly RecordStart: "record_start";
239
239
  /** Stop one recording by id, or every recording on the call. */
240
240
  readonly RecordStop: "record_stop";
241
+ /**
242
+ * Accept a recording session (a channel whose `StasisStart` has
243
+ * `kind: "siprec"`): siphon answers the recording client 200 and records each
244
+ * stream. {@link SipVerb.Reject} refuses one; neither within the handoff
245
+ * deadline refuses it `503`.
246
+ */
247
+ readonly Accept: "accept";
241
248
  };
242
249
  /** A value of {@link SipVerb}. */
243
250
  type SipVerbToken = (typeof SipVerb)[keyof typeof SipVerb];
@@ -1815,6 +1822,28 @@ interface Dialing {
1815
1822
  type RecordDirection = "ingress" | "egress" | "both";
1816
1823
  /** The channel layout of the recorded file. */
1817
1824
  type RecordChannels = "mono" | "stereo";
1825
+ /**
1826
+ * The file a recording is written as: `"wav"` (the server's default) or
1827
+ * `"ogg_opus"` (RFC 7845), about a seventh of the size. An engine that cannot
1828
+ * write Ogg Opus refuses the verb.
1829
+ */
1830
+ type RecordFormat = "wav" | "ogg_opus";
1831
+ /** How an accepted recording session is recorded ({@link Call.acceptRecording}). */
1832
+ interface RecordingAcceptOptions {
1833
+ /** A media profile in place of `srs.rtpengine_profile`. */
1834
+ profile?: string;
1835
+ /** The file format; unset is `wav`. */
1836
+ format?: RecordFormat;
1837
+ /** Opus target bitrate (`ogg_opus` only). */
1838
+ bitrateBps?: number;
1839
+ /**
1840
+ * `"stereo"` writes a two-stream session as one file, a participant per
1841
+ * channel; unset or `"mono"` is a file per stream.
1842
+ */
1843
+ channels?: "mono" | "stereo";
1844
+ /** An absolute directory siphon writes the files to; it names them. */
1845
+ path?: string;
1846
+ }
1818
1847
  /** Optional shaping for {@link Call.recordStart}. */
1819
1848
  interface RecordOptions {
1820
1849
  /** Which side to record (`"ingress"` server-side when unset). */
@@ -1827,6 +1856,14 @@ interface RecordOptions {
1827
1856
  silenceMs?: number;
1828
1857
  /** Where the engine writes the file. */
1829
1858
  path?: string;
1859
+ /** The file format (`"wav"` server-side when unset). */
1860
+ format?: RecordFormat;
1861
+ /**
1862
+ * Opus target bitrate in bits per second, `"ogg_opus"` only. The server
1863
+ * refuses it with `"wav"` and outside 6000 to 510000 (RFC 6716 §2.1.1);
1864
+ * unset is its per-channel default.
1865
+ */
1866
+ bitrateBps?: number;
1830
1867
  }
1831
1868
  /** What the server answers an accepted `record_start` with. */
1832
1869
  interface Recording {
@@ -2012,6 +2049,13 @@ declare class Call {
2012
2049
  * `183 Session Progress`). For plain alerting use {@link Call.ring}.
2013
2050
  */
2014
2051
  progress(options?: ResponseOptions): Promise<void>;
2052
+ /**
2053
+ * Accept a recording session (`StasisStart` with `kind: "siprec"`): siphon
2054
+ * answers the recording client and records each stream as `options` say.
2055
+ * Unset fields take siphon's `srs:` configuration. Refuse one with
2056
+ * {@link Call.reject}.
2057
+ */
2058
+ acceptRecording(options?: RecordingAcceptOptions): Promise<void>;
2015
2059
  /** Send a final non-2xx and tear the call down. */
2016
2060
  reject(code: number, reason?: string): Promise<void>;
2017
2061
  /**
@@ -2353,7 +2397,8 @@ declare class Call {
2353
2397
  */
2354
2398
  streamStop(options?: StreamStopOptions): Promise<void>;
2355
2399
  /**
2356
- * Record this call's decoded audio to a wav file.
2400
+ * Record this call's decoded audio to a file: wav by default, or Ogg Opus
2401
+ * with `format: "ogg_opus"`.
2357
2402
  *
2358
2403
  * The reply names the `recordingId` a later {@link Call.recordStop}
2359
2404
  * addresses. It is **not** the file: `RecordingFinished` fires when the file
@@ -2545,4 +2590,4 @@ declare class SipServer {
2545
2590
  close(): Promise<void>;
2546
2591
  }
2547
2592
 
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 };
2593
+ 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 RecordFormat, type RecordOptions, type Recording, type RecordingAcceptOptions, 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
@@ -159,7 +159,14 @@ var SipVerb = {
159
159
  /** Record the call's decoded audio to a wav file (siphon-rtp backend only). */
160
160
  RecordStart: "record_start",
161
161
  /** Stop one recording by id, or every recording on the call. */
162
- RecordStop: "record_stop"
162
+ RecordStop: "record_stop",
163
+ /**
164
+ * Accept a recording session (a channel whose `StasisStart` has
165
+ * `kind: "siprec"`): siphon answers the recording client 200 and records each
166
+ * stream. {@link SipVerb.Reject} refuses one; neither within the handoff
167
+ * deadline refuses it `503`.
168
+ */
169
+ Accept: "accept"
163
170
  };
164
171
  function sipEventKind(name) {
165
172
  return name;
@@ -946,6 +953,8 @@ function recordStartArgs(options) {
946
953
  if (options.maxDurationMs !== void 0) args.max_duration_ms = options.maxDurationMs;
947
954
  if (options.silenceMs !== void 0) args.silence_ms = options.silenceMs;
948
955
  if (options.path !== void 0) args.path = options.path;
956
+ if (options.format !== void 0) args.format = options.format;
957
+ if (options.bitrateBps !== void 0) args.bitrate_bps = options.bitrateBps;
949
958
  return args;
950
959
  }
951
960
  function recordStopArgs(recordingId) {
@@ -1100,6 +1109,31 @@ var Call = class {
1100
1109
  async progress(options) {
1101
1110
  await this.sip(SipVerb.Progress, options ? responseArgs(options) : {});
1102
1111
  }
1112
+ /**
1113
+ * Accept a recording session (`StasisStart` with `kind: "siprec"`): siphon
1114
+ * answers the recording client and records each stream as `options` say.
1115
+ * Unset fields take siphon's `srs:` configuration. Refuse one with
1116
+ * {@link Call.reject}.
1117
+ */
1118
+ async acceptRecording(options = {}) {
1119
+ const args = {};
1120
+ if (options.profile !== void 0) {
1121
+ args.profile = options.profile;
1122
+ }
1123
+ if (options.format !== void 0) {
1124
+ args.format = options.format;
1125
+ }
1126
+ if (options.bitrateBps !== void 0) {
1127
+ args.bitrate_bps = options.bitrateBps;
1128
+ }
1129
+ if (options.channels !== void 0) {
1130
+ args.channels = options.channels;
1131
+ }
1132
+ if (options.path !== void 0) {
1133
+ args.path = options.path;
1134
+ }
1135
+ await this.sip(SipVerb.Accept, args);
1136
+ }
1103
1137
  /** Send a final non-2xx and tear the call down. */
1104
1138
  async reject(code, reason) {
1105
1139
  const args = { code };
@@ -1614,7 +1648,8 @@ var Call = class {
1614
1648
  await this.sip(SipVerb.StreamStop, { mode: options?.mode ?? "tee" });
1615
1649
  }
1616
1650
  /**
1617
- * Record this call's decoded audio to a wav file.
1651
+ * Record this call's decoded audio to a file: wav by default, or Ogg Opus
1652
+ * with `format: "ogg_opus"`.
1618
1653
  *
1619
1654
  * The reply names the `recordingId` a later {@link Call.recordStop}
1620
1655
  * addresses. It is **not** the file: `RecordingFinished` fires when the file