@wazo/sdk 1.0.0-alpha.2 → 1.0.0-alpha.20
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/README.md +16 -7
- package/dist/wazo-sdk.js +2 -2
- package/esm/__tests__/__voice__/call.test.js +52 -3
- package/esm/api/auth.js +3 -0
- package/esm/checker/checks/webrtc.js +2 -2
- package/esm/domain/CallLog.js +2 -3
- package/esm/domain/Phone/CTIPhone.js +2 -2
- package/esm/domain/Phone/WebRTCPhone.js +59 -57
- package/esm/index.js +3 -1
- package/esm/service/CallApi.js +4 -4
- package/esm/simple/Auth.js +13 -3
- package/esm/simple/Phone.js +5 -5
- package/esm/simple/index.js +2 -1
- package/esm/simple/room/Room.js +2 -2
- package/esm/simple/room/SipRoom.js +2 -2
- package/esm/state-machine/call-state-machine.js +34 -19
- package/esm/state-machine/softphone-state-machine.js +1 -2
- package/esm/state-machine/utils.js +10 -4
- package/esm/types/api/auth.d.ts +3 -0
- package/esm/types/api/auth.d.ts.map +1 -1
- package/esm/types/checker/checks/index.d.ts +1 -1
- package/esm/types/checker/checks/webrtc-transport.d.ts +2 -2
- package/esm/types/checker/checks/webrtc-transport.d.ts.map +1 -1
- package/esm/types/domain/CallLog.d.ts.map +1 -1
- package/esm/types/domain/CallSession.d.ts +3 -3
- package/esm/types/domain/CallSession.d.ts.map +1 -1
- package/esm/types/domain/Phone/CTIPhone.d.ts.map +1 -1
- package/esm/types/domain/Phone/WebRTCPhone.d.ts +22 -22
- package/esm/types/domain/Phone/WebRTCPhone.d.ts.map +1 -1
- package/esm/types/domain/types.d.ts +0 -4
- package/esm/types/domain/types.d.ts.map +1 -1
- package/esm/types/index.d.ts +3 -1
- package/esm/types/index.d.ts.map +1 -1
- package/esm/types/lib/WazoSessionDescriptionHandler.d.ts +3 -3
- package/esm/types/lib/WazoSessionDescriptionHandler.d.ts.map +1 -1
- package/esm/types/service/CallApi.d.ts +5 -5
- package/esm/types/service/CallApi.d.ts.map +1 -1
- package/esm/types/simple/Auth.d.ts +6 -1
- package/esm/types/simple/Auth.d.ts.map +1 -1
- package/esm/types/simple/Phone.d.ts +8 -8
- package/esm/types/simple/Phone.d.ts.map +1 -1
- package/esm/types/simple/index.d.ts +3 -1
- package/esm/types/simple/index.d.ts.map +1 -1
- package/esm/types/state-machine/call-state-machine.d.ts +12 -1
- package/esm/types/state-machine/call-state-machine.d.ts.map +1 -1
- package/esm/types/state-machine/softphone-state-machine.d.ts +1 -2
- package/esm/types/state-machine/softphone-state-machine.d.ts.map +1 -1
- package/esm/types/state-machine/utils.d.ts +1 -1
- package/esm/types/state-machine/utils.d.ts.map +1 -1
- package/esm/types/utils/sdp.d.ts +1 -2
- package/esm/types/utils/sdp.d.ts.map +1 -1
- package/esm/types/utils/update-from.d.ts +1 -1
- package/esm/types/utils/update-from.d.ts.map +1 -1
- package/esm/types/utils/webrtc.d.ts.map +1 -1
- package/esm/types/voice/call.d.ts +15 -3
- package/esm/types/voice/call.d.ts.map +1 -1
- package/esm/types/voice/softphone.d.ts +7 -0
- package/esm/types/voice/softphone.d.ts.map +1 -1
- package/esm/types/web-rtc-client.d.ts +39 -38
- package/esm/types/web-rtc-client.d.ts.map +1 -1
- package/esm/utils/sdp.js +16 -9
- package/esm/utils/update-from.js +2 -2
- package/esm/utils/webrtc.js +10 -4
- package/esm/voice/call.js +86 -28
- package/esm/voice/softphone.js +58 -17
- package/esm/web-rtc-client.js +67 -58
- package/lib/__tests__/__voice__/call.test.js +51 -2
- package/lib/api/auth.js +3 -0
- package/lib/checker/checks/webrtc.js +1 -1
- package/lib/domain/CallLog.js +2 -3
- package/lib/domain/Phone/CTIPhone.js +2 -2
- package/lib/domain/Phone/WebRTCPhone.js +58 -56
- package/lib/index.js +7 -3
- package/lib/service/CallApi.js +2 -2
- package/lib/simple/Auth.js +15 -3
- package/lib/simple/Phone.js +2 -2
- package/lib/simple/index.js +2 -1
- package/lib/simple/room/Room.js +1 -1
- package/lib/simple/room/SipRoom.js +1 -1
- package/lib/state-machine/call-state-machine.js +35 -20
- package/lib/state-machine/softphone-state-machine.js +1 -2
- package/lib/state-machine/utils.js +10 -4
- package/lib/types/api/auth.d.ts +3 -0
- package/lib/types/api/auth.d.ts.map +1 -1
- package/lib/types/checker/checks/index.d.ts +1 -1
- package/lib/types/checker/checks/webrtc-transport.d.ts +2 -2
- package/lib/types/checker/checks/webrtc-transport.d.ts.map +1 -1
- package/lib/types/domain/CallLog.d.ts.map +1 -1
- package/lib/types/domain/CallSession.d.ts +3 -3
- package/lib/types/domain/CallSession.d.ts.map +1 -1
- package/lib/types/domain/Phone/CTIPhone.d.ts.map +1 -1
- package/lib/types/domain/Phone/WebRTCPhone.d.ts +22 -22
- package/lib/types/domain/Phone/WebRTCPhone.d.ts.map +1 -1
- package/lib/types/domain/types.d.ts +0 -4
- package/lib/types/domain/types.d.ts.map +1 -1
- package/lib/types/index.d.ts +3 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/lib/WazoSessionDescriptionHandler.d.ts +3 -3
- package/lib/types/lib/WazoSessionDescriptionHandler.d.ts.map +1 -1
- package/lib/types/service/CallApi.d.ts +5 -5
- package/lib/types/service/CallApi.d.ts.map +1 -1
- package/lib/types/simple/Auth.d.ts +6 -1
- package/lib/types/simple/Auth.d.ts.map +1 -1
- package/lib/types/simple/Phone.d.ts +8 -8
- package/lib/types/simple/Phone.d.ts.map +1 -1
- package/lib/types/simple/index.d.ts +3 -1
- package/lib/types/simple/index.d.ts.map +1 -1
- package/lib/types/state-machine/call-state-machine.d.ts +12 -1
- package/lib/types/state-machine/call-state-machine.d.ts.map +1 -1
- package/lib/types/state-machine/softphone-state-machine.d.ts +1 -2
- package/lib/types/state-machine/softphone-state-machine.d.ts.map +1 -1
- package/lib/types/state-machine/utils.d.ts +1 -1
- package/lib/types/state-machine/utils.d.ts.map +1 -1
- package/lib/types/utils/sdp.d.ts +1 -2
- package/lib/types/utils/sdp.d.ts.map +1 -1
- package/lib/types/utils/update-from.d.ts +1 -1
- package/lib/types/utils/update-from.d.ts.map +1 -1
- package/lib/types/utils/webrtc.d.ts.map +1 -1
- package/lib/types/voice/call.d.ts +15 -3
- package/lib/types/voice/call.d.ts.map +1 -1
- package/lib/types/voice/softphone.d.ts +7 -0
- package/lib/types/voice/softphone.d.ts.map +1 -1
- package/lib/types/web-rtc-client.d.ts +39 -38
- package/lib/types/web-rtc-client.d.ts.map +1 -1
- package/lib/utils/sdp.js +17 -10
- package/lib/utils/update-from.js +2 -2
- package/lib/utils/webrtc.js +11 -4
- package/lib/voice/call.js +89 -27
- package/lib/voice/softphone.js +62 -17
- package/lib/web-rtc-client.js +66 -57
- package/package.json +1 -1
- package/src/__tests__/__voice__/call.test.ts +61 -3
- package/src/api/auth.ts +5 -0
- package/src/checker/checks/webrtc-transport.ts +2 -2
- package/src/checker/checks/webrtc.ts +2 -2
- package/src/domain/CallLog.ts +2 -3
- package/src/domain/CallSession.ts +3 -3
- package/src/domain/Phone/CTIPhone.ts +3 -2
- package/src/domain/Phone/WebRTCPhone.ts +87 -85
- package/src/domain/__tests__/CallSession.test.ts +4 -0
- package/src/domain/types.ts +0 -5
- package/src/index.ts +4 -1
- package/src/lib/WazoSessionDescriptionHandler.ts +3 -3
- package/src/service/CallApi.ts +7 -7
- package/src/simple/Auth.ts +15 -3
- package/src/simple/Phone.ts +11 -11
- package/src/simple/index.ts +2 -1
- package/src/simple/room/Room.ts +3 -3
- package/src/simple/room/SipRoom.ts +3 -3
- package/src/state-machine/call-state-machine.ts +38 -19
- package/src/state-machine/softphone-state-machine.ts +1 -2
- package/src/state-machine/utils.ts +12 -4
- package/src/utils/sdp.ts +18 -11
- package/src/utils/update-from.ts +2 -2
- package/src/utils/webrtc.ts +11 -4
- package/src/voice/call.ts +109 -36
- package/src/voice/softphone.ts +75 -18
- package/src/web-rtc-client.ts +112 -98
package/src/web-rtc-client.ts
CHANGED
|
@@ -29,8 +29,8 @@ import Emitter from './utils/Emitter';
|
|
|
29
29
|
import ApiClient from './api-client';
|
|
30
30
|
import IssueReporter from './service/IssueReporter';
|
|
31
31
|
import Heartbeat from './utils/Heartbeat';
|
|
32
|
-
import {
|
|
33
|
-
import type { MediaConfig, UserAgentConfigOverrides, WebRtcConfig, IncomingResponse, PeerConnection,
|
|
32
|
+
import { getSipCallId, makeURI, replaceLocalIpModifier } from './utils/sdp';
|
|
33
|
+
import type { MediaConfig, UserAgentConfigOverrides, WebRtcConfig, IncomingResponse, PeerConnection, SipCall, WazoTransport } from './domain/types';
|
|
34
34
|
import { cleanupStream, createUaOptions, fetchNetworkStats, getAudioConstraints, getLocalStream, getLocalTracks, getLocalVideoStream, getMediaConfiguration, getPeerConnection, getRemoteStream, getRemoteTracks, getRemoteVideoStream, getRemoteVideoStreamFromPc, getVideoConstraints, hasALocalVideoTrack, hasARemoteVideoTrack, hasAVideoTrack, hasLocalVideo, hasRemoteVideo, hasVideoTrack, isAudioOnly, isVideoRemotelyHeld, isWeb, sessionWantsToDoVideo, setLocalMediaStream, toggleAudio, toggleVideo, updateRemoteStream } from './utils/webrtc';
|
|
35
35
|
|
|
36
36
|
const SEND_STATS_DELAY = 5000;
|
|
@@ -39,6 +39,7 @@ const logger = IssueReporter ? IssueReporter.loggerFor('webrtc-client') : consol
|
|
|
39
39
|
const statsLogger = IssueReporter ? IssueReporter.loggerFor('webrtc-stats') : console;
|
|
40
40
|
// events
|
|
41
41
|
const REGISTERED = 'registered';
|
|
42
|
+
const REGISTERING = 'registering';
|
|
42
43
|
const UNREGISTERED = 'unregistered';
|
|
43
44
|
const REGISTRATION_FAILED = 'registrationFailed';
|
|
44
45
|
const INVITE = 'invite';
|
|
@@ -57,7 +58,7 @@ const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
|
57
58
|
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
58
59
|
const ON_DISCONNECTED = 'onDisconnected';
|
|
59
60
|
|
|
60
|
-
export const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
61
|
+
export const events = [REGISTERED, REGISTERING, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
61
62
|
export const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
62
63
|
export class CanceledCallError extends Error {}
|
|
63
64
|
|
|
@@ -102,7 +103,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
102
103
|
|
|
103
104
|
statsIntervals: Record<string, any>;
|
|
104
105
|
|
|
105
|
-
sipSessions: Record<string,
|
|
106
|
+
sipSessions: Record<string, SipCall>;
|
|
106
107
|
|
|
107
108
|
conferences: Record<string, boolean>;
|
|
108
109
|
|
|
@@ -119,6 +120,8 @@ export default class WebRTCClient extends Emitter {
|
|
|
119
120
|
|
|
120
121
|
REGISTERED: string;
|
|
121
122
|
|
|
123
|
+
REGISTERING: string;
|
|
124
|
+
|
|
122
125
|
UNREGISTERED: string;
|
|
123
126
|
|
|
124
127
|
REGISTRATION_FAILED: string;
|
|
@@ -153,7 +156,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
153
156
|
|
|
154
157
|
ON_DISCONNECTED: string;
|
|
155
158
|
|
|
156
|
-
constructor(config: WebRtcConfig, session?:
|
|
159
|
+
constructor(config: WebRtcConfig, session?: SipCall, uaConfigOverrides?: UserAgentConfigOverrides) {
|
|
157
160
|
super();
|
|
158
161
|
|
|
159
162
|
// For debug purpose
|
|
@@ -166,7 +169,9 @@ export default class WebRTCClient extends Emitter {
|
|
|
166
169
|
|
|
167
170
|
this._buildConfig(config, session).then((newConfig: WebRtcConfig) => {
|
|
168
171
|
this.config = newConfig;
|
|
169
|
-
this.userAgent
|
|
172
|
+
if (!this.userAgent) {
|
|
173
|
+
this.userAgent = this.createUserAgent(uaConfigOverrides);
|
|
174
|
+
}
|
|
170
175
|
});
|
|
171
176
|
|
|
172
177
|
this.audioOutputDeviceId = config.audioDeviceOutput;
|
|
@@ -194,6 +199,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
194
199
|
this.heartbeat.setOnHeartbeatTimeout(this._onHeartbeatTimeout.bind(this));
|
|
195
200
|
// sugar
|
|
196
201
|
this.REGISTERED = REGISTERED;
|
|
202
|
+
this.REGISTERING = REGISTERING;
|
|
197
203
|
this.UNREGISTERED = UNREGISTERED;
|
|
198
204
|
this.REGISTRATION_FAILED = REGISTRATION_FAILED;
|
|
199
205
|
this.INVITE = INVITE;
|
|
@@ -239,7 +245,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
239
245
|
logger.info('sdk webrtc on invite', {
|
|
240
246
|
method: 'delegate.onInvite',
|
|
241
247
|
clientId: this.clientId,
|
|
242
|
-
id: invitation
|
|
248
|
+
id: getSipCallId(invitation),
|
|
243
249
|
remoteURI: (invitation as any).remoteURI,
|
|
244
250
|
});
|
|
245
251
|
|
|
@@ -316,7 +322,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
316
322
|
this.registerer.waitingToggle(false);
|
|
317
323
|
}
|
|
318
324
|
|
|
319
|
-
this.eventEmitter.emit(UNREGISTERED);
|
|
325
|
+
this.eventEmitter.emit(UNREGISTERED, error);
|
|
320
326
|
}
|
|
321
327
|
}
|
|
322
328
|
|
|
@@ -341,6 +347,8 @@ export default class WebRTCClient extends Emitter {
|
|
|
341
347
|
|
|
342
348
|
logger.info('sdk webrtc registering...', logInfo);
|
|
343
349
|
|
|
350
|
+
this.eventEmitter.emit(REGISTERING);
|
|
351
|
+
|
|
344
352
|
if (!this.userAgent) {
|
|
345
353
|
logger.info('sdk webrtc recreating User Agent');
|
|
346
354
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
@@ -468,6 +476,13 @@ export default class WebRTCClient extends Emitter {
|
|
|
468
476
|
registerer: !!this.registerer,
|
|
469
477
|
});
|
|
470
478
|
|
|
479
|
+
// @ts-ignore: private
|
|
480
|
+
if (this.registerer?.waiting) {
|
|
481
|
+
logger.info('sdk webrtc unregistering, waiting for register to finish...');
|
|
482
|
+
// We have to wait for the register phase to finish
|
|
483
|
+
await this.waitForRegister();
|
|
484
|
+
}
|
|
485
|
+
|
|
471
486
|
try {
|
|
472
487
|
return new Promise((resolve, reject) => {
|
|
473
488
|
if (!this.registerer) {
|
|
@@ -521,7 +536,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
521
536
|
});
|
|
522
537
|
}
|
|
523
538
|
|
|
524
|
-
call(number: string, enableVideo?: boolean, audioOnly = false, conference = false, options = {}):
|
|
539
|
+
call(number: string, enableVideo?: boolean, audioOnly = false, conference = false, options = {}): SipCall | null {
|
|
525
540
|
logger.info('sdk webrtc creating call', {
|
|
526
541
|
clientId: this.clientId,
|
|
527
542
|
number,
|
|
@@ -544,7 +559,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
544
559
|
}
|
|
545
560
|
|
|
546
561
|
const uri = makeURI(number, this.config.host);
|
|
547
|
-
let session:
|
|
562
|
+
let session: SipCall | null = null;
|
|
548
563
|
|
|
549
564
|
if (uri) {
|
|
550
565
|
session = this.userAgent ? new Inviter(this.userAgent, uri, inviterOptions) : null;
|
|
@@ -559,7 +574,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
559
574
|
}
|
|
560
575
|
|
|
561
576
|
if (conference) {
|
|
562
|
-
this.conferences[
|
|
577
|
+
this.conferences[getSipCallId(session)] = true;
|
|
563
578
|
}
|
|
564
579
|
|
|
565
580
|
const inviteOptions: InviterInviteOptions = {
|
|
@@ -568,21 +583,21 @@ export default class WebRTCClient extends Emitter {
|
|
|
568
583
|
if ((session?.sessionDescriptionHandler as any)?.peerConnection) {
|
|
569
584
|
(session?.sessionDescriptionHandler as any).peerConnection.sfu = conference;
|
|
570
585
|
}
|
|
571
|
-
this._onAccepted(session as
|
|
586
|
+
this._onAccepted(session as SipCall, response.session, true);
|
|
572
587
|
},
|
|
573
588
|
onProgress: (payload: IncomingResponse) => {
|
|
574
589
|
this._onProgress(payload.session, payload.message.statusCode === 183);
|
|
575
590
|
},
|
|
576
591
|
onReject: (response: IncomingResponse) => {
|
|
577
592
|
logger.info('on call rejected', {
|
|
578
|
-
id: session
|
|
593
|
+
id: getSipCallId(session),
|
|
579
594
|
// @ts-ignore: fromTag does not exist
|
|
580
595
|
fromTag: session?.fromTag,
|
|
581
596
|
});
|
|
582
597
|
|
|
583
|
-
this._stopSendingStats(session as
|
|
598
|
+
this._stopSendingStats(session as SipCall);
|
|
584
599
|
|
|
585
|
-
this.stopNetworkMonitoring(session as
|
|
600
|
+
this.stopNetworkMonitoring(session as SipCall);
|
|
586
601
|
this.eventEmitter.emit(REJECTED, session, response);
|
|
587
602
|
},
|
|
588
603
|
},
|
|
@@ -612,7 +627,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
612
627
|
answer(session: Invitation, enableVideo?: boolean): Promise<void> {
|
|
613
628
|
logger.info('sdk webrtc answer call', {
|
|
614
629
|
clientId: this.clientId,
|
|
615
|
-
id: session
|
|
630
|
+
id: getSipCallId(session),
|
|
616
631
|
enableVideo,
|
|
617
632
|
});
|
|
618
633
|
|
|
@@ -630,7 +645,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
630
645
|
if (session.isCanceled) {
|
|
631
646
|
const message = 'accepted a canceled session (or was canceled during the accept phase).';
|
|
632
647
|
logger.error(message, {
|
|
633
|
-
id: session
|
|
648
|
+
id: getSipCallId(session),
|
|
634
649
|
});
|
|
635
650
|
this.onCallEnded(session);
|
|
636
651
|
throw new CanceledCallError(message);
|
|
@@ -640,12 +655,12 @@ export default class WebRTCClient extends Emitter {
|
|
|
640
655
|
|
|
641
656
|
this._onAccepted(session);
|
|
642
657
|
}).catch(e => {
|
|
643
|
-
logger.error(`answer call error for ${session
|
|
658
|
+
logger.error(`answer call error for ${getSipCallId(session)}`, e);
|
|
644
659
|
throw e;
|
|
645
660
|
});
|
|
646
661
|
}
|
|
647
662
|
|
|
648
|
-
async hangup(session:
|
|
663
|
+
async hangup(session: SipCall): Promise<OutgoingByeRequest | null> {
|
|
649
664
|
const { state, id } = session;
|
|
650
665
|
logger.info('sdk webrtc hangup call', { clientId: this.clientId, id, state });
|
|
651
666
|
|
|
@@ -654,7 +669,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
654
669
|
|
|
655
670
|
this._cleanupMedia(session);
|
|
656
671
|
|
|
657
|
-
delete this.sipSessions[
|
|
672
|
+
delete this.sipSessions[getSipCallId(session)];
|
|
658
673
|
// Check if Invitation or Inviter (Invitation = incoming call)
|
|
659
674
|
const isInviter = session instanceof Inviter;
|
|
660
675
|
|
|
@@ -679,8 +694,8 @@ export default class WebRTCClient extends Emitter {
|
|
|
679
694
|
}
|
|
680
695
|
|
|
681
696
|
// Fetch and emit an event at `interval` with session network stats
|
|
682
|
-
startNetworkMonitoring(session:
|
|
683
|
-
const sessionId =
|
|
697
|
+
startNetworkMonitoring(session: SipCall, interval = 1000): void {
|
|
698
|
+
const sessionId = getSipCallId(session);
|
|
684
699
|
logger.info('starting network inspection', {
|
|
685
700
|
id: sessionId,
|
|
686
701
|
clientId: this.clientId,
|
|
@@ -689,8 +704,8 @@ export default class WebRTCClient extends Emitter {
|
|
|
689
704
|
this.networkMonitoringInterval[sessionId] = setInterval(() => this._fetchNetworkStats(sessionId), interval);
|
|
690
705
|
}
|
|
691
706
|
|
|
692
|
-
stopNetworkMonitoring(session:
|
|
693
|
-
const sessionId =
|
|
707
|
+
stopNetworkMonitoring(session: SipCall): void {
|
|
708
|
+
const sessionId = getSipCallId(session);
|
|
694
709
|
const exists = (sessionId in this.networkMonitoringInterval);
|
|
695
710
|
logger.info('stopping network inspection', {
|
|
696
711
|
clientId: this.clientId,
|
|
@@ -705,10 +720,10 @@ export default class WebRTCClient extends Emitter {
|
|
|
705
720
|
}
|
|
706
721
|
}
|
|
707
722
|
|
|
708
|
-
async reject(session:
|
|
723
|
+
async reject(session: SipCall): Promise<void> {
|
|
709
724
|
logger.info('sdk webrtc reject call', {
|
|
710
725
|
clientId: this.clientId,
|
|
711
|
-
id: session
|
|
726
|
+
id: getSipCallId(session),
|
|
712
727
|
});
|
|
713
728
|
|
|
714
729
|
try {
|
|
@@ -769,23 +784,23 @@ export default class WebRTCClient extends Emitter {
|
|
|
769
784
|
logger.info('sdk webrtc client closed', { clientId: this.clientId });
|
|
770
785
|
}
|
|
771
786
|
|
|
772
|
-
mute(session:
|
|
787
|
+
mute(session: SipCall): void {
|
|
773
788
|
logger.info('sdk webrtc mute', {
|
|
774
|
-
id: session
|
|
789
|
+
id: getSipCallId(session),
|
|
775
790
|
});
|
|
776
791
|
|
|
777
792
|
toggleAudio(session, true);
|
|
778
793
|
}
|
|
779
794
|
|
|
780
|
-
unmute(session:
|
|
795
|
+
unmute(session: SipCall): void {
|
|
781
796
|
logger.info('sdk webrtc unmute', {
|
|
782
|
-
id: session
|
|
797
|
+
id: getSipCallId(session),
|
|
783
798
|
});
|
|
784
799
|
|
|
785
800
|
toggleAudio(session, false);
|
|
786
801
|
}
|
|
787
802
|
|
|
788
|
-
isAudioMuted(session:
|
|
803
|
+
isAudioMuted(session: SipCall): boolean {
|
|
789
804
|
if (!session || !session.sessionDescriptionHandler) {
|
|
790
805
|
return false;
|
|
791
806
|
}
|
|
@@ -822,24 +837,24 @@ export default class WebRTCClient extends Emitter {
|
|
|
822
837
|
return muted;
|
|
823
838
|
}
|
|
824
839
|
|
|
825
|
-
toggleCameraOn(session:
|
|
840
|
+
toggleCameraOn(session: SipCall): void {
|
|
826
841
|
logger.info('sdk webrtc toggle camera on', {
|
|
827
|
-
id: session
|
|
842
|
+
id: getSipCallId(session),
|
|
828
843
|
});
|
|
829
844
|
|
|
830
845
|
toggleVideo(session, false);
|
|
831
846
|
}
|
|
832
847
|
|
|
833
|
-
toggleCameraOff(session:
|
|
848
|
+
toggleCameraOff(session: SipCall): void {
|
|
834
849
|
logger.info('sdk webrtc toggle camera off', {
|
|
835
|
-
id: session
|
|
850
|
+
id: getSipCallId(session),
|
|
836
851
|
});
|
|
837
852
|
|
|
838
853
|
toggleVideo(session, true);
|
|
839
854
|
}
|
|
840
855
|
|
|
841
|
-
hold(session:
|
|
842
|
-
const sessionId =
|
|
856
|
+
hold(session: SipCall, isConference = false, hadVideo = false): Promise<OutgoingInviteRequest | void> {
|
|
857
|
+
const sessionId = getSipCallId(session);
|
|
843
858
|
const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
|
|
844
859
|
logger.info('sdk webrtc hold', {
|
|
845
860
|
sessionId,
|
|
@@ -896,8 +911,8 @@ export default class WebRTCClient extends Emitter {
|
|
|
896
911
|
});
|
|
897
912
|
}
|
|
898
913
|
|
|
899
|
-
unhold(session:
|
|
900
|
-
const sessionId =
|
|
914
|
+
unhold(session: SipCall, isConference = false): Promise<OutgoingInviteRequest | void> {
|
|
915
|
+
const sessionId = getSipCallId(session);
|
|
901
916
|
const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
|
|
902
917
|
logger.info('sdk webrtc unhold', {
|
|
903
918
|
sessionId,
|
|
@@ -915,7 +930,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
915
930
|
|
|
916
931
|
this.unmute(session);
|
|
917
932
|
|
|
918
|
-
delete this.heldSessions[
|
|
933
|
+
delete this.heldSessions[getSipCallId(session)];
|
|
919
934
|
session.sessionDescriptionHandlerOptionsReInvite = {
|
|
920
935
|
hold: false,
|
|
921
936
|
conference: isConference,
|
|
@@ -943,21 +958,21 @@ export default class WebRTCClient extends Emitter {
|
|
|
943
958
|
return this.heldSessions[sessionId];
|
|
944
959
|
}
|
|
945
960
|
|
|
946
|
-
isCallHeld(session:
|
|
947
|
-
return
|
|
961
|
+
isCallHeld(session: SipCall): boolean {
|
|
962
|
+
return getSipCallId(session) in this.heldSessions;
|
|
948
963
|
}
|
|
949
964
|
|
|
950
965
|
isVideoRemotelyHeld(sessionId: string): boolean {
|
|
951
966
|
return isVideoRemotelyHeld(this.heldSessions[sessionId]);
|
|
952
967
|
}
|
|
953
968
|
|
|
954
|
-
sendDTMF(session:
|
|
969
|
+
sendDTMF(session: SipCall, tone: string): boolean {
|
|
955
970
|
if (!session.sessionDescriptionHandler) {
|
|
956
971
|
return false;
|
|
957
972
|
}
|
|
958
973
|
|
|
959
974
|
logger.info('Sending DTMF', {
|
|
960
|
-
id:
|
|
975
|
+
id: getSipCallId(session),
|
|
961
976
|
tone,
|
|
962
977
|
});
|
|
963
978
|
return session.sessionDescriptionHandler.sendDtmf(tone);
|
|
@@ -973,10 +988,10 @@ export default class WebRTCClient extends Emitter {
|
|
|
973
988
|
messager.message();
|
|
974
989
|
}
|
|
975
990
|
|
|
976
|
-
transfer(session:
|
|
991
|
+
transfer(session: SipCall, target: string): void {
|
|
977
992
|
this.hold(session);
|
|
978
993
|
logger.info('Transfering a session', {
|
|
979
|
-
id:
|
|
994
|
+
id: getSipCallId(session),
|
|
980
995
|
target,
|
|
981
996
|
});
|
|
982
997
|
const options = {
|
|
@@ -997,24 +1012,24 @@ export default class WebRTCClient extends Emitter {
|
|
|
997
1012
|
}
|
|
998
1013
|
|
|
999
1014
|
// check https://sipjs.com/api/0.12.0/refer/referClientContext/
|
|
1000
|
-
atxfer(session:
|
|
1015
|
+
atxfer(session: SipCall): Record<string, any> {
|
|
1001
1016
|
this.hold(session);
|
|
1002
1017
|
logger.info('webrtc transfer started', {
|
|
1003
|
-
id:
|
|
1018
|
+
id: getSipCallId(session),
|
|
1004
1019
|
});
|
|
1005
1020
|
const result: Record<string, any> = {
|
|
1006
1021
|
newSession: null,
|
|
1007
1022
|
init: async (target: string) => {
|
|
1008
1023
|
logger.info('webrtc transfer initialized', {
|
|
1009
|
-
id:
|
|
1024
|
+
id: getSipCallId(session),
|
|
1010
1025
|
target,
|
|
1011
1026
|
});
|
|
1012
1027
|
result.newSession = await this.call(target);
|
|
1013
1028
|
},
|
|
1014
1029
|
complete: () => {
|
|
1015
1030
|
logger.info('webrtc transfer completed', {
|
|
1016
|
-
id:
|
|
1017
|
-
referId:
|
|
1031
|
+
id: getSipCallId(session),
|
|
1032
|
+
referId: getSipCallId(result.newSession),
|
|
1018
1033
|
});
|
|
1019
1034
|
session.refer(result.newSession);
|
|
1020
1035
|
},
|
|
@@ -1027,13 +1042,13 @@ export default class WebRTCClient extends Emitter {
|
|
|
1027
1042
|
}
|
|
1028
1043
|
|
|
1029
1044
|
// eslint-disable-next-line @typescript-eslint/default-param-last
|
|
1030
|
-
sendMessage(sipSession:
|
|
1045
|
+
sendMessage(sipSession: SipCall | null = null, body: string, contentType = 'text/plain'): void {
|
|
1031
1046
|
if (!sipSession) {
|
|
1032
1047
|
return;
|
|
1033
1048
|
}
|
|
1034
1049
|
|
|
1035
1050
|
logger.info('send WebRTC message', {
|
|
1036
|
-
sipId: sipSession
|
|
1051
|
+
sipId: getSipCallId(sipSession),
|
|
1037
1052
|
contentType,
|
|
1038
1053
|
});
|
|
1039
1054
|
|
|
@@ -1107,7 +1122,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
1107
1122
|
await Promise.allSettled(promises);
|
|
1108
1123
|
}
|
|
1109
1124
|
|
|
1110
|
-
async changeAudioInputDevice(id: string, session:
|
|
1125
|
+
async changeAudioInputDevice(id: string, session: SipCall | null | undefined, force?: boolean): Promise<MediaStream | null> {
|
|
1111
1126
|
const currentId = this.getAudioDeviceId();
|
|
1112
1127
|
logger.info('setting audio input device', {
|
|
1113
1128
|
id,
|
|
@@ -1178,7 +1193,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
1178
1193
|
return null;
|
|
1179
1194
|
}
|
|
1180
1195
|
|
|
1181
|
-
async changeVideoInputDevice(id: string, session?:
|
|
1196
|
+
async changeVideoInputDevice(id: string, session?: SipCall): Promise<MediaStream | void> {
|
|
1182
1197
|
this.setVideoInputDevice(id);
|
|
1183
1198
|
|
|
1184
1199
|
if (session) {
|
|
@@ -1206,14 +1221,14 @@ export default class WebRTCClient extends Emitter {
|
|
|
1206
1221
|
};
|
|
1207
1222
|
}
|
|
1208
1223
|
|
|
1209
|
-
changeSessionVideoInputDevice(id: string | null | undefined, session:
|
|
1224
|
+
changeSessionVideoInputDevice(id: string | null | undefined, session: SipCall): Promise<MediaStream | void> {
|
|
1210
1225
|
if (!sessionWantsToDoVideo(session)) {
|
|
1211
1226
|
return Promise.resolve();
|
|
1212
1227
|
}
|
|
1213
1228
|
|
|
1214
1229
|
const sdh = session.sessionDescriptionHandler as SessionDescriptionHandler;
|
|
1215
1230
|
const pc = sdh.peerConnection;
|
|
1216
|
-
const sessionId =
|
|
1231
|
+
const sessionId = getSipCallId(session);
|
|
1217
1232
|
const localStream = this.getLocalStream(sessionId);
|
|
1218
1233
|
logger.info('changing video input device', {
|
|
1219
1234
|
id,
|
|
@@ -1270,7 +1285,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
1270
1285
|
return this.video && typeof this.video === 'object' && 'deviceId' in this.video ? (this.video.deviceId as any)?.exact : undefined;
|
|
1271
1286
|
}
|
|
1272
1287
|
|
|
1273
|
-
reinvite(sipSession:
|
|
1288
|
+
reinvite(sipSession: SipCall, newConstraints: Record<string, any> | null | undefined = null, conference = false, audioOnly = false, iceRestart = false): Promise<OutgoingInviteRequest | void> {
|
|
1274
1289
|
if (!sipSession) {
|
|
1275
1290
|
return Promise.resolve();
|
|
1276
1291
|
}
|
|
@@ -1286,7 +1301,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
1286
1301
|
const desktop = newConstraints && newConstraints.desktop;
|
|
1287
1302
|
logger.info('Sending reinvite', {
|
|
1288
1303
|
clientId: this.clientId,
|
|
1289
|
-
id:
|
|
1304
|
+
id: getSipCallId(sipSession),
|
|
1290
1305
|
newConstraints,
|
|
1291
1306
|
conference,
|
|
1292
1307
|
audioOnly,
|
|
@@ -1324,7 +1339,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
1324
1339
|
}
|
|
1325
1340
|
|
|
1326
1341
|
logger.info('on re-INVITE accepted', {
|
|
1327
|
-
id:
|
|
1342
|
+
id: getSipCallId(sipSession),
|
|
1328
1343
|
wasMuted,
|
|
1329
1344
|
shouldDoScreenSharing,
|
|
1330
1345
|
});
|
|
@@ -1461,10 +1476,10 @@ export default class WebRTCClient extends Emitter {
|
|
|
1461
1476
|
this.heartbeatCb = cb;
|
|
1462
1477
|
}
|
|
1463
1478
|
|
|
1464
|
-
onCallEnded(session:
|
|
1479
|
+
onCallEnded(session: SipCall): void {
|
|
1465
1480
|
this._cleanupMedia(session);
|
|
1466
1481
|
|
|
1467
|
-
delete this.sipSessions[
|
|
1482
|
+
delete this.sipSessions[getSipCallId(session)];
|
|
1468
1483
|
|
|
1469
1484
|
this._stopSendingStats(session);
|
|
1470
1485
|
|
|
@@ -1482,18 +1497,18 @@ export default class WebRTCClient extends Emitter {
|
|
|
1482
1497
|
this.userAgent.attemptReconnection();
|
|
1483
1498
|
}
|
|
1484
1499
|
|
|
1485
|
-
storeSipSession(session:
|
|
1486
|
-
const id =
|
|
1500
|
+
storeSipSession(session: SipCall): void {
|
|
1501
|
+
const id = getSipCallId(session);
|
|
1487
1502
|
logger.info('storing sip session', { id, clientId: this.clientId });
|
|
1488
1503
|
|
|
1489
1504
|
this.sipSessions[id] = session;
|
|
1490
1505
|
}
|
|
1491
1506
|
|
|
1492
|
-
getSipSession(id: string):
|
|
1493
|
-
return id in this.sipSessions ? this.sipSessions[id
|
|
1507
|
+
getSipSession(id: string): SipCall | null | undefined {
|
|
1508
|
+
return id in this.sipSessions ? this.sipSessions[id] : null;
|
|
1494
1509
|
}
|
|
1495
1510
|
|
|
1496
|
-
|
|
1511
|
+
getSipCallIds(): string[] {
|
|
1497
1512
|
return Object.keys(this.sipSessions);
|
|
1498
1513
|
}
|
|
1499
1514
|
|
|
@@ -1545,8 +1560,8 @@ export default class WebRTCClient extends Emitter {
|
|
|
1545
1560
|
return audio;
|
|
1546
1561
|
}
|
|
1547
1562
|
|
|
1548
|
-
_onTransportError(): void {
|
|
1549
|
-
logger.
|
|
1563
|
+
_onTransportError(reason?: string): void {
|
|
1564
|
+
logger.warn('on transport error', { reason });
|
|
1550
1565
|
this.eventEmitter.emit(TRANSPORT_ERROR);
|
|
1551
1566
|
this.attemptReconnection();
|
|
1552
1567
|
}
|
|
@@ -1608,7 +1623,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
1608
1623
|
}
|
|
1609
1624
|
|
|
1610
1625
|
// We can invoke disconnect() with an error that can be catcher by `onDisconnect`, so we have to trigger it here.
|
|
1611
|
-
this._onTransportError();
|
|
1626
|
+
this._onTransportError('heartbeat timeout');
|
|
1612
1627
|
}
|
|
1613
1628
|
}
|
|
1614
1629
|
|
|
@@ -1664,7 +1679,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
1664
1679
|
return this.connectionPromise;
|
|
1665
1680
|
}
|
|
1666
1681
|
|
|
1667
|
-
_buildConfig(config: WebRtcConfig, session:
|
|
1682
|
+
_buildConfig(config: WebRtcConfig, session: SipCall | null | undefined): Promise<WebRtcConfig> {
|
|
1668
1683
|
// If no session provided, return the configuration directly
|
|
1669
1684
|
if (!session) {
|
|
1670
1685
|
return new Promise(resolve => resolve(config));
|
|
@@ -1685,8 +1700,8 @@ export default class WebRTCClient extends Emitter {
|
|
|
1685
1700
|
}
|
|
1686
1701
|
|
|
1687
1702
|
// Invitation and Inviter extends Session
|
|
1688
|
-
_setupSession(session:
|
|
1689
|
-
const sipSessionId =
|
|
1703
|
+
_setupSession(session: SipCall): void {
|
|
1704
|
+
const sipSessionId = getSipCallId(session);
|
|
1690
1705
|
|
|
1691
1706
|
// When receiving an Invitation, the delegate is not defined.
|
|
1692
1707
|
if (!session.delegate) {
|
|
@@ -1758,21 +1773,20 @@ export default class WebRTCClient extends Emitter {
|
|
|
1758
1773
|
};
|
|
1759
1774
|
}
|
|
1760
1775
|
|
|
1761
|
-
async _onProgress(session:
|
|
1776
|
+
async _onProgress(session: SipCall, early = false): Promise<void> {
|
|
1762
1777
|
await this._setupMedias(session);
|
|
1763
1778
|
|
|
1764
|
-
const sessionId =
|
|
1779
|
+
const sessionId = getSipCallId(session);
|
|
1780
|
+
|
|
1765
1781
|
updateRemoteStream(session);
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
early,
|
|
1769
|
-
});
|
|
1782
|
+
|
|
1783
|
+
logger.info('progress received', { sessionId, early });
|
|
1770
1784
|
this.eventEmitter.emit(early ? ON_EARLY_MEDIA : ON_PROGRESS, session);
|
|
1771
1785
|
}
|
|
1772
1786
|
|
|
1773
|
-
async _onAccepted(session:
|
|
1787
|
+
async _onAccepted(session: SipCall, sessionDialog?: SessionDialog, withEvent = true, initAllTracks = true): Promise<void> {
|
|
1774
1788
|
logger.info('on call accepted', {
|
|
1775
|
-
id: session
|
|
1789
|
+
id: getSipCallId(session),
|
|
1776
1790
|
clientId: this.clientId,
|
|
1777
1791
|
remoteTag: session.remoteTag,
|
|
1778
1792
|
});
|
|
@@ -1822,14 +1836,14 @@ export default class WebRTCClient extends Emitter {
|
|
|
1822
1836
|
this._startSendingStats(session);
|
|
1823
1837
|
}
|
|
1824
1838
|
|
|
1825
|
-
async _setupMedias(session:
|
|
1839
|
+
async _setupMedias(session: SipCall, newStream: MediaStream | null | undefined = null): Promise<void> {
|
|
1826
1840
|
if (!isWeb()) {
|
|
1827
1841
|
logger.info('Setup media on mobile, no need to setup html element, bailing');
|
|
1828
1842
|
return;
|
|
1829
1843
|
}
|
|
1830
1844
|
|
|
1831
1845
|
// Safari hack, because you cannot call .play() from a non user action
|
|
1832
|
-
const sessionId =
|
|
1846
|
+
const sessionId = getSipCallId(session);
|
|
1833
1847
|
const isConference = this.isConference(sessionId);
|
|
1834
1848
|
|
|
1835
1849
|
if (sessionId in this.audioElements) {
|
|
@@ -1883,8 +1897,8 @@ export default class WebRTCClient extends Emitter {
|
|
|
1883
1897
|
audioElement.play().catch(() => {});
|
|
1884
1898
|
}
|
|
1885
1899
|
|
|
1886
|
-
_cleanupMedia(session?:
|
|
1887
|
-
const sessionId =
|
|
1900
|
+
_cleanupMedia(session?: SipCall): void {
|
|
1901
|
+
const sessionId = getSipCallId(session);
|
|
1888
1902
|
const localStream = this.getLocalStream(sessionId);
|
|
1889
1903
|
|
|
1890
1904
|
if (localStream) {
|
|
@@ -1910,7 +1924,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
1910
1924
|
|
|
1911
1925
|
if (this._hasAudio() && isWeb()) {
|
|
1912
1926
|
if (session) {
|
|
1913
|
-
cleanLocalElement(
|
|
1927
|
+
cleanLocalElement(getSipCallId(session));
|
|
1914
1928
|
} else {
|
|
1915
1929
|
Object.keys(this.audioElements).forEach(id => cleanLocalElement(id));
|
|
1916
1930
|
}
|
|
@@ -1925,7 +1939,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
1925
1939
|
}
|
|
1926
1940
|
}
|
|
1927
1941
|
|
|
1928
|
-
_startSendingStats(session:
|
|
1942
|
+
_startSendingStats(session: SipCall): void {
|
|
1929
1943
|
const sdh = session.sessionDescriptionHandler as SessionDescriptionHandler;
|
|
1930
1944
|
const pc = sdh.peerConnection;
|
|
1931
1945
|
|
|
@@ -1933,7 +1947,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
1933
1947
|
return;
|
|
1934
1948
|
}
|
|
1935
1949
|
|
|
1936
|
-
const sessionId =
|
|
1950
|
+
const sessionId = getSipCallId(session);
|
|
1937
1951
|
getStats(pc, (result: Record<string, any>) => {
|
|
1938
1952
|
const {
|
|
1939
1953
|
results,
|
|
@@ -1949,8 +1963,8 @@ export default class WebRTCClient extends Emitter {
|
|
|
1949
1963
|
}, SEND_STATS_DELAY);
|
|
1950
1964
|
}
|
|
1951
1965
|
|
|
1952
|
-
_stopSendingStats(session:
|
|
1953
|
-
const sessionId =
|
|
1966
|
+
_stopSendingStats(session: SipCall): void {
|
|
1967
|
+
const sessionId = getSipCallId(session);
|
|
1954
1968
|
logger.trace('Check for stopping stats', {
|
|
1955
1969
|
sessionId,
|
|
1956
1970
|
ids: Object.keys(this.statsIntervals),
|
|
@@ -2010,20 +2024,20 @@ export default class WebRTCClient extends Emitter {
|
|
|
2010
2024
|
async _accept(session: Invitation, options: InvitationAcceptOptions = {}) {
|
|
2011
2025
|
if (session.state === SessionState.Terminated || session.state === SessionState.Terminating) {
|
|
2012
2026
|
const error = 'Trying to accept a terminated sipSession.';
|
|
2013
|
-
logger.warn(error, { state: session.state, sessionId: session
|
|
2027
|
+
logger.warn(error, { state: session.state, sessionId: getSipCallId(session) });
|
|
2014
2028
|
throw new Error(error);
|
|
2015
2029
|
}
|
|
2016
2030
|
|
|
2017
2031
|
if (session.state !== SessionState.Initial) {
|
|
2018
2032
|
const error = 'Trying to accept a non Initial sipSession.';
|
|
2019
|
-
logger.warn(error, { state: session.state, sessionId: session
|
|
2033
|
+
logger.warn(error, { state: session.state, sessionId: getSipCallId(session) });
|
|
2020
2034
|
throw new Error(error);
|
|
2021
2035
|
}
|
|
2022
2036
|
|
|
2023
2037
|
// @ts-ignore: private
|
|
2024
2038
|
if (!session.incomingInviteRequest.acceptable) {
|
|
2025
2039
|
const error = 'Trying to reject a non `acceptable` session';
|
|
2026
|
-
logger.warn(error, { state: session.state, sessionId: session
|
|
2040
|
+
logger.warn(error, { state: session.state, sessionId: getSipCallId(session) });
|
|
2027
2041
|
throw new Error(error);
|
|
2028
2042
|
}
|
|
2029
2043
|
|
|
@@ -2036,13 +2050,13 @@ export default class WebRTCClient extends Emitter {
|
|
|
2036
2050
|
|
|
2037
2051
|
async _reject(session: Invitation, options: InvitationRejectOptions = {}) {
|
|
2038
2052
|
if (session.state !== SessionState.Initial && session.state !== SessionState.Establishing) {
|
|
2039
|
-
logger.warn('Trying to reject a session in a wrong state', { state: session.state, sessionId: session
|
|
2053
|
+
logger.warn('Trying to reject a session in a wrong state', { state: session.state, sessionId: getSipCallId(session) });
|
|
2040
2054
|
return;
|
|
2041
2055
|
}
|
|
2042
2056
|
|
|
2043
2057
|
// @ts-ignore: private
|
|
2044
2058
|
if (!session.incomingInviteRequest.rejectable) {
|
|
2045
|
-
logger.warn('Trying to reject a non `rejectable` session', { state: session.state, sessionId: session
|
|
2059
|
+
logger.warn('Trying to reject a non `rejectable` session', { state: session.state, sessionId: getSipCallId(session) });
|
|
2046
2060
|
return;
|
|
2047
2061
|
}
|
|
2048
2062
|
|
|
@@ -2055,7 +2069,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
2055
2069
|
|
|
2056
2070
|
async _cancel(session: Inviter, options: InviterCancelOptions = {}) {
|
|
2057
2071
|
if (session.state !== SessionState.Initial && session.state !== SessionState.Establishing) {
|
|
2058
|
-
logger.warn('Trying to cancel a session in a wrong state', { state: session.state, sessionId: session
|
|
2072
|
+
logger.warn('Trying to cancel a session in a wrong state', { state: session.state, sessionId: getSipCallId(session) });
|
|
2059
2073
|
return;
|
|
2060
2074
|
}
|
|
2061
2075
|
|
|
@@ -2066,9 +2080,9 @@ export default class WebRTCClient extends Emitter {
|
|
|
2066
2080
|
}
|
|
2067
2081
|
}
|
|
2068
2082
|
|
|
2069
|
-
async _bye(session:
|
|
2083
|
+
async _bye(session: SipCall, options: SessionByeOptions = {}) {
|
|
2070
2084
|
if (session.state !== SessionState.Established) {
|
|
2071
|
-
logger.warn('Trying to end a session in a wrong state', { state: session.state, sessionId: session
|
|
2085
|
+
logger.warn('Trying to end a session in a wrong state', { state: session.state, sessionId: getSipCallId(session) });
|
|
2072
2086
|
return null;
|
|
2073
2087
|
}
|
|
2074
2088
|
|