@signalwire/js 4.0.0-beta.7 → 4.0.0-beta.9

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.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as JSONRPCRequest, r as JSONRPCResponse, t as EventChannel } from "./base-aVtoG8Wk.mjs";
1
+ import { a as JSONRPCSuccessResponse, i as JSONRPCResponse, n as JSONRPCErrorResponse, r as JSONRPCRequest, t as EventChannel } from "./base-CQPEW1lJ.mjs";
2
2
  import * as rxjs0 from "rxjs";
3
3
  import { BehaviorSubject, Observable, Observer, ReplaySubject, Subject, Subscription } from "rxjs";
4
4
  import { URL as URL$1 } from "node:url";
@@ -11,6 +11,29 @@ declare abstract class Destroyable {
11
11
  private _observableCache?;
12
12
  destroy(): void;
13
13
  protected cachedObservable<T>(key: string, factory: () => Observable<T>): Observable<T>;
14
+ /**
15
+ * Like `cachedObservable`, but defers emissions to the microtask queue
16
+ * via `observeOn(asapScheduler)`.
17
+ *
18
+ * Use ONLY for public-facing observable getters that external consumers
19
+ * subscribe to. Prevents a class of bugs where `BehaviorSubject` or
20
+ * `ReplaySubject` replays synchronously during `subscribe()`, before
21
+ * the subscription variable is assigned in the caller's scope.
22
+ *
23
+ * Do NOT use for observables consumed internally by the SDK — internal
24
+ * code using `subscribeTo()`, `firstValueFrom()`, or `withLatestFrom()`
25
+ * depends on synchronous emission delivery.
26
+ */
27
+ protected publicCachedObservable<T>(key: string, factory: () => Observable<T>): Observable<T>;
28
+ /**
29
+ * Wraps an observable so emissions are deferred to the microtask queue.
30
+ *
31
+ * Use ONLY for public-facing getters that expose a subject via
32
+ * `.asObservable()` without going through `cachedObservable`.
33
+ *
34
+ * Do NOT use for observables consumed internally by the SDK.
35
+ */
36
+ protected deferEmission<T>(observable: Observable<T>): Observable<T>;
14
37
  protected subscribeTo<T>(observable: Observable<T>, observerOrNext: Partial<Observer<T>> | ((value: T) => void) | undefined): void;
15
38
  protected createSubject<T>(): Subject<T>;
16
39
  protected createReplaySubject<T>(bufferSize?: number, windowTime?: number): ReplaySubject<T>;
@@ -505,6 +528,11 @@ type CallDevice = CallDeviceWebRTCOrSIP | CallDevicePhone;
505
528
  type VideoPosition = 'auto' | `reserved-${number}` | `standard-${number}` | 'off-canvas' | 'playback' | 'full-screen';
506
529
  //#endregion
507
530
  //#region src/core/RPCMessages/types/common.d.ts
531
+ interface MemberTarget {
532
+ member_id: string;
533
+ call_id: string;
534
+ node_id: string;
535
+ }
508
536
  interface Member {
509
537
  room_session_id: string;
510
538
  room_id: string;
@@ -581,60 +609,11 @@ interface ConversationDetails {
581
609
  start_time: number;
582
610
  end_time?: number;
583
611
  }
584
- interface PartialDialogParams {
585
- callID: string;
586
- }
587
- interface AudioMediaParams {
588
- autoGainControl: boolean;
589
- echoCancellation: boolean;
590
- noiseSuppression: boolean;
591
- }
592
- interface FrameRateConstraint {
593
- min: number;
594
- ideal: number;
595
- max: number;
596
- }
597
- interface AspectRatioConstraint {
598
- exact: number;
599
- }
600
- interface DimensionConstraint {
601
- min: number;
602
- ideal: number;
603
- }
604
- interface VideoAdvancedConstraint {
605
- width: DimensionConstraint;
606
- height: DimensionConstraint;
607
- frameRate: FrameRateConstraint;
608
- }
609
- interface VideoMediaParams {
610
- frameRate: FrameRateConstraint;
611
- aspectRatio: AspectRatioConstraint;
612
- width: DimensionConstraint;
613
- height: DimensionConstraint;
614
- advanced: VideoAdvancedConstraint[];
615
- resizeMode: string;
616
- }
617
- interface MediaParams {
618
- audio?: AudioMediaParams;
619
- video?: VideoMediaParams;
620
- }
621
612
  //#endregion
622
613
  //#region src/core/RPCMessages/types/verto.d.ts
623
614
  interface VertoParams {
624
615
  userVariables?: Record<string, unknown>;
625
616
  }
626
- interface VertoAnswerParams extends VertoParams {
627
- callID: string;
628
- sdp?: string;
629
- }
630
- interface VertoMediaParamsParams extends VertoParams {
631
- callID: string;
632
- mediaParams: MediaParams;
633
- }
634
- interface VertoPingParams extends VertoParams {
635
- callID: string;
636
- dialogParams: PartialDialogParams;
637
- }
638
617
  //#endregion
639
618
  //#region src/core/RPCMessages/types/events.d.ts
640
619
  interface SignalwireAuthorizationStatePayload {
@@ -644,7 +623,7 @@ interface WebrtcMessagePayload {
644
623
  jsonrpc: '2.0';
645
624
  id: number;
646
625
  method: string;
647
- params: VertoAnswerParams | VertoMediaParamsParams | VertoPingParams;
626
+ params: VertoParams;
648
627
  }
649
628
  interface CallJoinedPayload {
650
629
  room_session: RoomSession;
@@ -741,7 +720,6 @@ interface ConversationMessagePayload {
741
720
  conversation_name: string;
742
721
  user_name: string;
743
722
  }
744
- type ConversationMessageUpdatedPayload = ConversationMessagePayload;
745
723
  //#endregion
746
724
  //#region src/behaviors/types/collection.types.d.ts
747
725
  interface Entity {
@@ -813,11 +791,77 @@ declare class EntityCollectionTransformed<O extends Entity = Entity, T extends E
813
791
  //#endregion
814
792
  //#region src/managers/types/verto-manager.types.d.ts
815
793
  type ScreenShareStatus = 'none' | 'starting' | 'started' | 'stopping';
816
- type SignalingStatus = 'trying' | 'ringing' | 'connecting' | 'connected' | 'disconnected' | 'failed';
794
+ type SignalingStatus = Extract<CallStatus, 'trying' | 'ringing' | 'connecting' | 'connected' | 'disconnected' | 'failed'>;
817
795
  interface TransferOptions {
818
796
  destination: string;
819
797
  }
820
798
  //#endregion
799
+ //#region src/core/errors.d.ts
800
+ declare class UnexpectedError extends Error {
801
+ at?: string | undefined;
802
+ constructor(at?: string | undefined, options?: ErrorOptions);
803
+ }
804
+ declare class InvalidCredentialsError extends Error {
805
+ reason: string;
806
+ constructor(reason?: string, options?: ErrorOptions);
807
+ }
808
+ /**
809
+ * Semantic category of a call-lifecycle error.
810
+ *
811
+ * - `'media'` – RTCPeerConnection / media device failure
812
+ * - `'signaling'` – Verto / JSON-RPC protocol error
813
+ * - `'timeout'` – Call setup timed out waiting for a response
814
+ * - `'rejected'` – Remote side rejected the call
815
+ * - `'network'` – Transport lost during an active call
816
+ * - `'internal'` – Unexpected / unknown error
817
+ */
818
+ type CallErrorKind = 'media' | 'signaling' | 'timeout' | 'rejected' | 'network' | 'internal';
819
+ /**
820
+ * Structured error emitted on `call.errors$`.
821
+ *
822
+ * Provides actionable metadata so consumers can react without
823
+ * resorting to `instanceof` checks on raw `Error` objects.
824
+ */
825
+ interface CallError {
826
+ /** Semantic category of the error. */
827
+ readonly kind: CallErrorKind;
828
+ /**
829
+ * Whether the error terminates the call.
830
+ * When `true`, the call will automatically transition to `'failed'`
831
+ * and be destroyed — no further action is needed from the consumer.
832
+ */
833
+ readonly fatal: boolean;
834
+ /** The underlying error. */
835
+ readonly error: Error;
836
+ /** ID of the call that produced this error. */
837
+ readonly callId: string;
838
+ }
839
+ declare class CallCreateError extends Error {
840
+ message: string;
841
+ error: unknown;
842
+ direction: 'inbound' | 'outbound';
843
+ constructor(message: string, error?: unknown, direction?: 'inbound' | 'outbound', options?: ErrorOptions);
844
+ }
845
+ declare class VertoPongError extends Error {
846
+ originalError: unknown;
847
+ constructor(originalError: unknown);
848
+ }
849
+ declare class MessageParseError extends Error {
850
+ originalError: unknown;
851
+ constructor(originalError: unknown);
852
+ }
853
+ declare class CollectionFetchError extends Error {
854
+ operation: string;
855
+ originalError: unknown;
856
+ constructor(operation: string, originalError: unknown);
857
+ }
858
+ declare class MediaTrackError extends Error {
859
+ operation: string;
860
+ kind: string;
861
+ originalError: unknown;
862
+ constructor(operation: string, kind: string, originalError: unknown);
863
+ }
864
+ //#endregion
821
865
  //#region src/core/RPCMessages/RPCConnect.d.ts
822
866
  interface Authorization {
823
867
  jti: string;
@@ -1020,7 +1064,7 @@ interface VertoManager {
1020
1064
  * Callback type for executing call methods
1021
1065
  * Injected to avoid circular dependency with Call class
1022
1066
  */
1023
- type ExecuteMethod = <T extends JSONRPCResponse = JSONRPCResponse>(target: string, method: string, args: Record<string, unknown>) => Promise<T>;
1067
+ type ExecuteMethod = <T extends JSONRPCResponse = JSONRPCResponse>(target: string | MemberTarget, method: string, args: Record<string, unknown>) => Promise<T>;
1024
1068
  type ParticipantState = Member & {
1025
1069
  position: LayoutLayer;
1026
1070
  };
@@ -1392,7 +1436,7 @@ interface Call extends CallState {
1392
1436
  readonly remoteStream$: Observable<MediaStream | null>;
1393
1437
  readonly remoteStream: MediaStream | null;
1394
1438
  readonly rtcPeerConnection: RTCPeerConnection | undefined;
1395
- readonly errors$: Observable<Error>;
1439
+ readonly errors$: Observable<CallError>;
1396
1440
  readonly signalingEvent$: Observable<Record<string, unknown>>;
1397
1441
  readonly address?: CallAddress;
1398
1442
  readonly address$: Observable<CallAddress | undefined>;
@@ -1407,7 +1451,7 @@ interface Call extends CallState {
1407
1451
  transfer(options: TransferOptions): Promise<void>;
1408
1452
  toggleIncomingVideo(): Promise<void>;
1409
1453
  toggleIncomingAudio(): Promise<void>;
1410
- answer(): void;
1454
+ answer(options?: MediaOptions): void;
1411
1455
  reject(): void;
1412
1456
  sendDigits(digits: string): Promise<void>;
1413
1457
  executeMethod<T extends JSONRPCResponse = JSONRPCResponse>(target: string, method: string, args: Record<string, unknown>): Promise<T>;
@@ -1427,6 +1471,7 @@ interface CallManager extends Call {
1427
1471
  readonly nodeId$: Observable<string | null>;
1428
1472
  readonly nodeId: string | null;
1429
1473
  readonly answered$: Observable<boolean>;
1474
+ readonly answerMediaOptions?: MediaOptions;
1430
1475
  readonly callUpdated$: Observable<CallUpdatedPayload>;
1431
1476
  readonly memberJoined$: Observable<MemberJoinedPayload>;
1432
1477
  readonly memberLeft$: Observable<MemberLeftPayload>;
@@ -1675,18 +1720,52 @@ declare class TransportManager extends Destroyable {
1675
1720
  private readonly storage;
1676
1721
  private readonly protocolKey;
1677
1722
  private readonly onError?;
1723
+ /**
1724
+ * Normalise a server event timestamp to epoch seconds.
1725
+ *
1726
+ * The server uses two formats:
1727
+ * - `webrtc.message`: float epoch seconds (e.g. 1774372099.022817)
1728
+ * - all other events: int epoch microseconds (e.g. 1774372099925857)
1729
+ *
1730
+ * Values above 1e12 are treated as microseconds and divided by 1e6.
1731
+ */
1732
+ private static toEpochSeconds;
1733
+ /**
1734
+ * Extract the event timestamp from a signalwire.event message.
1735
+ * Returns `null` for messages that have no timestamp
1736
+ * (e.g. signalwire.authorization.state, RPC responses).
1737
+ */
1738
+ private static extractEventTimestamp;
1678
1739
  private initialized$;
1679
1740
  protocol$: rxjs0.ReplaySubject<string | undefined>;
1680
1741
  private isConnecting;
1681
1742
  private isConnected;
1682
1743
  private ackEvent;
1683
1744
  private replySignalwirePing;
1745
+ /**
1746
+ * Filter that drops events whose timestamp predates the current session.
1747
+ *
1748
+ * On each new connection the session epoch is reset (see `resetSessionEpoch`).
1749
+ * The first timestamped event after reset establishes the epoch.
1750
+ * Subsequent events with timestamps older than the epoch are discarded —
1751
+ * this guards against stale events replayed by the server after a reconnect.
1752
+ *
1753
+ * Events without a timestamp (e.g. signalwire.authorization.state) and
1754
+ * non-event messages (RPC responses) always pass through.
1755
+ */
1756
+ private discardStaleEvents;
1757
+ private _sessionEpoch;
1684
1758
  private _outgoingMessages$;
1685
1759
  private _webSocketConnections;
1686
1760
  private _jsonRPCMessage$;
1687
1761
  private _jsonRPCResponse$;
1688
1762
  private _incomingEvent$;
1689
1763
  constructor(storage: StorageManager, protocolKey: string, webSocketConstructor: WebSocketAdapter | NodeSocketAdapter, relayHost: string, onError?: ((error: Error) => void) | undefined);
1764
+ /**
1765
+ * Reset the session epoch. Call this before each signalwire.connect
1766
+ * so that the first event after authentication establishes the new baseline.
1767
+ */
1768
+ resetSessionEpoch(): void;
1690
1769
  setProtocol(protocol: string | undefined): Promise<void>;
1691
1770
  get incomingEvent$(): Observable<JSONRPCRequest | JSONRPCResponse>;
1692
1771
  get connectionStatus$(): Observable<string>;
@@ -1856,84 +1935,146 @@ declare class ClientSessionManager extends Destroyable implements SessionState {
1856
1935
  private loadAuthorizationStateFromStorage;
1857
1936
  private updateAuthorizationStateInStorage;
1858
1937
  private get authStateEvent$();
1859
- get signalingEvent$(): Observable<{
1938
+ get signalingEvent$(): Observable<(Omit<{
1860
1939
  event_type: "webrtc.message";
1861
- event_channel: string;
1940
+ event_channel: EventChannel;
1862
1941
  timestamp: number;
1942
+ project_id?: string;
1943
+ node_id?: string;
1944
+ is_author?: boolean;
1945
+ params: WebrtcMessagePayload;
1946
+ }, "event_channel" | "project_id" | "node_id"> & {
1947
+ event_channel: string;
1863
1948
  project_id: string;
1864
1949
  node_id: string;
1865
- params: WebrtcMessagePayload;
1866
- } | {
1950
+ }) | {
1867
1951
  event_type: "signalwire.authorization.state";
1868
1952
  params: SignalwireAuthorizationStatePayload;
1869
- } | {
1953
+ } | (Omit<{
1870
1954
  event_type: "call.joined";
1871
- event_channel: string;
1955
+ event_channel: EventChannel;
1872
1956
  timestamp: number;
1957
+ project_id?: string;
1958
+ node_id?: string;
1959
+ is_author?: boolean;
1873
1960
  params: CallJoinedPayload;
1874
- } | {
1875
- event_type: "call.left";
1961
+ }, "event_channel"> & {
1876
1962
  event_channel: string;
1963
+ }) | (Omit<{
1964
+ event_type: "call.left";
1965
+ event_channel: EventChannel;
1877
1966
  timestamp: number;
1967
+ project_id?: string;
1968
+ node_id?: string;
1969
+ is_author?: boolean;
1878
1970
  params: CallLeftPayload;
1879
- } | {
1880
- event_type: "call.updated";
1971
+ }, "event_channel"> & {
1881
1972
  event_channel: string;
1973
+ }) | (Omit<{
1974
+ event_type: "call.updated";
1975
+ event_channel: EventChannel;
1882
1976
  timestamp: number;
1977
+ project_id?: string;
1978
+ node_id?: string;
1979
+ is_author?: boolean;
1883
1980
  params: CallUpdatedPayload;
1884
- } | {
1885
- event_type: "call.state";
1981
+ }, "event_channel"> & {
1886
1982
  event_channel: string;
1983
+ }) | (Omit<{
1984
+ event_type: "call.state";
1985
+ event_channel: EventChannel;
1887
1986
  timestamp: number;
1987
+ project_id?: string;
1988
+ node_id?: string;
1989
+ is_author?: boolean;
1888
1990
  params: CallStatePayload;
1889
- } | {
1890
- event_type: "call.play";
1991
+ }, "event_channel"> & {
1891
1992
  event_channel: string;
1993
+ }) | (Omit<{
1994
+ event_type: "call.play";
1995
+ event_channel: EventChannel;
1892
1996
  timestamp: number;
1997
+ project_id?: string;
1998
+ node_id?: string;
1999
+ is_author?: boolean;
1893
2000
  params: CallPlayPayload;
1894
- } | {
1895
- event_type: "call.connect";
2001
+ }, "event_channel"> & {
1896
2002
  event_channel: string;
2003
+ }) | (Omit<{
2004
+ event_type: "call.connect";
2005
+ event_channel: EventChannel;
1897
2006
  timestamp: number;
2007
+ project_id?: string;
2008
+ node_id?: string;
2009
+ is_author?: boolean;
1898
2010
  params: CallConnectPayload;
1899
- } | {
2011
+ }, "event_channel"> & {
2012
+ event_channel: string;
2013
+ }) | Omit<{
1900
2014
  event_type: "member.updated";
1901
2015
  event_channel: EventChannel;
1902
2016
  timestamp: number;
2017
+ project_id?: string;
2018
+ node_id?: string;
2019
+ is_author?: boolean;
1903
2020
  params: MemberUpdatedPayload;
1904
- } | {
2021
+ }, never> | Omit<{
1905
2022
  event_type: "member.joined";
1906
2023
  event_channel: EventChannel;
1907
2024
  timestamp: number;
2025
+ project_id?: string;
2026
+ node_id?: string;
2027
+ is_author?: boolean;
1908
2028
  params: MemberJoinedPayload;
1909
- } | {
2029
+ }, never> | Omit<{
1910
2030
  event_type: "member.left";
1911
2031
  event_channel: EventChannel;
1912
2032
  timestamp: number;
2033
+ project_id?: string;
2034
+ node_id?: string;
2035
+ is_author?: boolean;
1913
2036
  params: MemberLeftPayload;
1914
- } | {
2037
+ }, never> | Omit<{
1915
2038
  event_type: "member.talking";
1916
2039
  event_channel: EventChannel;
1917
2040
  timestamp: number;
2041
+ project_id?: string;
2042
+ node_id?: string;
2043
+ is_author?: boolean;
1918
2044
  params: MemberTalkingPayload;
1919
- } | {
2045
+ }, never> | Omit<{
1920
2046
  event_type: "layout.changed";
1921
2047
  event_channel: EventChannel;
1922
2048
  timestamp: number;
2049
+ project_id?: string;
2050
+ node_id?: string;
2051
+ is_author?: boolean;
1923
2052
  params: LayoutChangedPayload;
1924
- } | {
2053
+ }, never> | (Omit<{
1925
2054
  event_type: "conversation.message";
2055
+ event_channel: EventChannel;
2056
+ timestamp: number;
2057
+ project_id?: string;
2058
+ node_id?: string;
2059
+ is_author?: boolean;
2060
+ params: ConversationMessagePayload;
2061
+ }, "event_channel" | "timestamp" | "is_author"> & {
1926
2062
  event_channel: string;
1927
2063
  timestamp: string;
1928
2064
  is_author: boolean;
1929
- params: ConversationMessagePayload;
1930
- } | {
2065
+ }) | (Omit<{
1931
2066
  event_type: "conversation.message.updated";
2067
+ event_channel: EventChannel;
2068
+ timestamp: number;
2069
+ project_id?: string;
2070
+ node_id?: string;
2071
+ is_author?: boolean;
2072
+ params: ConversationMessagePayload;
2073
+ }, "event_channel" | "timestamp" | "is_author"> & {
1932
2074
  event_channel: string;
1933
2075
  timestamp: string;
1934
2076
  is_author: boolean;
1935
- params: ConversationMessageUpdatedPayload;
1936
- }>;
2077
+ })>;
1937
2078
  private get vertoInvite$();
1938
2079
  private get contexts();
1939
2080
  private get eventing();
@@ -1956,84 +2097,146 @@ declare class ClientSessionWrapper implements SessionState {
1956
2097
  constructor(clientSessionManager: ClientSessionManager);
1957
2098
  get authenticated$(): Observable<boolean>;
1958
2099
  get authenticated(): boolean;
1959
- get signalingEvent$(): Observable<{
2100
+ get signalingEvent$(): Observable<(Omit<{
1960
2101
  event_type: "webrtc.message";
1961
- event_channel: string;
2102
+ event_channel: EventChannel;
1962
2103
  timestamp: number;
2104
+ project_id?: string;
2105
+ node_id?: string;
2106
+ is_author?: boolean;
2107
+ params: WebrtcMessagePayload;
2108
+ }, "event_channel" | "project_id" | "node_id"> & {
2109
+ event_channel: string;
1963
2110
  project_id: string;
1964
2111
  node_id: string;
1965
- params: WebrtcMessagePayload;
1966
- } | {
2112
+ }) | {
1967
2113
  event_type: "signalwire.authorization.state";
1968
2114
  params: SignalwireAuthorizationStatePayload;
1969
- } | {
2115
+ } | (Omit<{
1970
2116
  event_type: "call.joined";
1971
- event_channel: string;
2117
+ event_channel: EventChannel;
1972
2118
  timestamp: number;
2119
+ project_id?: string;
2120
+ node_id?: string;
2121
+ is_author?: boolean;
1973
2122
  params: CallJoinedPayload;
1974
- } | {
1975
- event_type: "call.left";
2123
+ }, "event_channel"> & {
1976
2124
  event_channel: string;
2125
+ }) | (Omit<{
2126
+ event_type: "call.left";
2127
+ event_channel: EventChannel;
1977
2128
  timestamp: number;
2129
+ project_id?: string;
2130
+ node_id?: string;
2131
+ is_author?: boolean;
1978
2132
  params: CallLeftPayload;
1979
- } | {
1980
- event_type: "call.updated";
2133
+ }, "event_channel"> & {
1981
2134
  event_channel: string;
2135
+ }) | (Omit<{
2136
+ event_type: "call.updated";
2137
+ event_channel: EventChannel;
1982
2138
  timestamp: number;
2139
+ project_id?: string;
2140
+ node_id?: string;
2141
+ is_author?: boolean;
1983
2142
  params: CallUpdatedPayload;
1984
- } | {
1985
- event_type: "call.state";
2143
+ }, "event_channel"> & {
1986
2144
  event_channel: string;
2145
+ }) | (Omit<{
2146
+ event_type: "call.state";
2147
+ event_channel: EventChannel;
1987
2148
  timestamp: number;
2149
+ project_id?: string;
2150
+ node_id?: string;
2151
+ is_author?: boolean;
1988
2152
  params: CallStatePayload;
1989
- } | {
1990
- event_type: "call.play";
2153
+ }, "event_channel"> & {
1991
2154
  event_channel: string;
2155
+ }) | (Omit<{
2156
+ event_type: "call.play";
2157
+ event_channel: EventChannel;
1992
2158
  timestamp: number;
2159
+ project_id?: string;
2160
+ node_id?: string;
2161
+ is_author?: boolean;
1993
2162
  params: CallPlayPayload;
1994
- } | {
1995
- event_type: "call.connect";
2163
+ }, "event_channel"> & {
1996
2164
  event_channel: string;
2165
+ }) | (Omit<{
2166
+ event_type: "call.connect";
2167
+ event_channel: EventChannel;
1997
2168
  timestamp: number;
2169
+ project_id?: string;
2170
+ node_id?: string;
2171
+ is_author?: boolean;
1998
2172
  params: CallConnectPayload;
1999
- } | {
2173
+ }, "event_channel"> & {
2174
+ event_channel: string;
2175
+ }) | Omit<{
2000
2176
  event_type: "member.updated";
2001
2177
  event_channel: EventChannel;
2002
2178
  timestamp: number;
2179
+ project_id?: string;
2180
+ node_id?: string;
2181
+ is_author?: boolean;
2003
2182
  params: MemberUpdatedPayload;
2004
- } | {
2183
+ }, never> | Omit<{
2005
2184
  event_type: "member.joined";
2006
2185
  event_channel: EventChannel;
2007
2186
  timestamp: number;
2187
+ project_id?: string;
2188
+ node_id?: string;
2189
+ is_author?: boolean;
2008
2190
  params: MemberJoinedPayload;
2009
- } | {
2191
+ }, never> | Omit<{
2010
2192
  event_type: "member.left";
2011
2193
  event_channel: EventChannel;
2012
2194
  timestamp: number;
2195
+ project_id?: string;
2196
+ node_id?: string;
2197
+ is_author?: boolean;
2013
2198
  params: MemberLeftPayload;
2014
- } | {
2199
+ }, never> | Omit<{
2015
2200
  event_type: "member.talking";
2016
2201
  event_channel: EventChannel;
2017
2202
  timestamp: number;
2203
+ project_id?: string;
2204
+ node_id?: string;
2205
+ is_author?: boolean;
2018
2206
  params: MemberTalkingPayload;
2019
- } | {
2207
+ }, never> | Omit<{
2020
2208
  event_type: "layout.changed";
2021
2209
  event_channel: EventChannel;
2022
2210
  timestamp: number;
2211
+ project_id?: string;
2212
+ node_id?: string;
2213
+ is_author?: boolean;
2023
2214
  params: LayoutChangedPayload;
2024
- } | {
2215
+ }, never> | (Omit<{
2025
2216
  event_type: "conversation.message";
2217
+ event_channel: EventChannel;
2218
+ timestamp: number;
2219
+ project_id?: string;
2220
+ node_id?: string;
2221
+ is_author?: boolean;
2222
+ params: ConversationMessagePayload;
2223
+ }, "event_channel" | "timestamp" | "is_author"> & {
2026
2224
  event_channel: string;
2027
2225
  timestamp: string;
2028
2226
  is_author: boolean;
2029
- params: ConversationMessagePayload;
2030
- } | {
2227
+ }) | (Omit<{
2031
2228
  event_type: "conversation.message.updated";
2229
+ event_channel: EventChannel;
2230
+ timestamp: number;
2231
+ project_id?: string;
2232
+ node_id?: string;
2233
+ is_author?: boolean;
2234
+ params: ConversationMessagePayload;
2235
+ }, "event_channel" | "timestamp" | "is_author"> & {
2032
2236
  event_channel: string;
2033
2237
  timestamp: string;
2034
2238
  is_author: boolean;
2035
- params: ConversationMessageUpdatedPayload;
2036
- }>;
2239
+ })>;
2037
2240
  get iceServers(): RTCIceServer[] | undefined;
2038
2241
  execute<T extends JSONRPCResponse = JSONRPCResponse>(request: JSONRPCRequest, options?: PendingRPCOptions): Promise<T>;
2039
2242
  get incomingCalls$(): Observable<Call[]>;
@@ -2278,40 +2481,6 @@ declare class StaticCredentialProvider implements CredentialProvider {
2278
2481
  authenticate(): Promise<SDKCredential>;
2279
2482
  }
2280
2483
  //#endregion
2281
- //#region src/core/errors.d.ts
2282
- declare class UnexpectedError extends Error {
2283
- at?: string | undefined;
2284
- constructor(at?: string | undefined, options?: ErrorOptions);
2285
- }
2286
- declare class InvalidCredentialsError extends Error {
2287
- reason: string;
2288
- constructor(reason?: string, options?: ErrorOptions);
2289
- }
2290
- declare class CallCreateError extends Error {
2291
- message: string;
2292
- error: unknown;
2293
- constructor(message: string, error?: unknown, options?: ErrorOptions);
2294
- }
2295
- declare class VertoPongError extends Error {
2296
- originalError: unknown;
2297
- constructor(originalError: unknown);
2298
- }
2299
- declare class MessageParseError extends Error {
2300
- originalError: unknown;
2301
- constructor(originalError: unknown);
2302
- }
2303
- declare class CollectionFetchError extends Error {
2304
- operation: string;
2305
- originalError: unknown;
2306
- constructor(operation: string, originalError: unknown);
2307
- }
2308
- declare class MediaTrackError extends Error {
2309
- operation: string;
2310
- kind: string;
2311
- originalError: unknown;
2312
- constructor(operation: string, kind: string, originalError: unknown);
2313
- }
2314
- //#endregion
2315
2484
  //#region src/controllers/RTCPeerConnectionController.d.ts
2316
2485
  interface RTCPeerConnectionControllerOptions extends MediaOptions {
2317
2486
  callId?: string;
@@ -2365,6 +2534,7 @@ declare class RTCPeerConnectionController extends Destroyable {
2365
2534
  private _initialized$;
2366
2535
  private _remoteDescription$;
2367
2536
  private _remoteStream$;
2537
+ private _remoteOfferMediaDirections;
2368
2538
  constructor(options?: RTCPeerConnectionControllerOptionsPartial, remoteSessionDescription?: string, deviceController?: DeviceController);
2369
2539
  private get iceGatheringController();
2370
2540
  private get shouldEmitLocalDescription();
@@ -2432,6 +2602,12 @@ declare class RTCPeerConnectionController extends Destroyable {
2432
2602
  status,
2433
2603
  sdp
2434
2604
  }: UpdateSDPStatusParams): Promise<void>;
2605
+ /**
2606
+ * Accept an inbound call by creating the SDP answer.
2607
+ * Optionally override media options before the answer is generated.
2608
+ * Must be called after initialization for inbound (answer-type) connections.
2609
+ */
2610
+ acceptInbound(mediaOverrides?: MediaOptions): Promise<void>;
2435
2611
  private handleOfferReceived;
2436
2612
  private readyToConnect;
2437
2613
  private setRemoteDescriptionBefore;
@@ -2522,15 +2698,13 @@ declare class CallEventsManager extends Destroyable {
2522
2698
  private originCallId?;
2523
2699
  private callIds;
2524
2700
  private roomSessionIds;
2525
- private _status$;
2526
2701
  private _participants$;
2527
2702
  private _self$;
2528
2703
  private _sessionState$;
2529
2704
  constructor(webRtcCallSession: CallManager, options?: WebRTCCallEventManagerOptions);
2530
2705
  get participants$(): Observable<CallParticipant[]>;
2706
+ get participants(): CallParticipant[];
2531
2707
  get self$(): Observable<CallSelfParticipant>;
2532
- get status$(): Observable<CallStatus>;
2533
- get status(): CallStatus;
2534
2708
  isRoomSessionIdValid(roomSessionId: string): boolean;
2535
2709
  addCallId(callId: string): void;
2536
2710
  isCallIdValid(callId: string): boolean;
@@ -2611,20 +2785,24 @@ declare class WebRTCCall extends Destroyable implements CallManager {
2611
2785
  readonly id: string;
2612
2786
  /** Destination URI this call was placed to. */
2613
2787
  to?: string;
2614
- protected readonly participantsMap: Map<string, Participant>;
2615
2788
  private vertoManager;
2616
2789
  private callEventsManager;
2617
2790
  private participantFactory;
2618
2791
  private _errors$;
2619
2792
  private _status$;
2793
+ private _lastMergedStatus;
2620
2794
  private _answered$;
2795
+ private _answerMediaOptions?;
2621
2796
  private _holdState;
2622
2797
  private _userVariables$;
2623
2798
  constructor(clientSession: ClientSession, options: CallOptions, initialization: CallInitialization, address?: Address | undefined);
2624
2799
  /** Observable stream of errors from media, signaling, and peer connection layers. */
2625
- get errors$(): Observable<Error>;
2626
- /** @internal Push an error to the call's error stream. */
2627
- emitError(error: Error): void;
2800
+ get errors$(): Observable<CallError>;
2801
+ /**
2802
+ * @internal Push an error to the call's error stream.
2803
+ * Fatal errors automatically transition the call to `'failed'` and destroy it.
2804
+ */
2805
+ emitError(callError: CallError): void;
2628
2806
  /** Whether this call is `'inbound'` or `'outbound'`. */
2629
2807
  get direction(): CallDirection;
2630
2808
  /** Observable of the address associated with this call. */
@@ -2658,7 +2836,7 @@ declare class WebRTCCall extends Destroyable implements CallManager {
2658
2836
  /** Current snapshot of layout layers. */
2659
2837
  get layoutLayers(): LayoutLayer[];
2660
2838
  /** Executes a Verto RPC method targeting a specific participant. */
2661
- executeMethod<T extends JSONRPCResponse = JSONRPCResponse>(target: string, method: string, args: Record<string, unknown>): Promise<T>;
2839
+ executeMethod<T extends JSONRPCResponse = JSONRPCResponse>(target: string | MemberTarget, method: string, args: Record<string, unknown>): Promise<T>;
2662
2840
  private buildMethodParams;
2663
2841
  /** Observable of the current call status (e.g. `'ringing'`, `'connected'`). */
2664
2842
  get status$(): Observable<CallStatus>;
@@ -2759,8 +2937,10 @@ declare class WebRTCCall extends Destroyable implements CallManager {
2759
2937
  hangup(): Promise<void>;
2760
2938
  /** Sends DTMF digits (e.g. `'1234#'`) on the call. */
2761
2939
  sendDigits(dtmf: string): Promise<void>;
2762
- /** Accepts an inbound call. */
2763
- answer(): void;
2940
+ /** Accepts an inbound call, optionally overriding media options for the answer. */
2941
+ answer(options?: MediaOptions): void;
2942
+ /** Media options provided when answering. Used internally by the VertoManager. */
2943
+ get answerMediaOptions(): MediaOptions | undefined;
2764
2944
  /** Rejects an inbound call. */
2765
2945
  reject(): void;
2766
2946
  /** Observable that emits `true` when answered, `false` when rejected. */
@@ -2789,5 +2969,5 @@ declare const version: string;
2789
2969
  */
2790
2970
  declare const ready: boolean;
2791
2971
  //#endregion
2792
- export { Address, type AddressHistory, type Call, type CallAddress, type CallCapabilitiesState, CallCreateError, type CallOptions, type CallParticipant, type CallSelfParticipant, type CallState, type CallStatus, ClientPreferences, CollectionFetchError, type CredentialProvider, type DialOptions, type Directory, type ExecuteMethod, InvalidCredentialsError, type LayoutLayer, type MediaDirection, type MediaDirections, type MediaOptions, MediaTrackError, type MemberCapabilities, MessageParseError, type NodeSocketAdapter, type OnOffCapability, Participant, type SDKCredential, SelfCapabilities, SelfParticipant, type SessionState, SignalWire, type SignalWireOptions, StaticCredentialProvider, type Storage, Subscriber, type TextMessage, UnexpectedError, VertoPongError, type WebRTCApiProvider, WebRTCCall, type WebRTCMediaDevices, type WebSocketAdapter, embeddableCall, isSelfParticipant, ready, version };
2972
+ export { Address, type AddressHistory, type Call, type CallAddress, type CallCapabilitiesState, CallCreateError, type CallError, type CallErrorKind, type CallOptions, type CallParticipant, type CallSelfParticipant, type CallState, type CallStatus, ClientPreferences, CollectionFetchError, type CredentialProvider, type DeviceController, type DialOptions, type Directory, type ExecuteMethod, InvalidCredentialsError, type JSONRPCErrorResponse, type JSONRPCRequest, type JSONRPCResponse, type JSONRPCSuccessResponse, type LayoutLayer, type MediaDirection, type MediaDirections, type MediaOptions, MediaTrackError, type MemberCapabilities, MessageParseError, type NodeSocketAdapter, type OnOffCapability, Participant, type PendingRPCOptions, type SDKCredential, SelfCapabilities, SelfParticipant, type SessionState, SignalWire, type SignalWireOptions, StaticCredentialProvider, type Storage, Subscriber, type TextMessage, type TransferOptions, UnexpectedError, VertoPongError, type VideoPosition, type WebRTCApiProvider, WebRTCCall, type WebRTCMediaDevices, type WebSocketAdapter, embeddableCall, isSelfParticipant, ready, version };
2793
2973
  //# sourceMappingURL=index.d.mts.map