react-jssip-kit 0.5.9 → 0.6.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 +6 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +83 -86
- package/dist/index.d.ts +83 -86
- package/dist/index.js +6 -27
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as jssip_src_RTCSession from 'jssip/src/RTCSession';
|
|
2
|
-
import { RTCSessionEventMap, AnswerOptions, TerminateOptions, DTMFOptions,
|
|
2
|
+
import { RTCSessionEventMap, Originator, AnswerOptions, TerminateOptions, DTMFOptions, ReferOptions, RTCSession } from 'jssip/src/RTCSession';
|
|
3
3
|
export { AnswerOptions, DTMFOptions, RTCSession, RTCSessionEventMap, ReferOptions, TerminateOptions } from 'jssip/src/RTCSession';
|
|
4
4
|
import * as jssip_src_UA from 'jssip/src/UA';
|
|
5
5
|
import { UAEventMap, IncomingRTCSessionEvent, UAConfiguration, CallOptions, RTCSessionEvent } from 'jssip/src/UA';
|
|
@@ -73,91 +73,91 @@ declare class SipUserAgent {
|
|
|
73
73
|
private clearSessionFlag;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
declare const SipStatus: {
|
|
77
|
-
readonly Disconnected: "disconnected";
|
|
78
|
-
readonly Connecting: "connecting";
|
|
79
|
-
readonly Connected: "connected";
|
|
80
|
-
readonly Registered: "registered";
|
|
81
|
-
readonly Unregistered: "unregistered";
|
|
82
|
-
readonly RegistrationFailed: "registrationFailed";
|
|
83
|
-
};
|
|
84
|
-
type SipStatus = typeof SipStatus[keyof typeof SipStatus];
|
|
85
|
-
declare const CallStatus: {
|
|
86
|
-
readonly Idle: "idle";
|
|
87
|
-
readonly Dialing: "dialing";
|
|
88
|
-
readonly Ringing: "ringing";
|
|
89
|
-
readonly Active: "active";
|
|
90
|
-
readonly Hold: "hold";
|
|
91
|
-
};
|
|
92
|
-
type CallStatus = typeof CallStatus[keyof typeof CallStatus];
|
|
93
|
-
declare const CallDirection: {
|
|
94
|
-
readonly Incoming: "incoming";
|
|
95
|
-
readonly Outgoing: "outgoing";
|
|
96
|
-
readonly None: "none";
|
|
97
|
-
};
|
|
98
|
-
type CallDirection =
|
|
99
|
-
type SipSessionState = {
|
|
100
|
-
id: string;
|
|
101
|
-
status: CallStatus;
|
|
102
|
-
direction: CallDirection;
|
|
103
|
-
from: string | null;
|
|
104
|
-
to: string | null;
|
|
105
|
-
muted: boolean;
|
|
106
|
-
acceptedAt: number | null;
|
|
107
|
-
mediaKind: "audio" | "video";
|
|
108
|
-
remoteVideoEnabled: boolean;
|
|
109
|
-
};
|
|
110
|
-
interface SipState {
|
|
111
|
-
sipStatus: SipStatus;
|
|
112
|
-
error: string | null;
|
|
113
|
-
sessions: SipSessionState[];
|
|
76
|
+
declare const SipStatus: {
|
|
77
|
+
readonly Disconnected: "disconnected";
|
|
78
|
+
readonly Connecting: "connecting";
|
|
79
|
+
readonly Connected: "connected";
|
|
80
|
+
readonly Registered: "registered";
|
|
81
|
+
readonly Unregistered: "unregistered";
|
|
82
|
+
readonly RegistrationFailed: "registrationFailed";
|
|
83
|
+
};
|
|
84
|
+
type SipStatus = (typeof SipStatus)[keyof typeof SipStatus];
|
|
85
|
+
declare const CallStatus: {
|
|
86
|
+
readonly Idle: "idle";
|
|
87
|
+
readonly Dialing: "dialing";
|
|
88
|
+
readonly Ringing: "ringing";
|
|
89
|
+
readonly Active: "active";
|
|
90
|
+
readonly Hold: "hold";
|
|
91
|
+
};
|
|
92
|
+
type CallStatus = (typeof CallStatus)[keyof typeof CallStatus];
|
|
93
|
+
declare const CallDirection: {
|
|
94
|
+
readonly Incoming: "incoming";
|
|
95
|
+
readonly Outgoing: "outgoing";
|
|
96
|
+
readonly None: "none";
|
|
97
|
+
};
|
|
98
|
+
type CallDirection = Originator.LOCAL | Originator.REMOTE;
|
|
99
|
+
type SipSessionState = {
|
|
100
|
+
id: string;
|
|
101
|
+
status: CallStatus;
|
|
102
|
+
direction: CallDirection;
|
|
103
|
+
from: string | null;
|
|
104
|
+
to: string | null;
|
|
105
|
+
muted: boolean;
|
|
106
|
+
acceptedAt: number | null;
|
|
107
|
+
mediaKind: "audio" | "video";
|
|
108
|
+
remoteVideoEnabled: boolean;
|
|
109
|
+
};
|
|
110
|
+
interface SipState {
|
|
111
|
+
sipStatus: SipStatus;
|
|
112
|
+
error: string | null;
|
|
113
|
+
sessions: SipSessionState[];
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
type Listener<T = any> = (payload: T) => void;
|
|
117
|
-
declare class EventTargetEmitter<Events extends Record<string, any> = any> {
|
|
118
|
-
private target;
|
|
119
|
-
on<K extends keyof Events>(event: K, fn: Listener<Events[K]>): () => void;
|
|
120
|
-
emit<K extends keyof Events>(event: K, payload?: Events[K]): void;
|
|
116
|
+
type Listener<T = any> = (payload: T) => void;
|
|
117
|
+
declare class EventTargetEmitter<Events extends Record<string, any> = any> {
|
|
118
|
+
private target;
|
|
119
|
+
on<K extends keyof Events>(event: K, fn: Listener<Events[K]>): () => void;
|
|
120
|
+
emit<K extends keyof Events>(event: K, payload?: Events[K]): void;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
interface SipErrorPayload {
|
|
124
|
-
cause: string;
|
|
125
|
-
code?: string;
|
|
126
|
-
raw?: any;
|
|
127
|
-
message?: string;
|
|
128
|
-
}
|
|
129
|
-
interface SipErrorFormatInput {
|
|
130
|
-
raw: any;
|
|
131
|
-
code?: string;
|
|
132
|
-
fallback?: string;
|
|
133
|
-
}
|
|
134
|
-
type SipErrorFormatter = (input: SipErrorFormatInput) => SipErrorPayload | undefined;
|
|
135
|
-
type SipErrorHandlerOptions = {
|
|
136
|
-
formatter?: SipErrorFormatter;
|
|
137
|
-
messages?: Record<string, string>;
|
|
138
|
-
};
|
|
139
|
-
declare class SipErrorHandler {
|
|
140
|
-
private readonly formatter?;
|
|
141
|
-
private readonly messages?;
|
|
142
|
-
constructor(options?: SipErrorHandlerOptions);
|
|
143
|
-
format(input: SipErrorFormatInput): SipErrorPayload;
|
|
144
|
-
private readRawMessage;
|
|
123
|
+
interface SipErrorPayload {
|
|
124
|
+
cause: string;
|
|
125
|
+
code?: string;
|
|
126
|
+
raw?: any;
|
|
127
|
+
message?: string;
|
|
128
|
+
}
|
|
129
|
+
interface SipErrorFormatInput {
|
|
130
|
+
raw: any;
|
|
131
|
+
code?: string;
|
|
132
|
+
fallback?: string;
|
|
133
|
+
}
|
|
134
|
+
type SipErrorFormatter = (input: SipErrorFormatInput) => SipErrorPayload | undefined;
|
|
135
|
+
type SipErrorHandlerOptions = {
|
|
136
|
+
formatter?: SipErrorFormatter;
|
|
137
|
+
messages?: Record<string, string>;
|
|
138
|
+
};
|
|
139
|
+
declare class SipErrorHandler {
|
|
140
|
+
private readonly formatter?;
|
|
141
|
+
private readonly messages?;
|
|
142
|
+
constructor(options?: SipErrorHandlerOptions);
|
|
143
|
+
format(input: SipErrorFormatInput): SipErrorPayload;
|
|
144
|
+
private readRawMessage;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
type SipStateListener = (state: SipState) => void;
|
|
148
|
-
declare class SipStateStore {
|
|
149
|
-
private state;
|
|
150
|
-
private lastState;
|
|
151
|
-
private listeners;
|
|
152
|
-
private pendingState;
|
|
153
|
-
private updateScheduled;
|
|
154
|
-
getState(): SipState;
|
|
155
|
-
onChange(fn: SipStateListener): () => void;
|
|
156
|
-
subscribe(fn: SipStateListener): () => void;
|
|
157
|
-
setState(partial: Partial<SipState>): void;
|
|
158
|
-
batchSet(partial: Partial<SipState>): void;
|
|
159
|
-
reset(overrides?: Partial<SipState>): void;
|
|
160
|
-
private emit;
|
|
147
|
+
type SipStateListener = (state: SipState) => void;
|
|
148
|
+
declare class SipStateStore {
|
|
149
|
+
private state;
|
|
150
|
+
private lastState;
|
|
151
|
+
private listeners;
|
|
152
|
+
private pendingState;
|
|
153
|
+
private updateScheduled;
|
|
154
|
+
getState(): SipState;
|
|
155
|
+
onChange(fn: SipStateListener): () => void;
|
|
156
|
+
subscribe(fn: SipStateListener): () => void;
|
|
157
|
+
setState(partial: Partial<SipState>): void;
|
|
158
|
+
batchSet(partial: Partial<SipState>): void;
|
|
159
|
+
reset(overrides?: Partial<SipState>): void;
|
|
160
|
+
private emit;
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
type SipClientOptions = {
|
|
@@ -191,8 +191,7 @@ declare class SipClient extends EventTargetEmitter<JsSIPEventMap> {
|
|
|
191
191
|
toggleMute(sessionId: string): boolean;
|
|
192
192
|
toggleHold(sessionId: string): boolean;
|
|
193
193
|
sendDTMF(sessionId: string, tones: string | number, options?: DTMFOptions): boolean;
|
|
194
|
-
transfer(sessionId: string, target: string
|
|
195
|
-
attendedTransfer(sessionId: string, otherSession: RTCSession): boolean;
|
|
194
|
+
transfer(sessionId: string, target: string, options?: ReferOptions): boolean;
|
|
196
195
|
onChange(fn: (s: SipState) => void): () => void;
|
|
197
196
|
private attachUAHandlers;
|
|
198
197
|
setDebug(debug?: boolean | string): void;
|
|
@@ -214,8 +213,7 @@ declare class SipClient extends EventTargetEmitter<JsSIPEventMap> {
|
|
|
214
213
|
toggleMuteSession(sessionId?: string): boolean;
|
|
215
214
|
toggleHoldSession(sessionId?: string): boolean;
|
|
216
215
|
sendDTMFSession(sessionId: string, tones: string | number, options?: DTMFOptions): boolean;
|
|
217
|
-
transferSession(sessionId: string, target: string
|
|
218
|
-
attendedTransferSession(sessionId: string, otherSession: RTCSession): boolean;
|
|
216
|
+
transferSession(sessionId: string, target: string, options?: ReferOptions): boolean;
|
|
219
217
|
setSessionMedia(sessionId: string, stream: MediaStream): void;
|
|
220
218
|
switchCameraSession(sessionId: string, track: MediaStreamTrack): false | Promise<boolean>;
|
|
221
219
|
enableVideoSession(sessionId: string): boolean;
|
|
@@ -251,8 +249,7 @@ declare function useSipActions(): {
|
|
|
251
249
|
toggleMute: (sessionId?: string | undefined) => boolean;
|
|
252
250
|
toggleHold: (sessionId?: string | undefined) => boolean;
|
|
253
251
|
sendDTMF: (sessionId: string, tones: string | number, options?: jssip_src_RTCSession.DTMFOptions | undefined) => boolean;
|
|
254
|
-
transfer: (sessionId: string, target: string
|
|
255
|
-
attendedTransfer: (sessionId: string, otherSession: jssip_src_RTCSession.RTCSession) => boolean;
|
|
252
|
+
transfer: (sessionId: string, target: string, options?: jssip_src_RTCSession.ReferOptions | undefined) => boolean;
|
|
256
253
|
getSession: (sessionId: string) => jssip_src_RTCSession.RTCSession | null;
|
|
257
254
|
getSessionIds: () => string[];
|
|
258
255
|
getSessions: () => {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as jssip_src_RTCSession from 'jssip/src/RTCSession';
|
|
2
|
-
import { RTCSessionEventMap, AnswerOptions, TerminateOptions, DTMFOptions,
|
|
2
|
+
import { RTCSessionEventMap, Originator, AnswerOptions, TerminateOptions, DTMFOptions, ReferOptions, RTCSession } from 'jssip/src/RTCSession';
|
|
3
3
|
export { AnswerOptions, DTMFOptions, RTCSession, RTCSessionEventMap, ReferOptions, TerminateOptions } from 'jssip/src/RTCSession';
|
|
4
4
|
import * as jssip_src_UA from 'jssip/src/UA';
|
|
5
5
|
import { UAEventMap, IncomingRTCSessionEvent, UAConfiguration, CallOptions, RTCSessionEvent } from 'jssip/src/UA';
|
|
@@ -73,91 +73,91 @@ declare class SipUserAgent {
|
|
|
73
73
|
private clearSessionFlag;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
declare const SipStatus: {
|
|
77
|
-
readonly Disconnected: "disconnected";
|
|
78
|
-
readonly Connecting: "connecting";
|
|
79
|
-
readonly Connected: "connected";
|
|
80
|
-
readonly Registered: "registered";
|
|
81
|
-
readonly Unregistered: "unregistered";
|
|
82
|
-
readonly RegistrationFailed: "registrationFailed";
|
|
83
|
-
};
|
|
84
|
-
type SipStatus = typeof SipStatus[keyof typeof SipStatus];
|
|
85
|
-
declare const CallStatus: {
|
|
86
|
-
readonly Idle: "idle";
|
|
87
|
-
readonly Dialing: "dialing";
|
|
88
|
-
readonly Ringing: "ringing";
|
|
89
|
-
readonly Active: "active";
|
|
90
|
-
readonly Hold: "hold";
|
|
91
|
-
};
|
|
92
|
-
type CallStatus = typeof CallStatus[keyof typeof CallStatus];
|
|
93
|
-
declare const CallDirection: {
|
|
94
|
-
readonly Incoming: "incoming";
|
|
95
|
-
readonly Outgoing: "outgoing";
|
|
96
|
-
readonly None: "none";
|
|
97
|
-
};
|
|
98
|
-
type CallDirection =
|
|
99
|
-
type SipSessionState = {
|
|
100
|
-
id: string;
|
|
101
|
-
status: CallStatus;
|
|
102
|
-
direction: CallDirection;
|
|
103
|
-
from: string | null;
|
|
104
|
-
to: string | null;
|
|
105
|
-
muted: boolean;
|
|
106
|
-
acceptedAt: number | null;
|
|
107
|
-
mediaKind: "audio" | "video";
|
|
108
|
-
remoteVideoEnabled: boolean;
|
|
109
|
-
};
|
|
110
|
-
interface SipState {
|
|
111
|
-
sipStatus: SipStatus;
|
|
112
|
-
error: string | null;
|
|
113
|
-
sessions: SipSessionState[];
|
|
76
|
+
declare const SipStatus: {
|
|
77
|
+
readonly Disconnected: "disconnected";
|
|
78
|
+
readonly Connecting: "connecting";
|
|
79
|
+
readonly Connected: "connected";
|
|
80
|
+
readonly Registered: "registered";
|
|
81
|
+
readonly Unregistered: "unregistered";
|
|
82
|
+
readonly RegistrationFailed: "registrationFailed";
|
|
83
|
+
};
|
|
84
|
+
type SipStatus = (typeof SipStatus)[keyof typeof SipStatus];
|
|
85
|
+
declare const CallStatus: {
|
|
86
|
+
readonly Idle: "idle";
|
|
87
|
+
readonly Dialing: "dialing";
|
|
88
|
+
readonly Ringing: "ringing";
|
|
89
|
+
readonly Active: "active";
|
|
90
|
+
readonly Hold: "hold";
|
|
91
|
+
};
|
|
92
|
+
type CallStatus = (typeof CallStatus)[keyof typeof CallStatus];
|
|
93
|
+
declare const CallDirection: {
|
|
94
|
+
readonly Incoming: "incoming";
|
|
95
|
+
readonly Outgoing: "outgoing";
|
|
96
|
+
readonly None: "none";
|
|
97
|
+
};
|
|
98
|
+
type CallDirection = Originator.LOCAL | Originator.REMOTE;
|
|
99
|
+
type SipSessionState = {
|
|
100
|
+
id: string;
|
|
101
|
+
status: CallStatus;
|
|
102
|
+
direction: CallDirection;
|
|
103
|
+
from: string | null;
|
|
104
|
+
to: string | null;
|
|
105
|
+
muted: boolean;
|
|
106
|
+
acceptedAt: number | null;
|
|
107
|
+
mediaKind: "audio" | "video";
|
|
108
|
+
remoteVideoEnabled: boolean;
|
|
109
|
+
};
|
|
110
|
+
interface SipState {
|
|
111
|
+
sipStatus: SipStatus;
|
|
112
|
+
error: string | null;
|
|
113
|
+
sessions: SipSessionState[];
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
type Listener<T = any> = (payload: T) => void;
|
|
117
|
-
declare class EventTargetEmitter<Events extends Record<string, any> = any> {
|
|
118
|
-
private target;
|
|
119
|
-
on<K extends keyof Events>(event: K, fn: Listener<Events[K]>): () => void;
|
|
120
|
-
emit<K extends keyof Events>(event: K, payload?: Events[K]): void;
|
|
116
|
+
type Listener<T = any> = (payload: T) => void;
|
|
117
|
+
declare class EventTargetEmitter<Events extends Record<string, any> = any> {
|
|
118
|
+
private target;
|
|
119
|
+
on<K extends keyof Events>(event: K, fn: Listener<Events[K]>): () => void;
|
|
120
|
+
emit<K extends keyof Events>(event: K, payload?: Events[K]): void;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
interface SipErrorPayload {
|
|
124
|
-
cause: string;
|
|
125
|
-
code?: string;
|
|
126
|
-
raw?: any;
|
|
127
|
-
message?: string;
|
|
128
|
-
}
|
|
129
|
-
interface SipErrorFormatInput {
|
|
130
|
-
raw: any;
|
|
131
|
-
code?: string;
|
|
132
|
-
fallback?: string;
|
|
133
|
-
}
|
|
134
|
-
type SipErrorFormatter = (input: SipErrorFormatInput) => SipErrorPayload | undefined;
|
|
135
|
-
type SipErrorHandlerOptions = {
|
|
136
|
-
formatter?: SipErrorFormatter;
|
|
137
|
-
messages?: Record<string, string>;
|
|
138
|
-
};
|
|
139
|
-
declare class SipErrorHandler {
|
|
140
|
-
private readonly formatter?;
|
|
141
|
-
private readonly messages?;
|
|
142
|
-
constructor(options?: SipErrorHandlerOptions);
|
|
143
|
-
format(input: SipErrorFormatInput): SipErrorPayload;
|
|
144
|
-
private readRawMessage;
|
|
123
|
+
interface SipErrorPayload {
|
|
124
|
+
cause: string;
|
|
125
|
+
code?: string;
|
|
126
|
+
raw?: any;
|
|
127
|
+
message?: string;
|
|
128
|
+
}
|
|
129
|
+
interface SipErrorFormatInput {
|
|
130
|
+
raw: any;
|
|
131
|
+
code?: string;
|
|
132
|
+
fallback?: string;
|
|
133
|
+
}
|
|
134
|
+
type SipErrorFormatter = (input: SipErrorFormatInput) => SipErrorPayload | undefined;
|
|
135
|
+
type SipErrorHandlerOptions = {
|
|
136
|
+
formatter?: SipErrorFormatter;
|
|
137
|
+
messages?: Record<string, string>;
|
|
138
|
+
};
|
|
139
|
+
declare class SipErrorHandler {
|
|
140
|
+
private readonly formatter?;
|
|
141
|
+
private readonly messages?;
|
|
142
|
+
constructor(options?: SipErrorHandlerOptions);
|
|
143
|
+
format(input: SipErrorFormatInput): SipErrorPayload;
|
|
144
|
+
private readRawMessage;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
type SipStateListener = (state: SipState) => void;
|
|
148
|
-
declare class SipStateStore {
|
|
149
|
-
private state;
|
|
150
|
-
private lastState;
|
|
151
|
-
private listeners;
|
|
152
|
-
private pendingState;
|
|
153
|
-
private updateScheduled;
|
|
154
|
-
getState(): SipState;
|
|
155
|
-
onChange(fn: SipStateListener): () => void;
|
|
156
|
-
subscribe(fn: SipStateListener): () => void;
|
|
157
|
-
setState(partial: Partial<SipState>): void;
|
|
158
|
-
batchSet(partial: Partial<SipState>): void;
|
|
159
|
-
reset(overrides?: Partial<SipState>): void;
|
|
160
|
-
private emit;
|
|
147
|
+
type SipStateListener = (state: SipState) => void;
|
|
148
|
+
declare class SipStateStore {
|
|
149
|
+
private state;
|
|
150
|
+
private lastState;
|
|
151
|
+
private listeners;
|
|
152
|
+
private pendingState;
|
|
153
|
+
private updateScheduled;
|
|
154
|
+
getState(): SipState;
|
|
155
|
+
onChange(fn: SipStateListener): () => void;
|
|
156
|
+
subscribe(fn: SipStateListener): () => void;
|
|
157
|
+
setState(partial: Partial<SipState>): void;
|
|
158
|
+
batchSet(partial: Partial<SipState>): void;
|
|
159
|
+
reset(overrides?: Partial<SipState>): void;
|
|
160
|
+
private emit;
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
type SipClientOptions = {
|
|
@@ -191,8 +191,7 @@ declare class SipClient extends EventTargetEmitter<JsSIPEventMap> {
|
|
|
191
191
|
toggleMute(sessionId: string): boolean;
|
|
192
192
|
toggleHold(sessionId: string): boolean;
|
|
193
193
|
sendDTMF(sessionId: string, tones: string | number, options?: DTMFOptions): boolean;
|
|
194
|
-
transfer(sessionId: string, target: string
|
|
195
|
-
attendedTransfer(sessionId: string, otherSession: RTCSession): boolean;
|
|
194
|
+
transfer(sessionId: string, target: string, options?: ReferOptions): boolean;
|
|
196
195
|
onChange(fn: (s: SipState) => void): () => void;
|
|
197
196
|
private attachUAHandlers;
|
|
198
197
|
setDebug(debug?: boolean | string): void;
|
|
@@ -214,8 +213,7 @@ declare class SipClient extends EventTargetEmitter<JsSIPEventMap> {
|
|
|
214
213
|
toggleMuteSession(sessionId?: string): boolean;
|
|
215
214
|
toggleHoldSession(sessionId?: string): boolean;
|
|
216
215
|
sendDTMFSession(sessionId: string, tones: string | number, options?: DTMFOptions): boolean;
|
|
217
|
-
transferSession(sessionId: string, target: string
|
|
218
|
-
attendedTransferSession(sessionId: string, otherSession: RTCSession): boolean;
|
|
216
|
+
transferSession(sessionId: string, target: string, options?: ReferOptions): boolean;
|
|
219
217
|
setSessionMedia(sessionId: string, stream: MediaStream): void;
|
|
220
218
|
switchCameraSession(sessionId: string, track: MediaStreamTrack): false | Promise<boolean>;
|
|
221
219
|
enableVideoSession(sessionId: string): boolean;
|
|
@@ -251,8 +249,7 @@ declare function useSipActions(): {
|
|
|
251
249
|
toggleMute: (sessionId?: string | undefined) => boolean;
|
|
252
250
|
toggleHold: (sessionId?: string | undefined) => boolean;
|
|
253
251
|
sendDTMF: (sessionId: string, tones: string | number, options?: jssip_src_RTCSession.DTMFOptions | undefined) => boolean;
|
|
254
|
-
transfer: (sessionId: string, target: string
|
|
255
|
-
attendedTransfer: (sessionId: string, otherSession: jssip_src_RTCSession.RTCSession) => boolean;
|
|
252
|
+
transfer: (sessionId: string, target: string, options?: jssip_src_RTCSession.ReferOptions | undefined) => boolean;
|
|
256
253
|
getSession: (sessionId: string) => jssip_src_RTCSession.RTCSession | null;
|
|
257
254
|
getSessionIds: () => string[];
|
|
258
255
|
getSessions: () => {
|
package/dist/index.js
CHANGED
|
@@ -481,11 +481,6 @@ function createSessionHandlers(deps) {
|
|
|
481
481
|
return {
|
|
482
482
|
progress: (e) => {
|
|
483
483
|
emitter.emit("progress", e);
|
|
484
|
-
state.batchSet({
|
|
485
|
-
sessions: state.getState().sessions.map(
|
|
486
|
-
(s) => s.id === sessionId ? { ...s, status: CallStatus.Ringing } : s
|
|
487
|
-
)
|
|
488
|
-
});
|
|
489
484
|
},
|
|
490
485
|
accepted: (e) => {
|
|
491
486
|
emitter.emit("accepted", e);
|
|
@@ -656,9 +651,6 @@ var WebRTCSessionController = class {
|
|
|
656
651
|
transfer(target, options) {
|
|
657
652
|
return this.currentSession ? (this.currentSession.refer(target, options), true) : false;
|
|
658
653
|
}
|
|
659
|
-
attendedTransfer(otherSession) {
|
|
660
|
-
return this.currentSession ? (this.currentSession.refer(otherSession), true) : false;
|
|
661
|
-
}
|
|
662
654
|
enableVideo() {
|
|
663
655
|
this.mediaStream?.getVideoTracks().forEach((t) => t.enabled = true);
|
|
664
656
|
}
|
|
@@ -715,7 +707,11 @@ var SessionManager = class {
|
|
|
715
707
|
getOrCreateRtc(sessionId, session) {
|
|
716
708
|
let entry = this.entries.get(sessionId);
|
|
717
709
|
if (!entry) {
|
|
718
|
-
entry = {
|
|
710
|
+
entry = {
|
|
711
|
+
rtc: new WebRTCSessionController(),
|
|
712
|
+
session: null,
|
|
713
|
+
media: null
|
|
714
|
+
};
|
|
719
715
|
this.entries.set(sessionId, entry);
|
|
720
716
|
}
|
|
721
717
|
if (session) {
|
|
@@ -819,10 +815,6 @@ var SessionManager = class {
|
|
|
819
815
|
const rtc = this.getRtc(sessionId);
|
|
820
816
|
return rtc ? rtc.transfer(target, options) : false;
|
|
821
817
|
}
|
|
822
|
-
attendedTransfer(sessionId, otherSession) {
|
|
823
|
-
const rtc = this.getRtc(sessionId);
|
|
824
|
-
return rtc ? rtc.attendedTransfer(otherSession) : false;
|
|
825
|
-
}
|
|
826
818
|
};
|
|
827
819
|
|
|
828
820
|
// src/jssip-lib/sip/sessionLifecycle.ts
|
|
@@ -868,7 +860,7 @@ var SessionLifecycle = class {
|
|
|
868
860
|
);
|
|
869
861
|
const sdpHasVideo = e.request?.body && e.request.body.toString().includes("m=video") || session?.connection?.getReceivers?.()?.some((r) => r.track?.kind === "video");
|
|
870
862
|
upsertSessionState(this.state, sessionId, {
|
|
871
|
-
direction: e.originator
|
|
863
|
+
direction: e.originator,
|
|
872
864
|
from: e.originator === "remote" ? e.request.from.uri.user : null,
|
|
873
865
|
to: e.request.to.uri.user,
|
|
874
866
|
status: e.originator === "remote" ? CallStatus.Ringing : CallStatus.Dialing,
|
|
@@ -988,9 +980,6 @@ var SipClient = class extends EventTargetEmitter {
|
|
|
988
980
|
transfer(sessionId, target, options) {
|
|
989
981
|
return this.transferSession(sessionId, target, options);
|
|
990
982
|
}
|
|
991
|
-
attendedTransfer(sessionId, otherSession) {
|
|
992
|
-
return this.attendedTransferSession(sessionId, otherSession);
|
|
993
|
-
}
|
|
994
983
|
onChange(fn) {
|
|
995
984
|
return this.stateStore.onChange(fn);
|
|
996
985
|
}
|
|
@@ -1163,15 +1152,6 @@ var SipClient = class extends EventTargetEmitter {
|
|
|
1163
1152
|
this.sessionManager.transfer(resolved, target, options);
|
|
1164
1153
|
return true;
|
|
1165
1154
|
}
|
|
1166
|
-
attendedTransferSession(sessionId, otherSession) {
|
|
1167
|
-
const resolved = this.resolveExistingSessionId(sessionId);
|
|
1168
|
-
if (!resolved)
|
|
1169
|
-
return false;
|
|
1170
|
-
const sessionState = this.stateStore.getState().sessions.find((s) => s.id === resolved);
|
|
1171
|
-
if (sessionState?.status === CallStatus.Active)
|
|
1172
|
-
this.sessionManager.attendedTransfer(resolved, otherSession);
|
|
1173
|
-
return true;
|
|
1174
|
-
}
|
|
1175
1155
|
setSessionMedia(sessionId, stream) {
|
|
1176
1156
|
this.sessionManager.setSessionMedia(sessionId, stream);
|
|
1177
1157
|
}
|
|
@@ -1321,7 +1301,6 @@ function useSipActions() {
|
|
|
1321
1301
|
toggleHold: (...args) => client.toggleHoldSession(...args),
|
|
1322
1302
|
sendDTMF: (...args) => client.sendDTMFSession(...args),
|
|
1323
1303
|
transfer: (...args) => client.transferSession(...args),
|
|
1324
|
-
attendedTransfer: (...args) => client.attendedTransferSession(...args),
|
|
1325
1304
|
getSession: (...args) => client.getSession(...args),
|
|
1326
1305
|
getSessionIds: () => client.getSessionIds(),
|
|
1327
1306
|
getSessions: () => client.getSessions(),
|