@wazo/sdk 1.0.0-alpha.5 → 1.0.0-alpha.7
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/wazo-sdk.js +2 -2
- package/esm/__tests__/__voice__/call.test.js +12 -0
- package/esm/checker/checks/webrtc.js +2 -2
- package/esm/domain/Phone/WebRTCPhone.js +30 -30
- package/esm/simple/Phone.js +3 -3
- package/esm/simple/room/Room.js +2 -2
- package/esm/simple/room/SipRoom.js +2 -2
- package/esm/state-machine/utils.js +8 -3
- package/esm/types/domain/Phone/WebRTCPhone.d.ts +1 -1
- package/esm/types/domain/Phone/WebRTCPhone.d.ts.map +1 -1
- package/esm/types/simple/Phone.d.ts +1 -1
- package/esm/types/simple/Phone.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 +2 -2
- package/esm/types/utils/sdp.d.ts.map +1 -1
- package/esm/types/voice/call.d.ts +1 -0
- package/esm/types/voice/call.d.ts.map +1 -1
- package/esm/types/voice/softphone.d.ts +1 -0
- package/esm/types/voice/softphone.d.ts.map +1 -1
- package/esm/types/web-rtc-client.d.ts +1 -1
- package/esm/types/web-rtc-client.d.ts.map +1 -1
- package/esm/utils/sdp.js +5 -5
- package/esm/utils/webrtc.js +3 -3
- package/esm/voice/call.js +6 -3
- package/esm/voice/softphone.js +11 -5
- package/esm/web-rtc-client.js +33 -31
- package/lib/__tests__/__voice__/call.test.js +12 -0
- package/lib/checker/checks/webrtc.js +1 -1
- package/lib/domain/Phone/WebRTCPhone.js +29 -29
- package/lib/simple/Phone.js +2 -2
- package/lib/simple/room/Room.js +1 -1
- package/lib/simple/room/SipRoom.js +1 -1
- package/lib/state-machine/utils.js +8 -3
- package/lib/types/domain/Phone/WebRTCPhone.d.ts +1 -1
- package/lib/types/domain/Phone/WebRTCPhone.d.ts.map +1 -1
- package/lib/types/simple/Phone.d.ts +1 -1
- package/lib/types/simple/Phone.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 +2 -2
- package/lib/types/utils/sdp.d.ts.map +1 -1
- package/lib/types/voice/call.d.ts +1 -0
- package/lib/types/voice/call.d.ts.map +1 -1
- package/lib/types/voice/softphone.d.ts +1 -0
- package/lib/types/voice/softphone.d.ts.map +1 -1
- package/lib/types/web-rtc-client.d.ts +1 -1
- package/lib/types/web-rtc-client.d.ts.map +1 -1
- package/lib/utils/sdp.js +7 -7
- package/lib/utils/webrtc.js +2 -2
- package/lib/voice/call.js +5 -2
- package/lib/voice/softphone.js +11 -5
- package/lib/web-rtc-client.js +32 -30
- package/package.json +1 -1
- package/src/__tests__/__voice__/call.test.ts +15 -0
- package/src/checker/checks/webrtc.ts +2 -2
- package/src/domain/Phone/WebRTCPhone.ts +30 -30
- package/src/simple/Phone.ts +3 -3
- package/src/simple/room/Room.ts +2 -2
- package/src/simple/room/SipRoom.ts +2 -2
- package/src/state-machine/utils.ts +10 -3
- package/src/utils/sdp.ts +5 -5
- package/src/utils/webrtc.ts +3 -3
- package/src/voice/call.ts +7 -3
- package/src/voice/softphone.ts +12 -5
- package/src/web-rtc-client.ts +33 -31
package/esm/utils/sdp.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import sdpParser from 'sdp-transform';
|
|
3
3
|
import { UserAgent } from 'sip.js/lib/api/user-agent';
|
|
4
4
|
import { Inviter } from 'sip.js/lib/api';
|
|
5
|
-
export const
|
|
5
|
+
export const SIP_ID_MIN_LENGTH = 20;
|
|
6
6
|
export const getCandidates = (rawSdp) => {
|
|
7
7
|
if (!rawSdp) {
|
|
8
8
|
return [];
|
|
@@ -106,22 +106,22 @@ export const addIcesInAllBundles = (sdp) => {
|
|
|
106
106
|
}));
|
|
107
107
|
return sdpParser.write(parsedSdp);
|
|
108
108
|
};
|
|
109
|
-
export const
|
|
109
|
+
export const getSipCallId = (sipSession) => {
|
|
110
110
|
if (!sipSession) {
|
|
111
111
|
return '';
|
|
112
112
|
}
|
|
113
113
|
const message = sipSession.message;
|
|
114
114
|
if (message?.callId) {
|
|
115
|
-
return message.callId.substring(0,
|
|
115
|
+
return message.callId.substring(0, SIP_ID_MIN_LENGTH);
|
|
116
116
|
}
|
|
117
117
|
// For Inviter
|
|
118
118
|
// @ts-ignore: private
|
|
119
119
|
if (sipSession instanceof Inviter && sipSession.outgoingRequestMessage) {
|
|
120
120
|
// @ts-ignore: private
|
|
121
|
-
return sipSession.outgoingRequestMessage.callId.substring(0,
|
|
121
|
+
return sipSession.outgoingRequestMessage.callId.substring(0, SIP_ID_MIN_LENGTH);
|
|
122
122
|
}
|
|
123
123
|
// For Invitation
|
|
124
|
-
return (sipSession.id || '').substring(0,
|
|
124
|
+
return (sipSession.id || '').substring(0, SIP_ID_MIN_LENGTH);
|
|
125
125
|
};
|
|
126
126
|
// We need to replace 0.0.0.0 to 127.0.0.1 in the sdp to avoid MOH during a createOffer.
|
|
127
127
|
export const replaceLocalIpModifier = (description) => Promise.resolve({
|
package/esm/utils/webrtc.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defaultPeerConnectionConfiguration } from 'sip.js/lib/platform/web/session-description-handler/peer-connection-configuration-default';
|
|
2
2
|
import { stripVideo } from 'sip.js/lib/platform/web';
|
|
3
3
|
import WazoSessionDescriptionHandler, { wazoMediaStreamFactory } from '../lib/WazoSessionDescriptionHandler';
|
|
4
|
-
import { getVideoDirection, hasAnActiveVideo, makeURI, replaceLocalIpModifier } from './sdp';
|
|
4
|
+
import { getSipCallId, getVideoDirection, hasAnActiveVideo, makeURI, replaceLocalIpModifier } from './sdp';
|
|
5
5
|
import IssueReporter from '../service/IssueReporter';
|
|
6
6
|
import { lastIndexOf } from './array';
|
|
7
7
|
const logger = IssueReporter.loggerFor('webrtc');
|
|
@@ -198,7 +198,7 @@ export const cleanupStream = (stream) => {
|
|
|
198
198
|
};
|
|
199
199
|
export const setLocalMediaStream = (sipCall, newStream) => {
|
|
200
200
|
logger.info('setting local media stream', {
|
|
201
|
-
id: sipCall
|
|
201
|
+
id: getSipCallId(sipCall),
|
|
202
202
|
tracks: newStream ? newStream.getTracks() : null,
|
|
203
203
|
});
|
|
204
204
|
if (sipCall.sessionDescriptionHandler) {
|
|
@@ -211,7 +211,7 @@ export const updateRemoteStream = (sipCall, allTracks = true) => {
|
|
|
211
211
|
const remoteStream = getRemoteStream(sipCall);
|
|
212
212
|
const pc = getPeerConnection(sipCall);
|
|
213
213
|
logger.info('Updating remote stream', {
|
|
214
|
-
id: sipCall
|
|
214
|
+
id: getSipCallId(sipCall),
|
|
215
215
|
tracks: remoteStream ? remoteStream.getTracks() : null,
|
|
216
216
|
receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map((receiver) => receiver.track) : null,
|
|
217
217
|
});
|
package/esm/voice/call.js
CHANGED
|
@@ -8,7 +8,7 @@ import newFrom from '../utils/new-from';
|
|
|
8
8
|
import updateFrom from '../utils/update-from';
|
|
9
9
|
import IssueReporter from '../service/IssueReporter';
|
|
10
10
|
import softphone, { EVENT_TERMINATE_SOUND } from './softphone';
|
|
11
|
-
import { getCallDisplayName, getCallNumber,
|
|
11
|
+
import { getCallDisplayName, getCallNumber, getSipCallId } from '../utils/sdp';
|
|
12
12
|
import { assertCan, assertState, getState } from '../state-machine/utils';
|
|
13
13
|
import { downgradeToAudio, getLocalStream, getLocalVideoStream, getPeerConnection, getRemoteStream, getRemoteVideoStream, getStreamFromConstraints, getWebRtcStats, hasALocalVideoTrack, hasLocalVideo, hasRemoteVideo, isVideoMuted, isVideoRemotelyHeld, setLocalMediaStream, toggleVideo, upgradeToVideo } from '../utils/webrtc';
|
|
14
14
|
const logger = IssueReporter.loggerFor('call');
|
|
@@ -254,7 +254,7 @@ class Call extends EventEmitter {
|
|
|
254
254
|
return this.sipCall.state === SessionState.Establishing;
|
|
255
255
|
}
|
|
256
256
|
isEstablished() {
|
|
257
|
-
return States.ESTABLISHED in this.state;
|
|
257
|
+
return typeof this.state === 'object' && States.ESTABLISHED in this.state;
|
|
258
258
|
}
|
|
259
259
|
isRinging() {
|
|
260
260
|
return this.state === States.RINGING;
|
|
@@ -400,6 +400,9 @@ class Call extends EventEmitter {
|
|
|
400
400
|
logger.info('call - updrading directly in screensharing mode', { id: this.id, tracks: localStream?.getTracks() });
|
|
401
401
|
this._onScreenSharing(localStream, false, desktop);
|
|
402
402
|
}
|
|
403
|
+
onMakeCall() {
|
|
404
|
+
this._sendAction(Actions.MAKE_CALL);
|
|
405
|
+
}
|
|
403
406
|
onAccepted() {
|
|
404
407
|
this._sendAction(Actions.REMOTLY_ACCEPTED);
|
|
405
408
|
this.emit(EVENT_CALL_REMOTLY_ACCEPTED);
|
|
@@ -464,7 +467,7 @@ class Call extends EventEmitter {
|
|
|
464
467
|
return !!this.sipCall.request?.getHeader('alert-info');
|
|
465
468
|
}
|
|
466
469
|
get id() {
|
|
467
|
-
return
|
|
470
|
+
return getSipCallId(this.sipCall);
|
|
468
471
|
}
|
|
469
472
|
get state() {
|
|
470
473
|
return getState(this.callActor);
|
package/esm/voice/softphone.js
CHANGED
|
@@ -9,6 +9,7 @@ import IssueReporter from '../service/IssueReporter';
|
|
|
9
9
|
import configureLogger from '../utils/sip-logger';
|
|
10
10
|
import Call from './call';
|
|
11
11
|
import { assertCan, can, getState, waitUntilState } from '../state-machine/utils';
|
|
12
|
+
import { getSipCallId } from '../utils/sdp';
|
|
12
13
|
export const EVENT_INCOMING = 'incoming';
|
|
13
14
|
export const EVENT_OUTGOING = 'outgoing';
|
|
14
15
|
export const EVENT_HEARTBEAT = 'heartbeat';
|
|
@@ -125,7 +126,7 @@ export class Softphone extends EventEmitter {
|
|
|
125
126
|
logger.info('softphone - calling when registering, waiting for Softphone to be registered ...');
|
|
126
127
|
await waitUntilState(this.softphoneActor, States.REGISTERED);
|
|
127
128
|
}
|
|
128
|
-
if (this.state !== States.
|
|
129
|
+
if (this.state !== States.REGISTERED) {
|
|
129
130
|
throw new InvalidState(`Invalid state ${States.UNREGISTERED}`, States.UNREGISTERED);
|
|
130
131
|
}
|
|
131
132
|
// Hold other calls
|
|
@@ -134,6 +135,8 @@ export class Softphone extends EventEmitter {
|
|
|
134
135
|
try {
|
|
135
136
|
sipCall = this.client.call(options.params.To, options.withCamera, options.audioOnly, options.conference, options);
|
|
136
137
|
const call = new Call(sipCall, this);
|
|
138
|
+
call.onMakeCall();
|
|
139
|
+
this.calls.push(call);
|
|
137
140
|
this.emit(EVENT_OUTGOING, call);
|
|
138
141
|
return call;
|
|
139
142
|
}
|
|
@@ -289,7 +292,7 @@ export class Softphone extends EventEmitter {
|
|
|
289
292
|
});
|
|
290
293
|
this.client.on(this.client.ON_REINVITE, (sipCall, request, updatedCalleeName, updatedNumber, hadRemoteVideo) => {
|
|
291
294
|
logger.info('softphone - on reinvite', {
|
|
292
|
-
callId: sipCall
|
|
295
|
+
callId: getSipCallId(sipCall),
|
|
293
296
|
inviteId: request.callId,
|
|
294
297
|
updatedCalleeName,
|
|
295
298
|
updatedNumber,
|
|
@@ -387,13 +390,16 @@ export class Softphone extends EventEmitter {
|
|
|
387
390
|
this.softphoneActor.send({ type: action });
|
|
388
391
|
}
|
|
389
392
|
_getCall(sipCall) {
|
|
390
|
-
return this.calls.find(call => call.id === sipCall
|
|
393
|
+
return this.calls.find(call => call.id === getSipCallId(sipCall));
|
|
394
|
+
}
|
|
395
|
+
_getCallIds() {
|
|
396
|
+
return this.calls.map(call => call.id);
|
|
391
397
|
}
|
|
392
398
|
_onCallEvent(sipCall, eventName, ...args) {
|
|
393
|
-
logger.
|
|
399
|
+
logger.info('softphone - received call event', { eventName, sipId: getSipCallId(sipCall) });
|
|
394
400
|
const call = this._getCall(sipCall);
|
|
395
401
|
if (!call) {
|
|
396
|
-
logger.warn('softphone - no call found to send the event', { eventName, sipId: sipCall.
|
|
402
|
+
logger.warn('softphone - no call found to send the event', { eventName, sipId: getSipCallId(sipCall), ids: this._getCallIds() });
|
|
397
403
|
return;
|
|
398
404
|
}
|
|
399
405
|
// @ts-ignore
|
package/esm/web-rtc-client.js
CHANGED
|
@@ -17,7 +17,7 @@ import Emitter from './utils/Emitter';
|
|
|
17
17
|
import ApiClient from './api-client';
|
|
18
18
|
import IssueReporter from './service/IssueReporter';
|
|
19
19
|
import Heartbeat from './utils/Heartbeat';
|
|
20
|
-
import {
|
|
20
|
+
import { getSipCallId, makeURI, replaceLocalIpModifier, SIP_ID_MIN_LENGTH } from './utils/sdp';
|
|
21
21
|
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';
|
|
22
22
|
const SEND_STATS_DELAY = 5000;
|
|
23
23
|
const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
|
|
@@ -103,7 +103,9 @@ export default class WebRTCClient extends Emitter {
|
|
|
103
103
|
this.skipRegister = config.skipRegister;
|
|
104
104
|
this._buildConfig(config, session).then((newConfig) => {
|
|
105
105
|
this.config = newConfig;
|
|
106
|
-
this.userAgent
|
|
106
|
+
if (!this.userAgent) {
|
|
107
|
+
this.userAgent = this.createUserAgent(uaConfigOverrides);
|
|
108
|
+
}
|
|
107
109
|
});
|
|
108
110
|
this.audioOutputDeviceId = config.audioDeviceOutput;
|
|
109
111
|
this.audioOutputVolume = config.audioOutputVolume || 1;
|
|
@@ -230,7 +232,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
230
232
|
// @ts-ignore: private
|
|
231
233
|
this.registerer.waitingToggle(false);
|
|
232
234
|
}
|
|
233
|
-
this.eventEmitter.emit(UNREGISTERED);
|
|
235
|
+
this.eventEmitter.emit(UNREGISTERED, error);
|
|
234
236
|
}
|
|
235
237
|
}
|
|
236
238
|
async register(tries = 0) {
|
|
@@ -435,7 +437,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
435
437
|
this._setupSession(session);
|
|
436
438
|
}
|
|
437
439
|
if (conference) {
|
|
438
|
-
this.conferences[
|
|
440
|
+
this.conferences[getSipCallId(session)] = true;
|
|
439
441
|
}
|
|
440
442
|
const inviteOptions = {
|
|
441
443
|
requestDelegate: {
|
|
@@ -514,7 +516,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
514
516
|
try {
|
|
515
517
|
this._stopSendingStats(session);
|
|
516
518
|
this._cleanupMedia(session);
|
|
517
|
-
delete this.sipSessions[
|
|
519
|
+
delete this.sipSessions[getSipCallId(session)];
|
|
518
520
|
// Check if Invitation or Inviter (Invitation = incoming call)
|
|
519
521
|
const isInviter = session instanceof Inviter;
|
|
520
522
|
// @see github.com/onsip/SIP.js/blob/f11dfd584bc9788ccfc94e03034020672b738975/src/platform/web/simple-user/simple-user.ts#L1004
|
|
@@ -536,7 +538,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
536
538
|
}
|
|
537
539
|
// Fetch and emit an event at `interval` with session network stats
|
|
538
540
|
startNetworkMonitoring(session, interval = 1000) {
|
|
539
|
-
const sessionId =
|
|
541
|
+
const sessionId = getSipCallId(session);
|
|
540
542
|
logger.info('starting network inspection', {
|
|
541
543
|
id: sessionId,
|
|
542
544
|
clientId: this.clientId,
|
|
@@ -545,7 +547,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
545
547
|
this.networkMonitoringInterval[sessionId] = setInterval(() => this._fetchNetworkStats(sessionId), interval);
|
|
546
548
|
}
|
|
547
549
|
stopNetworkMonitoring(session) {
|
|
548
|
-
const sessionId =
|
|
550
|
+
const sessionId = getSipCallId(session);
|
|
549
551
|
const exists = (sessionId in this.networkMonitoringInterval);
|
|
550
552
|
logger.info('stopping network inspection', {
|
|
551
553
|
clientId: this.clientId,
|
|
@@ -669,7 +671,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
669
671
|
toggleVideo(session, true);
|
|
670
672
|
}
|
|
671
673
|
hold(session, isConference = false, hadVideo = false) {
|
|
672
|
-
const sessionId =
|
|
674
|
+
const sessionId = getSipCallId(session);
|
|
673
675
|
const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
|
|
674
676
|
logger.info('sdk webrtc hold', {
|
|
675
677
|
sessionId,
|
|
@@ -717,7 +719,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
717
719
|
});
|
|
718
720
|
}
|
|
719
721
|
unhold(session, isConference = false) {
|
|
720
|
-
const sessionId =
|
|
722
|
+
const sessionId = getSipCallId(session);
|
|
721
723
|
const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
|
|
722
724
|
logger.info('sdk webrtc unhold', {
|
|
723
725
|
sessionId,
|
|
@@ -732,7 +734,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
732
734
|
return Promise.resolve();
|
|
733
735
|
}
|
|
734
736
|
this.unmute(session);
|
|
735
|
-
delete this.heldSessions[
|
|
737
|
+
delete this.heldSessions[getSipCallId(session)];
|
|
736
738
|
session.sessionDescriptionHandlerOptionsReInvite = {
|
|
737
739
|
hold: false,
|
|
738
740
|
conference: isConference,
|
|
@@ -757,7 +759,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
757
759
|
return this.heldSessions[sessionId];
|
|
758
760
|
}
|
|
759
761
|
isCallHeld(session) {
|
|
760
|
-
return
|
|
762
|
+
return getSipCallId(session) in this.heldSessions;
|
|
761
763
|
}
|
|
762
764
|
isVideoRemotelyHeld(sessionId) {
|
|
763
765
|
return isVideoRemotelyHeld(this.heldSessions[sessionId]);
|
|
@@ -767,7 +769,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
767
769
|
return false;
|
|
768
770
|
}
|
|
769
771
|
logger.info('Sending DTMF', {
|
|
770
|
-
id:
|
|
772
|
+
id: getSipCallId(session),
|
|
771
773
|
tone,
|
|
772
774
|
});
|
|
773
775
|
return session.sessionDescriptionHandler.sendDtmf(tone);
|
|
@@ -784,7 +786,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
784
786
|
transfer(session, target) {
|
|
785
787
|
this.hold(session);
|
|
786
788
|
logger.info('Transfering a session', {
|
|
787
|
-
id:
|
|
789
|
+
id: getSipCallId(session),
|
|
788
790
|
target,
|
|
789
791
|
});
|
|
790
792
|
const options = {
|
|
@@ -807,21 +809,21 @@ export default class WebRTCClient extends Emitter {
|
|
|
807
809
|
atxfer(session) {
|
|
808
810
|
this.hold(session);
|
|
809
811
|
logger.info('webrtc transfer started', {
|
|
810
|
-
id:
|
|
812
|
+
id: getSipCallId(session),
|
|
811
813
|
});
|
|
812
814
|
const result = {
|
|
813
815
|
newSession: null,
|
|
814
816
|
init: async (target) => {
|
|
815
817
|
logger.info('webrtc transfer initialized', {
|
|
816
|
-
id:
|
|
818
|
+
id: getSipCallId(session),
|
|
817
819
|
target,
|
|
818
820
|
});
|
|
819
821
|
result.newSession = await this.call(target);
|
|
820
822
|
},
|
|
821
823
|
complete: () => {
|
|
822
824
|
logger.info('webrtc transfer completed', {
|
|
823
|
-
id:
|
|
824
|
-
referId:
|
|
825
|
+
id: getSipCallId(session),
|
|
826
|
+
referId: getSipCallId(result.newSession),
|
|
825
827
|
});
|
|
826
828
|
session.refer(result.newSession);
|
|
827
829
|
},
|
|
@@ -988,7 +990,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
988
990
|
}
|
|
989
991
|
const sdh = session.sessionDescriptionHandler;
|
|
990
992
|
const pc = sdh.peerConnection;
|
|
991
|
-
const sessionId =
|
|
993
|
+
const sessionId = getSipCallId(session);
|
|
992
994
|
const localStream = this.getLocalStream(sessionId);
|
|
993
995
|
logger.info('changing video input device', {
|
|
994
996
|
id,
|
|
@@ -1049,7 +1051,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
1049
1051
|
const desktop = newConstraints && newConstraints.desktop;
|
|
1050
1052
|
logger.info('Sending reinvite', {
|
|
1051
1053
|
clientId: this.clientId,
|
|
1052
|
-
id:
|
|
1054
|
+
id: getSipCallId(sipSession),
|
|
1053
1055
|
newConstraints,
|
|
1054
1056
|
conference,
|
|
1055
1057
|
audioOnly,
|
|
@@ -1083,7 +1085,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
1083
1085
|
sipSession.incomingInviteRequest.message.body = response.message.body;
|
|
1084
1086
|
}
|
|
1085
1087
|
logger.info('on re-INVITE accepted', {
|
|
1086
|
-
id:
|
|
1088
|
+
id: getSipCallId(sipSession),
|
|
1087
1089
|
wasMuted,
|
|
1088
1090
|
shouldDoScreenSharing,
|
|
1089
1091
|
});
|
|
@@ -1194,7 +1196,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
1194
1196
|
}
|
|
1195
1197
|
onCallEnded(session) {
|
|
1196
1198
|
this._cleanupMedia(session);
|
|
1197
|
-
delete this.sipSessions[
|
|
1199
|
+
delete this.sipSessions[getSipCallId(session)];
|
|
1198
1200
|
this._stopSendingStats(session);
|
|
1199
1201
|
this.stopNetworkMonitoring(session);
|
|
1200
1202
|
}
|
|
@@ -1207,14 +1209,14 @@ export default class WebRTCClient extends Emitter {
|
|
|
1207
1209
|
this.userAgent.attemptReconnection();
|
|
1208
1210
|
}
|
|
1209
1211
|
storeSipSession(session) {
|
|
1210
|
-
const id =
|
|
1212
|
+
const id = getSipCallId(session);
|
|
1211
1213
|
logger.info('storing sip session', { id, clientId: this.clientId });
|
|
1212
1214
|
this.sipSessions[id] = session;
|
|
1213
1215
|
}
|
|
1214
1216
|
getSipSession(id) {
|
|
1215
|
-
return id in this.sipSessions ? this.sipSessions[id.substring(0,
|
|
1217
|
+
return id in this.sipSessions ? this.sipSessions[id.substring(0, SIP_ID_MIN_LENGTH)] : null;
|
|
1216
1218
|
}
|
|
1217
|
-
|
|
1219
|
+
getSipCallIds() {
|
|
1218
1220
|
return Object.keys(this.sipSessions);
|
|
1219
1221
|
}
|
|
1220
1222
|
async updateLocalStream(sipSessionId, newStream) {
|
|
@@ -1369,7 +1371,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
1369
1371
|
}
|
|
1370
1372
|
// Invitation and Inviter extends Session
|
|
1371
1373
|
_setupSession(session) {
|
|
1372
|
-
const sipSessionId =
|
|
1374
|
+
const sipSessionId = getSipCallId(session);
|
|
1373
1375
|
// When receiving an Invitation, the delegate is not defined.
|
|
1374
1376
|
if (!session.delegate) {
|
|
1375
1377
|
session.delegate = {};
|
|
@@ -1432,7 +1434,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
1432
1434
|
}
|
|
1433
1435
|
async _onProgress(session, early = false) {
|
|
1434
1436
|
await this._setupMedias(session);
|
|
1435
|
-
const sessionId =
|
|
1437
|
+
const sessionId = getSipCallId(session).substr(0, 20);
|
|
1436
1438
|
updateRemoteStream(session);
|
|
1437
1439
|
logger.info('progress received', {
|
|
1438
1440
|
sessionId,
|
|
@@ -1486,7 +1488,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
1486
1488
|
return;
|
|
1487
1489
|
}
|
|
1488
1490
|
// Safari hack, because you cannot call .play() from a non user action
|
|
1489
|
-
const sessionId =
|
|
1491
|
+
const sessionId = getSipCallId(session);
|
|
1490
1492
|
const isConference = this.isConference(sessionId);
|
|
1491
1493
|
if (sessionId in this.audioElements) {
|
|
1492
1494
|
logger.info('html element already exists for session', {
|
|
@@ -1531,7 +1533,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
1531
1533
|
audioElement.play().catch(() => { });
|
|
1532
1534
|
}
|
|
1533
1535
|
_cleanupMedia(session) {
|
|
1534
|
-
const sessionId =
|
|
1536
|
+
const sessionId = getSipCallId(session);
|
|
1535
1537
|
const localStream = this.getLocalStream(sessionId);
|
|
1536
1538
|
if (localStream) {
|
|
1537
1539
|
cleanupStream(localStream);
|
|
@@ -1550,7 +1552,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
1550
1552
|
};
|
|
1551
1553
|
if (this._hasAudio() && isWeb()) {
|
|
1552
1554
|
if (session) {
|
|
1553
|
-
cleanLocalElement(
|
|
1555
|
+
cleanLocalElement(getSipCallId(session));
|
|
1554
1556
|
}
|
|
1555
1557
|
else {
|
|
1556
1558
|
Object.keys(this.audioElements).forEach(id => cleanLocalElement(id));
|
|
@@ -1570,7 +1572,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
1570
1572
|
if (!pc) {
|
|
1571
1573
|
return;
|
|
1572
1574
|
}
|
|
1573
|
-
const sessionId =
|
|
1575
|
+
const sessionId = getSipCallId(session);
|
|
1574
1576
|
getStats(pc, (result) => {
|
|
1575
1577
|
const { results, internal, nomore, ...stats } = result;
|
|
1576
1578
|
this.statsIntervals[sessionId] = nomore;
|
|
@@ -1581,7 +1583,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
1581
1583
|
}, SEND_STATS_DELAY);
|
|
1582
1584
|
}
|
|
1583
1585
|
_stopSendingStats(session) {
|
|
1584
|
-
const sessionId =
|
|
1586
|
+
const sessionId = getSipCallId(session);
|
|
1585
1587
|
logger.trace('Check for stopping stats', {
|
|
1586
1588
|
sessionId,
|
|
1587
1589
|
ids: Object.keys(this.statsIntervals),
|
|
@@ -126,4 +126,16 @@ describe('Call', () => {
|
|
|
126
126
|
expect(softphone_1.default.client.hangup).toHaveBeenCalled();
|
|
127
127
|
}));
|
|
128
128
|
});
|
|
129
|
+
describe('state propagation', () => {
|
|
130
|
+
it('Should update the call state in events', (done) => {
|
|
131
|
+
const call = new call_1.default(sipCall, softphone_1.default);
|
|
132
|
+
// @ts-ignore: private method
|
|
133
|
+
call._sendAction(call_state_machine_1.Actions.MAKE_CALL);
|
|
134
|
+
call.on('remotelyAccepted', () => {
|
|
135
|
+
expect(call.state).toStrictEqual({ [call_state_machine_1.States.ESTABLISHED]: call_state_machine_1.EstablishedStates.ONGOING });
|
|
136
|
+
done();
|
|
137
|
+
});
|
|
138
|
+
call.onAccepted();
|
|
139
|
+
});
|
|
140
|
+
});
|
|
129
141
|
});
|
|
@@ -43,7 +43,7 @@ exports.default = {
|
|
|
43
43
|
});
|
|
44
44
|
client.on(client.REGISTERED, () => {
|
|
45
45
|
const sipSession = client.call('*10');
|
|
46
|
-
if (!sipSession || !(0, sdp_1.
|
|
46
|
+
if (!sipSession || !(0, sdp_1.getSipCallId)(sipSession)) {
|
|
47
47
|
return handleError('Unable to make call through WebRTC');
|
|
48
48
|
}
|
|
49
49
|
setTimeout(() => {
|
|
@@ -283,7 +283,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
283
283
|
content: {
|
|
284
284
|
type: exports.ON_MESSAGE_TRACK_UPDATED,
|
|
285
285
|
update: isUpgrade ? 'upgrade' : 'downgrade',
|
|
286
|
-
sipCallId: sipSession && (0, sdp_1.
|
|
286
|
+
sipCallId: sipSession && (0, sdp_1.getSipCallId)(sipSession),
|
|
287
287
|
callId: callSession ? callSession.callId : null,
|
|
288
288
|
number: callSession ? callSession.number : null,
|
|
289
289
|
},
|
|
@@ -291,7 +291,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
291
291
|
}, 2500);
|
|
292
292
|
}
|
|
293
293
|
_bindEvents(sipSession) {
|
|
294
|
-
const sipSessionId = (0, sdp_1.
|
|
294
|
+
const sipSessionId = (0, sdp_1.getSipCallId)(sipSession);
|
|
295
295
|
if (sipSession instanceof api_1.Invitation) {
|
|
296
296
|
// Monkey patch to know when canceled with the CANCEL message
|
|
297
297
|
const onCancel = sipSession._onCancel.bind(sipSession);
|
|
@@ -345,7 +345,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
345
345
|
const [stream] = event.streams;
|
|
346
346
|
const kind = event && event.track && event.track.kind;
|
|
347
347
|
logger.info('on track stream called on the peer connection', {
|
|
348
|
-
callId: (0, sdp_1.
|
|
348
|
+
callId: (0, sdp_1.getSipCallId)(sipSession),
|
|
349
349
|
streamId: stream ? stream.id : null,
|
|
350
350
|
tracks: stream ? stream.getTracks() : null,
|
|
351
351
|
kind,
|
|
@@ -375,9 +375,9 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
375
375
|
}
|
|
376
376
|
const screenTrack = screenShareStream.getVideoTracks()[0];
|
|
377
377
|
const sipSession = this.currentSipSession;
|
|
378
|
-
const pc = sipSession && this.client.getPeerConnection((0, sdp_1.
|
|
378
|
+
const pc = sipSession && this.client.getPeerConnection((0, sdp_1.getSipCallId)(sipSession));
|
|
379
379
|
const sender = pc && pc.getSenders && pc.getSenders().find((s) => s && s.track && s.track.kind === 'video');
|
|
380
|
-
const localStream = sipSession && this.client.getLocalStream((0, sdp_1.
|
|
380
|
+
const localStream = sipSession && this.client.getLocalStream((0, sdp_1.getSipCallId)(sipSession));
|
|
381
381
|
const videoTrack = localStream ? localStream.getTracks().find(track => track.kind === 'video') : null;
|
|
382
382
|
const hadVideo = !!videoTrack;
|
|
383
383
|
// Stop local video tracks
|
|
@@ -442,19 +442,19 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
442
442
|
}
|
|
443
443
|
_onScreenSharing(screenStream, sipSession, callSession, hadVideo, desktop) {
|
|
444
444
|
const screenTrack = screenStream.getVideoTracks()[0];
|
|
445
|
-
const sipSessionId = (0, sdp_1.
|
|
445
|
+
const sipSessionId = (0, sdp_1.getSipCallId)(sipSession);
|
|
446
446
|
const pc = this.client.getPeerConnection(sipSessionId);
|
|
447
447
|
const sender = pc && pc.getSenders && pc.getSenders().find((s) => s && s.track && s.track.kind === 'video');
|
|
448
448
|
logger.info('WebRTC phone - on screensharing', {
|
|
449
449
|
hadVideo,
|
|
450
|
-
id: (0, sdp_1.
|
|
450
|
+
id: (0, sdp_1.getSipCallId)(sipSession),
|
|
451
451
|
screenTrack,
|
|
452
452
|
});
|
|
453
453
|
if (screenTrack) {
|
|
454
454
|
screenTrack.onended = () => {
|
|
455
455
|
logger.info('WebRTC phone - on screenshare ended', {
|
|
456
456
|
hadVideo,
|
|
457
|
-
id: (0, sdp_1.
|
|
457
|
+
id: (0, sdp_1.getSipCallId)(sipSession),
|
|
458
458
|
screenTrack,
|
|
459
459
|
});
|
|
460
460
|
this.eventEmitter.emit(exports.ON_SHARE_SCREEN_ENDING, this._createCallSession(sipSession, callSession));
|
|
@@ -488,7 +488,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
488
488
|
this.currentSipSession = sipSession;
|
|
489
489
|
this.currentCallSession = callSession;
|
|
490
490
|
this.eventEmitter.emit(exports.ON_TERMINATE_SOUND, callSession, 'call accepted');
|
|
491
|
-
const sipSessionId = (0, sdp_1.
|
|
491
|
+
const sipSessionId = (0, sdp_1.getSipCallId)(sipSession);
|
|
492
492
|
if (sipSessionId) {
|
|
493
493
|
this.removeIncomingSessions(sipSessionId);
|
|
494
494
|
}
|
|
@@ -551,7 +551,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
551
551
|
return this.currentSipSession && this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
|
|
552
552
|
}
|
|
553
553
|
_onCallTerminated(sipSession) {
|
|
554
|
-
const sipSessionId = (0, sdp_1.
|
|
554
|
+
const sipSessionId = (0, sdp_1.getSipCallId)(sipSession);
|
|
555
555
|
logger.info('WebRTC phone - on call terminated', {
|
|
556
556
|
sipId: sipSession.id,
|
|
557
557
|
sipSessionId,
|
|
@@ -643,7 +643,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
643
643
|
if (!this.currentSipSession) {
|
|
644
644
|
return false;
|
|
645
645
|
}
|
|
646
|
-
return this.currentSipSession && (0, sdp_1.
|
|
646
|
+
return this.currentSipSession && (0, sdp_1.getSipCallId)(this.currentSipSession) === callSession.getId();
|
|
647
647
|
}
|
|
648
648
|
hasVideo(callSession) {
|
|
649
649
|
return this.client.hasVideo(callSession.getId());
|
|
@@ -677,7 +677,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
677
677
|
logger.warn('no CallSession to accept.');
|
|
678
678
|
return Promise.resolve(null);
|
|
679
679
|
}
|
|
680
|
-
const sipSessionId = this.
|
|
680
|
+
const sipSessionId = this.getSipCallIdFromCallSession(callSession);
|
|
681
681
|
if (sipSessionId && !(sipSessionId in this.callSessions)) {
|
|
682
682
|
logger.warn('Call session already ended or not found, can\'t accept it.', {
|
|
683
683
|
sipSessionId,
|
|
@@ -709,7 +709,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
709
709
|
const error = 'No CallSession found to accept.';
|
|
710
710
|
logger.warn(error, {
|
|
711
711
|
id: callSession ? callSession.getId() : 'n/a',
|
|
712
|
-
ids: this.client.
|
|
712
|
+
ids: this.client.getSipCallIds(),
|
|
713
713
|
});
|
|
714
714
|
if (callSession) {
|
|
715
715
|
this.eventEmitter.emit(exports.ON_CALL_ERROR, new Error(error), callSession);
|
|
@@ -801,7 +801,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
801
801
|
if (!sipSession) {
|
|
802
802
|
return new Promise((resolve, reject) => reject(new Error('No session to hold')));
|
|
803
803
|
}
|
|
804
|
-
const sessionId = (0, sdp_1.
|
|
804
|
+
const sessionId = (0, sdp_1.getSipCallId)(sipSession);
|
|
805
805
|
const hasVideo = this.client.hasLocalVideo(sessionId);
|
|
806
806
|
logger.info('WebRTC hold sip session', {
|
|
807
807
|
sipId: sipSession.id,
|
|
@@ -830,7 +830,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
830
830
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
831
831
|
}
|
|
832
832
|
const isConference = !!callSession && callSession.isConference();
|
|
833
|
-
const sessionId = (0, sdp_1.
|
|
833
|
+
const sessionId = (0, sdp_1.getSipCallId)(sipSession);
|
|
834
834
|
logger.info('WebRTC unhold sip session', {
|
|
835
835
|
sessionId,
|
|
836
836
|
isConference,
|
|
@@ -1059,7 +1059,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
1059
1059
|
console.error('Call is unknown to the WebRTC phone', callSession ? callSession.sipCallId : null, callSession ? callSession.callId : null);
|
|
1060
1060
|
return false;
|
|
1061
1061
|
}
|
|
1062
|
-
const sipSessionId = (0, sdp_1.
|
|
1062
|
+
const sipSessionId = (0, sdp_1.getSipCallId)(sipSession);
|
|
1063
1063
|
logger.info('WebRTC hangup', {
|
|
1064
1064
|
sipId: sipSession.id,
|
|
1065
1065
|
sipSessionId,
|
|
@@ -1251,12 +1251,12 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
1251
1251
|
// if `_createCallSession` is called too soon `hasVideo` will return false because the stream doesn't exists yet
|
|
1252
1252
|
setTimeout(() => {
|
|
1253
1253
|
// Update callSession
|
|
1254
|
-
this._createCallSession(sipSession, this.callSessions[(0, sdp_1.
|
|
1254
|
+
this._createCallSession(sipSession, this.callSessions[(0, sdp_1.getSipCallId)(sipSession)]);
|
|
1255
1255
|
this.eventEmitter.emit.apply(this.eventEmitter, [this.client.ON_REINVITE, ...args]);
|
|
1256
1256
|
}, 2000);
|
|
1257
1257
|
});
|
|
1258
1258
|
this.client.on(this.client.ACCEPTED, (sipSession) => __awaiter(this, void 0, void 0, function* () {
|
|
1259
|
-
const sessionId = (0, sdp_1.
|
|
1259
|
+
const sessionId = (0, sdp_1.getSipCallId)(sipSession);
|
|
1260
1260
|
const hasSession = (sessionId in this.callSessions);
|
|
1261
1261
|
logger.info('WebRTC call accepted', {
|
|
1262
1262
|
sipId: sessionId,
|
|
@@ -1283,7 +1283,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
1283
1283
|
const callSession = this._createCallSession(session);
|
|
1284
1284
|
// `_createCallSession` add the CallSession in `this.callSessions`.
|
|
1285
1285
|
// so we have to remove it or `callCount` will always return 1 even if the call was rejected
|
|
1286
|
-
delete this.callSessions[(0, sdp_1.
|
|
1286
|
+
delete this.callSessions[(0, sdp_1.getSipCallId)(session)];
|
|
1287
1287
|
callSession.endTime = new Date();
|
|
1288
1288
|
this.eventEmitter.emit(exports.ON_CALL_REJECTED, callSession);
|
|
1289
1289
|
});
|
|
@@ -1300,7 +1300,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
1300
1300
|
const callSession = this._createCallSession(session, null, {
|
|
1301
1301
|
incoming: false,
|
|
1302
1302
|
ringing: true,
|
|
1303
|
-
callId: (0, sdp_1.
|
|
1303
|
+
callId: (0, sdp_1.getSipCallId)(session),
|
|
1304
1304
|
});
|
|
1305
1305
|
this.eventEmitter.emit(exports.ON_PROGRESS, callSession, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
1306
1306
|
});
|
|
@@ -1309,7 +1309,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
1309
1309
|
const callSession = this._createCallSession(session, null, {
|
|
1310
1310
|
incoming: false,
|
|
1311
1311
|
ringing: true,
|
|
1312
|
-
callId: (0, sdp_1.
|
|
1312
|
+
callId: (0, sdp_1.getSipCallId)(session),
|
|
1313
1313
|
});
|
|
1314
1314
|
this.eventEmitter.emit(exports.ON_EARLY_MEDIA, callSession, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
1315
1315
|
});
|
|
@@ -1366,12 +1366,12 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
1366
1366
|
this.eventEmitter.emit(exports.ON_MESSAGE, message);
|
|
1367
1367
|
});
|
|
1368
1368
|
this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
|
|
1369
|
-
const callSession = this.getCallSession((0, sdp_1.
|
|
1369
|
+
const callSession = this.getCallSession((0, sdp_1.getSipCallId)(session));
|
|
1370
1370
|
this.eventEmitter.emit(exports.ON_NETWORK_STATS, callSession, stats, previousStats);
|
|
1371
1371
|
});
|
|
1372
1372
|
// Used when upgrading directly in screenshare mode
|
|
1373
1373
|
this.client.on(this.client.ON_SCREEN_SHARING_REINVITE, (sipSession, response, desktop) => {
|
|
1374
|
-
const sipSessionId = (0, sdp_1.
|
|
1374
|
+
const sipSessionId = (0, sdp_1.getSipCallId)(sipSession);
|
|
1375
1375
|
const localStream = this.client.getLocalStream(sipSessionId);
|
|
1376
1376
|
const callSession = this.callSessions[sipSessionId];
|
|
1377
1377
|
logger.info('Updrading directly in screensharing mode', {
|
|
@@ -1383,10 +1383,10 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
1383
1383
|
}
|
|
1384
1384
|
// Find a corresponding sipSession from a CallSession
|
|
1385
1385
|
findSipSession(callSession) {
|
|
1386
|
-
const keys = this.client.
|
|
1386
|
+
const keys = this.client.getSipCallIds();
|
|
1387
1387
|
const keyIndex = keys.findIndex(sessionId => callSession && callSession.isId(sessionId));
|
|
1388
1388
|
if (keyIndex === -1) {
|
|
1389
|
-
const currentSipSessionId = this.currentSipSession ? (0, sdp_1.
|
|
1389
|
+
const currentSipSessionId = this.currentSipSession ? (0, sdp_1.getSipCallId)(this.currentSipSession) : this.client.getSipCallIds()[0];
|
|
1390
1390
|
return currentSipSessionId ? this.client.getSipSession(currentSipSessionId) : null;
|
|
1391
1391
|
}
|
|
1392
1392
|
return this.client.getSipSession(keys[keyIndex]);
|
|
@@ -1394,12 +1394,12 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
1394
1394
|
getCallSession(sipSessionId) {
|
|
1395
1395
|
return this.callSessions[sipSessionId];
|
|
1396
1396
|
}
|
|
1397
|
-
|
|
1397
|
+
getSipCallIdFromCallSession(callSession) {
|
|
1398
1398
|
const sipSession = this.findSipSession(callSession);
|
|
1399
|
-
return sipSession ? (0, sdp_1.
|
|
1399
|
+
return sipSession ? (0, sdp_1.getSipCallId)(sipSession) : null;
|
|
1400
1400
|
}
|
|
1401
1401
|
_updateCallSession(callSession) {
|
|
1402
|
-
const sipSessionId = this.
|
|
1402
|
+
const sipSessionId = this.getSipCallIdFromCallSession(callSession);
|
|
1403
1403
|
if (sipSessionId) {
|
|
1404
1404
|
this.callSessions[sipSessionId] = callSession;
|
|
1405
1405
|
}
|
|
@@ -1472,7 +1472,7 @@ class WebRTCPhone extends Emitter_1.default {
|
|
|
1472
1472
|
const number = (0, sdp_1.getCallNumber)(sipSession);
|
|
1473
1473
|
const displayName = (0, sdp_1.getCallDisplayName)(sipSession);
|
|
1474
1474
|
const { state } = sipSession || {};
|
|
1475
|
-
const sessionId = (0, sdp_1.
|
|
1475
|
+
const sessionId = (0, sdp_1.getSipCallId)(sipSession);
|
|
1476
1476
|
fromSession = fromSession || this.callSessions[sessionId];
|
|
1477
1477
|
const callSession = new CallSession_1.default(Object.assign({ callId: fromSession && fromSession.callId, sipCallId: sessionId, sipStatus: state, displayName,
|
|
1478
1478
|
// @ts-ignore: date / number
|