@wazo/sdk 0.43.7 → 0.43.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -73,7 +73,6 @@ const array_1 = require("./utils/array");
73
73
  // We need to replace 0.0.0.0 to 127.0.0.1 in the sdp to avoid MOH during a createOffer.
74
74
  const replaceLocalIpModifier = (description) => Promise.resolve(Object.assign(Object.assign({}, JSON.parse(JSON.stringify(description))), { sdp: description.sdp.replace('c=IN IP4 0.0.0.0', 'c=IN IP4 127.0.0.1') }));
75
75
  exports.replaceLocalIpModifier = replaceLocalIpModifier;
76
- const SIP_ID_LENGTH = 36;
77
76
  const DEFAULT_ICE_TIMEOUT = 3000;
78
77
  const SEND_STATS_DELAY = 5000;
79
78
  const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
@@ -195,7 +194,7 @@ class WebRTCClient extends Emitter_1.default {
195
194
  logger.info('sdk webrtc on invite', {
196
195
  method: 'delegate.onInvite',
197
196
  clientId: this.clientId,
198
- id: invitation.id,
197
+ id: this.getSipSessionId(invitation),
199
198
  remoteURI: invitation.remoteURI,
200
199
  });
201
200
  this._setupSession(invitation);
@@ -485,7 +484,7 @@ class WebRTCClient extends Emitter_1.default {
485
484
  },
486
485
  onReject: (response) => {
487
486
  logger.info('on call rejected', {
488
- id: session === null || session === void 0 ? void 0 : session.id,
487
+ id: this.getSipSessionId(session),
489
488
  // @ts-ignore: fromTag does not exist
490
489
  fromTag: session === null || session === void 0 ? void 0 : session.fromTag,
491
490
  });
@@ -515,7 +514,7 @@ class WebRTCClient extends Emitter_1.default {
515
514
  answer(session, enableVideo) {
516
515
  logger.info('sdk webrtc answer call', {
517
516
  clientId: this.clientId,
518
- id: session.id,
517
+ id: this.getSipSessionId(session),
519
518
  enableVideo,
520
519
  });
521
520
  if (!session || !session.accept) {
@@ -531,7 +530,7 @@ class WebRTCClient extends Emitter_1.default {
531
530
  if (session.isCanceled) {
532
531
  const message = 'accepted a canceled session (or was canceled during the accept phase).';
533
532
  logger.error(message, {
534
- id: session.id,
533
+ id: this.getSipSessionId(session),
535
534
  });
536
535
  this.onCallEnded(session);
537
536
  throw new CanceledCallError(message);
@@ -539,7 +538,7 @@ class WebRTCClient extends Emitter_1.default {
539
538
  logger.info('sdk webrtc answer, accepted.');
540
539
  this._onAccepted(session);
541
540
  }).catch(e => {
542
- logger.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
541
+ logger.error(`answer call error for ${this.getSipSessionId(session)}`, e);
543
542
  throw e;
544
543
  });
545
544
  }
@@ -609,7 +608,7 @@ class WebRTCClient extends Emitter_1.default {
609
608
  return __awaiter(this, void 0, void 0, function* () {
610
609
  logger.info('sdk webrtc reject call', {
611
610
  clientId: this.clientId,
612
- id: session.id,
611
+ id: this.getSipSessionId(session),
613
612
  });
614
613
  try {
615
614
  if (session instanceof api_1.Invitation) {
@@ -673,13 +672,13 @@ class WebRTCClient extends Emitter_1.default {
673
672
  }
674
673
  mute(session) {
675
674
  logger.info('sdk webrtc mute', {
676
- id: session.id,
675
+ id: this.getSipSessionId(session),
677
676
  });
678
677
  this._toggleAudio(session, true);
679
678
  }
680
679
  unmute(session) {
681
680
  logger.info('sdk webrtc unmute', {
682
- id: session.id,
681
+ id: this.getSipSessionId(session),
683
682
  });
684
683
  this._toggleAudio(session, false);
685
684
  }
@@ -716,13 +715,13 @@ class WebRTCClient extends Emitter_1.default {
716
715
  }
717
716
  toggleCameraOn(session) {
718
717
  logger.info('sdk webrtc toggle camera on', {
719
- id: session.id,
718
+ id: this.getSipSessionId(session),
720
719
  });
721
720
  this._toggleVideo(session, false);
722
721
  }
723
722
  toggleCameraOff(session) {
724
723
  logger.info('sdk webrtc toggle camera off', {
725
- id: session.id,
724
+ id: this.getSipSessionId(session),
726
725
  });
727
726
  this._toggleVideo(session, true);
728
727
  }
@@ -979,7 +978,7 @@ class WebRTCClient extends Emitter_1.default {
979
978
  return;
980
979
  }
981
980
  logger.info('send WebRTC message', {
982
- sipId: sipSession.id,
981
+ sipId: this.getSipSessionId(sipSession),
983
982
  contentType,
984
983
  });
985
984
  try {
@@ -1344,18 +1343,19 @@ class WebRTCClient extends Emitter_1.default {
1344
1343
  if (!sipSession) {
1345
1344
  return '';
1346
1345
  }
1347
- const message = sipSession.message;
1348
- if (message === null || message === void 0 ? void 0 : message.callId) {
1349
- return message.callId.substring(0, SIP_ID_LENGTH);
1350
- }
1351
1346
  // For Inviter
1352
1347
  // @ts-ignore: private
1353
1348
  if (sipSession instanceof api_1.Inviter && sipSession.outgoingRequestMessage) {
1354
1349
  // @ts-ignore: private
1355
- return sipSession.outgoingRequestMessage.callId.substring(0, SIP_ID_LENGTH);
1350
+ return sipSession.outgoingRequestMessage.callId;
1356
1351
  }
1357
1352
  // For Invitation
1358
- return (sipSession.id || '').substring(0, SIP_ID_LENGTH);
1353
+ // @ts-ignore: private
1354
+ if (sipSession instanceof api_1.Invitation && sipSession.incomingInviteRequest.message) {
1355
+ // @ts-ignore: private
1356
+ return sipSession.incomingInviteRequest.message.callId;
1357
+ }
1358
+ return '';
1359
1359
  }
1360
1360
  waitForRegister() {
1361
1361
  return __awaiter(this, void 0, void 0, function* () {
@@ -1415,7 +1415,7 @@ class WebRTCClient extends Emitter_1.default {
1415
1415
  this.sipSessions[id] = session;
1416
1416
  }
1417
1417
  getSipSession(id) {
1418
- return id in this.sipSessions ? this.sipSessions[id.substring(0, SIP_ID_LENGTH)] : null;
1418
+ return id in this.sipSessions ? this.sipSessions[id] : null;
1419
1419
  }
1420
1420
  getSipSessionIds() {
1421
1421
  return Object.keys(this.sipSessions);
@@ -1791,7 +1791,7 @@ class WebRTCClient extends Emitter_1.default {
1791
1791
  _onProgress(session_1) {
1792
1792
  return __awaiter(this, arguments, void 0, function* (session, early = false) {
1793
1793
  yield this._setupMedias(session);
1794
- const sessionId = this.getSipSessionId(session).substr(0, 20);
1794
+ const sessionId = this.getSipSessionId(session);
1795
1795
  this.updateRemoteStream(sessionId);
1796
1796
  logger.info('progress received', {
1797
1797
  sessionId,
@@ -1804,7 +1804,7 @@ class WebRTCClient extends Emitter_1.default {
1804
1804
  return __awaiter(this, arguments, void 0, function* (session, sessionDialog, withEvent = true, initAllTracks = true) {
1805
1805
  var _a;
1806
1806
  logger.info('on call accepted', {
1807
- id: session.id,
1807
+ id: this.getSipSessionId(session),
1808
1808
  clientId: this.clientId,
1809
1809
  remoteTag: session.remoteTag,
1810
1810
  });
@@ -2161,18 +2161,18 @@ class WebRTCClient extends Emitter_1.default {
2161
2161
  return __awaiter(this, arguments, void 0, function* (session, options = {}) {
2162
2162
  if (session.state === session_state_1.SessionState.Terminated || session.state === session_state_1.SessionState.Terminating) {
2163
2163
  const error = 'Trying to accept a terminated sipSession.';
2164
- logger.warn(error, { state: session.state, sessionId: session.id });
2164
+ logger.warn(error, { state: session.state, sessionId: this.getSipSessionId(session) });
2165
2165
  throw new Error(error);
2166
2166
  }
2167
2167
  if (session.state !== session_state_1.SessionState.Initial) {
2168
2168
  const error = 'Trying to accept a non Initial sipSession.';
2169
- logger.warn(error, { state: session.state, sessionId: session.id });
2169
+ logger.warn(error, { state: session.state, sessionId: this.getSipSessionId(session) });
2170
2170
  throw new Error(error);
2171
2171
  }
2172
2172
  // @ts-ignore: private
2173
2173
  if (!session.incomingInviteRequest.acceptable) {
2174
2174
  const error = 'Trying to reject a non `acceptable` session';
2175
- logger.warn(error, { state: session.state, sessionId: session.id });
2175
+ logger.warn(error, { state: session.state, sessionId: this.getSipSessionId(session) });
2176
2176
  throw new Error(error);
2177
2177
  }
2178
2178
  try {
@@ -2186,12 +2186,12 @@ class WebRTCClient extends Emitter_1.default {
2186
2186
  _reject(session_1) {
2187
2187
  return __awaiter(this, arguments, void 0, function* (session, options = {}) {
2188
2188
  if (session.state !== session_state_1.SessionState.Initial && session.state !== session_state_1.SessionState.Establishing) {
2189
- logger.warn('Trying to reject a session in a wrong state', { state: session.state, sessionId: session.id });
2189
+ logger.warn('Trying to reject a session in a wrong state', { state: session.state, sessionId: this.getSipSessionId(session) });
2190
2190
  return;
2191
2191
  }
2192
2192
  // @ts-ignore: private
2193
2193
  if (!session.incomingInviteRequest.rejectable) {
2194
- logger.warn('Trying to reject a non `rejectable` session', { state: session.state, sessionId: session.id });
2194
+ logger.warn('Trying to reject a non `rejectable` session', { state: session.state, sessionId: this.getSipSessionId(session) });
2195
2195
  return;
2196
2196
  }
2197
2197
  try {
@@ -2205,7 +2205,7 @@ class WebRTCClient extends Emitter_1.default {
2205
2205
  _cancel(session_1) {
2206
2206
  return __awaiter(this, arguments, void 0, function* (session, options = {}) {
2207
2207
  if (session.state !== session_state_1.SessionState.Initial && session.state !== session_state_1.SessionState.Establishing) {
2208
- logger.warn('Trying to cancel a session in a wrong state', { state: session.state, sessionId: session.id });
2208
+ logger.warn('Trying to cancel a session in a wrong state', { state: session.state, sessionId: this.getSipSessionId(session) });
2209
2209
  return;
2210
2210
  }
2211
2211
  try {
@@ -2219,7 +2219,7 @@ class WebRTCClient extends Emitter_1.default {
2219
2219
  _bye(session_1) {
2220
2220
  return __awaiter(this, arguments, void 0, function* (session, options = {}) {
2221
2221
  if (session.state !== session_state_1.SessionState.Established) {
2222
- logger.warn('Trying to end a session in a wrong state', { state: session.state, sessionId: session.id });
2222
+ logger.warn('Trying to end a session in a wrong state', { state: session.state, sessionId: this.getSipSessionId(session) });
2223
2223
  return null;
2224
2224
  }
2225
2225
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wazo/sdk",
3
- "version": "0.43.7",
3
+ "version": "0.43.9",
4
4
  "description": "Wazo's JavaScript Software Development Kit.",
5
5
  "main": "index.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -118,8 +118,7 @@ export default class CallLog {
118
118
 
119
119
  static parseNew(plain: CallLogResponse, session: Session): CallLog {
120
120
  const callLog: CallLog = CallLog.parse(plain);
121
- // @TODO: FIXME add verification declined vs missed call
122
- callLog.newMissedCall = session && session.hasExtension((plain.requested_extension || plain.destination_extension) as string) && !plain.answered;
121
+ callLog.newMissedCall = session && plain.destination_user_uuid === session.uuid && !plain.answered;
123
122
  return callLog;
124
123
  }
125
124
 
@@ -203,7 +202,7 @@ export default class CallLog {
203
202
  }
204
203
 
205
204
  isAnOutgoingCall(session: Session): boolean {
206
- console.warn(`@wazo/sdk
205
+ console.warn(`@wazo/sdk
207
206
  CallLog.isAnOutgoingcall(session) method is obsolete.
208
207
  Please use CallLog.isOutgoing(session).
209
208
  `);
@@ -8,7 +8,7 @@ import { Inviter, Invitation, Session, SessionDescriptionHandlerOptions } from '
8
8
  import { SessionDescriptionHandler } from 'sip.js/lib/platform/web';
9
9
  import CallSession from '../CallSession';
10
10
  import type { Phone, AvailablePhoneOptions } from './Phone';
11
- import WazoWebRTCClient from '../../web-rtc-client';
11
+ import WebRTCClient from '../../web-rtc-client';
12
12
  import Emitter from '../../utils/Emitter';
13
13
  import IssueReporter from '../../service/IssueReporter';
14
14
  import { PeerConnection, WazoSession } from '../types';
@@ -60,7 +60,7 @@ export const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
60
60
  export const events = [ON_USER_AGENT, ON_REGISTERED, ON_UNREGISTERED, ON_PROGRESS, ON_CALL_ACCEPTED, ON_CALL_ANSWERED, ON_CALL_INCOMING, ON_CALL_OUTGOING, ON_CALL_MUTED, ON_CALL_UNMUTED, ON_CALL_RESUMED, ON_CALL_HELD, ON_CALL_UNHELD, ON_CAMERA_DISABLED, ON_CALL_FAILED, ON_CALL_ENDED, ON_CALL_REJECTED, ON_MESSAGE, ON_REINVITE, ON_TRACK, ON_AUDIO_STREAM, ON_VIDEO_STREAM, ON_REMOVE_STREAM, ON_SHARE_SCREEN_ENDED, ON_TERMINATE_SOUND, ON_PLAY_RING_SOUND, ON_PLAY_INBOUND_CALL_SIGNAL_SOUND, ON_PLAY_HANGUP_SOUND, ON_PLAY_PROGRESS_SOUND, ON_VIDEO_INPUT_CHANGE, ON_SHARE_SCREEN_STARTED, ON_CALL_ERROR, ON_CHAT, ON_SIGNAL, ON_NETWORK_STATS, ON_DISCONNECTED, ON_EARLY_MEDIA];
61
61
  const logger = IssueReporter.loggerFor('webrtc-phone');
62
62
  export default class WebRTCPhone extends Emitter implements Phone {
63
- client: WazoWebRTCClient;
63
+ client: WebRTCClient;
64
64
 
65
65
  allowVideo: boolean;
66
66
 
@@ -94,7 +94,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
94
94
 
95
95
  shouldSendReinvite: boolean;
96
96
 
97
- constructor(client: WazoWebRTCClient, audioOutputDeviceId: string | undefined, allowVideo = false, audioRingDeviceId?: string) {
97
+ constructor(client: WebRTCClient, audioOutputDeviceId: string | undefined, allowVideo = false, audioRingDeviceId?: string) {
98
98
  super();
99
99
  this.client = client;
100
100
  this.allowVideo = allowVideo;
@@ -159,7 +159,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
159
159
  async sendReinvite(callSession?: CallSession, constraints: Record<string, any> | null | undefined = null, conference = false, audioOnly = false, iceRestart = false): Promise<OutgoingInviteRequest | void> {
160
160
  const sipSession = this.findSipSession(callSession);
161
161
  logger.info('WebRTC phone - send reinvite', {
162
- sessionId: sipSession ? sipSession.id : null,
162
+ sessionId: this.getSipSessionId(sipSession),
163
163
  constraints,
164
164
  audioOnly,
165
165
  conference,
@@ -380,7 +380,9 @@ export default class WebRTCPhone extends Emitter implements Phone {
380
380
  const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
381
381
  const callSession = this._createCallSession(sipSession);
382
382
 
383
- delete this.callSessions[sipSessionId];
383
+ if (sipSessionId) {
384
+ delete this.callSessions[sipSessionId];
385
+ }
384
386
  this.eventEmitter.emit(ON_CALL_CANCELED, callSession, elsewhere);
385
387
  };
386
388
  }
@@ -389,7 +391,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
389
391
  switch (newState) {
390
392
  case SessionState.Terminating:
391
393
  logger.info('WebRTC phone - call terminating', {
392
- sipId: sipSession.id,
394
+ sipId: this.getSipSessionId(sipSession),
393
395
  });
394
396
  this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
395
397
  break;
@@ -397,7 +399,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
397
399
  case SessionState.Terminated:
398
400
  {
399
401
  logger.info('WebRTC phone - call terminated', {
400
- sipId: sipSession.id,
402
+ sipId: this.getSipSessionId(sipSession),
401
403
  });
402
404
 
403
405
  // Should be called before `_onCallTerminated` or the callCount will not decrement...
@@ -580,7 +582,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
580
582
 
581
583
  _onCallAccepted(sipSession: WazoSession, cameraEnabled: boolean): CallSession {
582
584
  logger.info('WebRTC phone - on call accepted', {
583
- sipId: sipSession.id,
585
+ sipId: this.getSipSessionId(sipSession),
584
586
  cameraEnabled,
585
587
  });
586
588
 
@@ -588,7 +590,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
588
590
 
589
591
  if (this.currentSipSession && !this.isCurrentCallSipSession(callSession)) {
590
592
  logger.info('WebRTC phone - on call accepted with another ongoing call, holding it', {
591
- sipId: sipSession.id,
593
+ sipId: this.getSipSessionId(sipSession),
592
594
  cameraEnabled,
593
595
  });
594
596
 
@@ -673,7 +675,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
673
675
  const sipSessionId = this.getSipSessionId(sipSession);
674
676
 
675
677
  logger.info('WebRTC phone - on call terminated', {
676
- sipId: sipSession.id,
678
+ sipId: this.getSipSessionId(sipSession),
677
679
  sipSessionId,
678
680
  ids: Object.keys(this.callSessions),
679
681
  });
@@ -697,9 +699,9 @@ export default class WebRTCPhone extends Emitter implements Phone {
697
699
 
698
700
  if (sipSessionId) {
699
701
  this.removeIncomingSessions(sipSessionId);
700
- }
701
702
 
702
- delete this.callSessions[sipSessionId];
703
+ delete this.callSessions[sipSessionId];
704
+ }
703
705
 
704
706
  if (isCurrentSession) {
705
707
  this.currentSipSession = undefined;
@@ -709,7 +711,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
709
711
  const hasIncomingCallSession = this.hasIncomingCallSession();
710
712
  // Re-trigger incoming call event for remaining incoming calls
711
713
  logger.info('WebRTC phone - check to re-trigger incoming call', {
712
- sipId: sipSession.id,
714
+ sipId: this.getSipSessionId(sipSession),
713
715
  shouldRetrigger,
714
716
  hasIncomingCallSession,
715
717
  });
@@ -853,7 +855,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
853
855
  const sipSession = this.client.getSipSession(callSession.getId()) as Invitation;
854
856
 
855
857
  if (sipSession) {
856
- logger.info('accept call, session found', { sipId: sipSession.id });
858
+ logger.info('accept call, session found', { sipId: this.getSipSessionId(sipSession) });
857
859
 
858
860
  return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
859
861
  return callSession.sipCallId;
@@ -898,7 +900,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
898
900
 
899
901
  if (sipSession) {
900
902
  logger.info('WebRTC rejecting', {
901
- sipId: sipSession.id,
903
+ sipId: this.getSipSessionId(sipSession),
902
904
  });
903
905
  this.client.hangup(sipSession);
904
906
  }
@@ -919,7 +921,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
919
921
 
920
922
  if (sipSession) {
921
923
  logger.info('WebRTC atxfer', {
922
- sipId: sipSession.id,
924
+ sipId: this.getSipSessionId(sipSession),
923
925
  });
924
926
  return this.client.atxfer(sipSession);
925
927
  }
@@ -950,13 +952,13 @@ export default class WebRTCPhone extends Emitter implements Phone {
950
952
  }
951
953
 
952
954
  logger.info('WebRTC resuming', {
953
- sipId: sipSession.id,
955
+ sipId: this.getSipSessionId(sipSession),
954
956
  });
955
957
 
956
958
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
957
- if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
959
+ if (this.currentSipSession && this.getSipSessionId(this.currentSipSession) !== this.getSipSessionId(sipSession)) {
958
960
  logger.info('WebRTC hold call after resume', {
959
- id: this.currentSipSession.id,
961
+ id: this.getSipSessionId(this.currentSipSession),
960
962
  });
961
963
  this.holdSipSession(this.currentSipSession, this.currentCallSession, withEvent);
962
964
  }
@@ -979,7 +981,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
979
981
  const sessionId = this.getSipSessionId(sipSession);
980
982
  const hasVideo = this.client.hasLocalVideo(sessionId);
981
983
  logger.info('WebRTC hold sip session', {
982
- sipId: sipSession.id,
984
+ sipId: this.getSipSessionId(sipSession),
983
985
  hasVideo,
984
986
  });
985
987
 
@@ -1076,7 +1078,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
1076
1078
  }
1077
1079
 
1078
1080
  logger.info('WebRTC muting', {
1079
- sipId: sipSession.id,
1081
+ sipId: this.getSipSessionId(sipSession),
1080
1082
  });
1081
1083
  this.client.mute(sipSession);
1082
1084
 
@@ -1104,7 +1106,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
1104
1106
  }
1105
1107
 
1106
1108
  logger.info('WebRTC unmuting', {
1107
- sipId: sipSession.id,
1109
+ sipId: this.getSipSessionId(sipSession),
1108
1110
  });
1109
1111
  this.client.unmute(sipSession);
1110
1112
 
@@ -1139,7 +1141,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
1139
1141
  }
1140
1142
 
1141
1143
  logger.info('WebRTC turn camera on', {
1142
- sipId: sipSession.id,
1144
+ sipId: this.getSipSessionId(sipSession),
1143
1145
  });
1144
1146
  this.client.toggleCameraOn(sipSession);
1145
1147
  this.eventEmitter.emit(ON_CAMERA_RESUMED, this._createCameraResumedCallSession(sipSession, callSession));
@@ -1153,7 +1155,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
1153
1155
  }
1154
1156
 
1155
1157
  logger.info('WebRTC turn camera off', {
1156
- sipId: sipSession.id,
1158
+ sipId: this.getSipSessionId(sipSession),
1157
1159
  });
1158
1160
  this.client.toggleCameraOff(sipSession);
1159
1161
  this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
@@ -1167,7 +1169,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
1167
1169
  }
1168
1170
 
1169
1171
  logger.info('WebRTC send key', {
1170
- sipId: sipSession.id,
1172
+ sipId: this.getSipSessionId(sipSession),
1171
1173
  tone,
1172
1174
  });
1173
1175
  this.client.sendDTMF(sipSession, tone);
@@ -1245,7 +1247,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
1245
1247
  }
1246
1248
 
1247
1249
  logger.info('WebRTC transfer', {
1248
- sipId: sipSession.id,
1250
+ sipId: this.getSipSessionId(sipSession),
1249
1251
  target,
1250
1252
  });
1251
1253
  this.client.transfer(sipSession, target);
@@ -1255,8 +1257,8 @@ export default class WebRTCPhone extends Emitter implements Phone {
1255
1257
  const sipSession = this.client.getSipSession(source.sipCallId);
1256
1258
  const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
1257
1259
  logger.info('WebRTC indirect transfer', {
1258
- sipId: sipSession ? sipSession.id : null,
1259
- target: sipSessionTarget ? sipSessionTarget.id : null,
1260
+ sipId: sipSession ? this.getSipSessionId(sipSession) : null,
1261
+ target: sipSessionTarget ? this.getSipSessionId(sipSessionTarget) : null,
1260
1262
  });
1261
1263
 
1262
1264
  if (!sipSessionTarget) {
@@ -1295,7 +1297,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
1295
1297
  const sipSessionId = this.getSipSessionId(sipSession);
1296
1298
 
1297
1299
  logger.info('WebRTC hangup', {
1298
- sipId: sipSession.id,
1300
+ sipId: this.getSipSessionId(sipSession),
1299
1301
  sipSessionId,
1300
1302
  });
1301
1303
  await this.client.hangup(sipSession);
@@ -1484,7 +1486,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
1484
1486
  const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
1485
1487
  const withVideo = this.allowVideo ? wantsToDoVideo : false;
1486
1488
  logger.info('WebRTC invite received', {
1487
- sipId: sipSession.id,
1489
+ sipId: this.getSipSessionId(sipSession),
1488
1490
  withVideo,
1489
1491
  autoAnswer,
1490
1492
  });
@@ -1555,7 +1557,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
1555
1557
  this.eventEmitter.emit(ON_CALL_ERROR, e);
1556
1558
  });
1557
1559
  this.client.on(this.client.REJECTED, session => {
1558
- logger.info('WebRTC call rejected', session.id);
1560
+ logger.info('WebRTC call rejected', { id: this.getSipSessionId(session) });
1559
1561
 
1560
1562
  const callSession = this._createCallSession(session);
1561
1563
 
@@ -1687,7 +1689,10 @@ export default class WebRTCPhone extends Emitter implements Phone {
1687
1689
  return this.callSessions[sipSessionId];
1688
1690
  }
1689
1691
 
1690
- getSipSessionId(sipSession: WazoSession): string {
1692
+ getSipSessionId(sipSession: WazoSession | null | undefined): string {
1693
+ if (!sipSession) {
1694
+ return '';
1695
+ }
1691
1696
  return this.client.getSipSessionId(sipSession);
1692
1697
  }
1693
1698
 
@@ -6,7 +6,7 @@ import type CallSession from '../domain/CallSession';
6
6
  import AdHocAPIConference from '../domain/AdHocAPIConference';
7
7
  import WebRTCPhone, * as PHONE_EVENTS from '../domain/Phone/WebRTCPhone';
8
8
  import { MESSAGE_TYPE_CHAT, MESSAGE_TYPE_SIGNAL } from '../domain/Phone/WebRTCPhone';
9
- import WazoWebRTCClient, { events as clientEvents, transportEvents } from '../web-rtc-client';
9
+ import WebRTCClient, { events as clientEvents, transportEvents } from '../web-rtc-client';
10
10
  import IssueReporter from '../service/IssueReporter';
11
11
  import Emitter from '../utils/Emitter';
12
12
  import Wazo from './index';
@@ -19,7 +19,7 @@ const protocolLogger = IssueReporter.loggerFor('sip');
19
19
  const protocolDebugMessages = ['Received WebSocket text message:', 'Sending WebSocket message:'];
20
20
 
21
21
  export class Phone extends Emitter {
22
- client: WazoWebRTCClient;
22
+ client: WebRTCClient;
23
23
 
24
24
  phone: WebRTCPhone | null | undefined;
25
25
 
@@ -186,7 +186,7 @@ export class Phone extends Emitter {
186
186
  options.log.connector = this._logConnector;
187
187
  }
188
188
 
189
- this.client = new WazoWebRTCClient({
189
+ this.client = new WebRTCClient({
190
190
  host,
191
191
  port: typeof port === 'string' ? parseInt(port, 10) : port,
192
192
  displayName,