@wazo/sdk 0.37.0-rc.5 → 0.37.2

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.
Files changed (149) hide show
  1. package/dist/wazo-sdk.js +5 -5
  2. package/esm/__tests__/api-client.test.js +93 -16
  3. package/esm/__tests__/web-rtc-client.test.js +153 -54
  4. package/esm/api/agentd.js +24 -3
  5. package/esm/api/amid.js +7 -1
  6. package/esm/api/application.js +24 -3
  7. package/esm/api/auth.js +24 -3
  8. package/esm/api/call-logd.js +78 -20
  9. package/esm/api/calld.js +24 -20
  10. package/esm/api/chatd.js +24 -3
  11. package/esm/api/confd.js +24 -3
  12. package/esm/api/ctid-ng.js +24 -3
  13. package/esm/api/dird.js +27 -6
  14. package/esm/api/webhookd.js +7 -1
  15. package/esm/api-client.js +93 -16
  16. package/esm/checker/Checker.js +156 -54
  17. package/esm/checker/checks/aor.js +95 -16
  18. package/esm/checker/checks/api.js +94 -16
  19. package/esm/checker/checks/index.js +156 -54
  20. package/esm/checker/checks/wazo-websocket.js +7 -1
  21. package/esm/checker/checks/webrtc-transport.js +153 -54
  22. package/esm/checker/checks/webrtc.js +153 -54
  23. package/esm/domain/AdHocAPIConference.js +1717 -1640
  24. package/esm/domain/CallLog.js +71 -19
  25. package/esm/domain/CallSession.js +1 -18
  26. package/esm/domain/Contact.js +3 -3
  27. package/esm/domain/Features.js +93 -16
  28. package/esm/domain/IndirectTransfer.js +0 -17
  29. package/esm/domain/Phone/CTIPhone.js +100 -19
  30. package/esm/domain/Phone/Phone.js +0 -17
  31. package/esm/domain/Phone/WebRTCPhone.js +51 -36
  32. package/esm/domain/Recording.js +51 -0
  33. package/esm/domain/Room.js +0 -17
  34. package/esm/domain/SwitchboardCall.js +0 -17
  35. package/esm/domain/__tests__/CallLog.test.js +89 -19
  36. package/esm/domain/__tests__/CallSession.test.js +1 -18
  37. package/esm/domain/__tests__/Contact.test.js +3 -3
  38. package/esm/domain/__tests__/IndirectTransfer.test.js +1 -18
  39. package/esm/domain/__tests__/Room.test.js +1 -18
  40. package/esm/domain/__tests__/Session.test.js +7 -0
  41. package/esm/index.js +3436 -2911
  42. package/esm/lib/WazoSessionDescriptionHandler.js +28 -10
  43. package/esm/service/CallApi.js +93 -16
  44. package/esm/service/IssueReporter.js +7 -1
  45. package/esm/service/__tests__/IssueReporter.test.js +26 -2
  46. package/esm/service/getApiClient.js +93 -16
  47. package/esm/simple/Auth.js +619 -97
  48. package/esm/simple/Configuration.js +619 -97
  49. package/esm/simple/Directory.js +93 -16
  50. package/esm/simple/Phone.js +3261 -2739
  51. package/esm/simple/Websocket.js +7 -1
  52. package/esm/simple/index.js +619 -97
  53. package/esm/simple/room/LocalParticipant.js +619 -97
  54. package/esm/simple/room/Participant.js +619 -97
  55. package/esm/simple/room/RemoteParticipant.js +619 -97
  56. package/esm/simple/room/Room.js +619 -97
  57. package/esm/simple/room/Stream.js +619 -97
  58. package/esm/simple/room/__tests__/RemoteParticipant.test.js +619 -97
  59. package/esm/simple/utils.js +619 -97
  60. package/esm/utils/__tests__/api-requester.test.js +32 -6
  61. package/esm/utils/api-requester.js +24 -3
  62. package/esm/web-rtc-client.js +153 -54
  63. package/esm/websocket-client.js +7 -1
  64. package/lib/__tests__/api-client.test.js +93 -16
  65. package/lib/__tests__/web-rtc-client.test.js +154 -55
  66. package/lib/api/agentd.js +24 -3
  67. package/lib/api/amid.js +7 -1
  68. package/lib/api/application.js +24 -3
  69. package/lib/api/auth.js +24 -3
  70. package/lib/api/call-logd.js +78 -20
  71. package/lib/api/calld.js +24 -20
  72. package/lib/api/chatd.js +24 -3
  73. package/lib/api/confd.js +24 -3
  74. package/lib/api/ctid-ng.js +24 -3
  75. package/lib/api/dird.js +27 -6
  76. package/lib/api/webhookd.js +7 -1
  77. package/lib/api-client.js +93 -16
  78. package/lib/checker/Checker.js +157 -55
  79. package/lib/checker/checks/aor.js +95 -16
  80. package/lib/checker/checks/api.js +94 -16
  81. package/lib/checker/checks/index.js +157 -55
  82. package/lib/checker/checks/wazo-websocket.js +7 -1
  83. package/lib/checker/checks/webrtc-transport.js +154 -55
  84. package/lib/checker/checks/webrtc.js +154 -55
  85. package/lib/domain/AdHocAPIConference.js +1717 -1640
  86. package/lib/domain/CallLog.js +71 -19
  87. package/lib/domain/CallSession.js +1 -18
  88. package/lib/domain/Contact.js +3 -3
  89. package/lib/domain/Features.js +93 -16
  90. package/lib/domain/IndirectTransfer.js +0 -17
  91. package/lib/domain/Phone/CTIPhone.js +100 -19
  92. package/lib/domain/Phone/Phone.js +0 -16
  93. package/lib/domain/Phone/WebRTCPhone.js +51 -36
  94. package/lib/domain/Recording.js +57 -0
  95. package/lib/domain/Room.js +0 -17
  96. package/lib/domain/SwitchboardCall.js +0 -17
  97. package/lib/domain/__tests__/CallLog.test.js +89 -19
  98. package/lib/domain/__tests__/CallSession.test.js +1 -18
  99. package/lib/domain/__tests__/Contact.test.js +3 -3
  100. package/lib/domain/__tests__/IndirectTransfer.test.js +1 -18
  101. package/lib/domain/__tests__/Room.test.js +1 -18
  102. package/lib/domain/__tests__/Session.test.js +7 -0
  103. package/lib/index.js +3437 -2912
  104. package/lib/lib/WazoSessionDescriptionHandler.js +28 -10
  105. package/lib/service/CallApi.js +93 -16
  106. package/lib/service/IssueReporter.js +7 -1
  107. package/lib/service/__tests__/IssueReporter.test.js +26 -2
  108. package/lib/service/getApiClient.js +93 -16
  109. package/lib/simple/Auth.js +620 -98
  110. package/lib/simple/Configuration.js +620 -98
  111. package/lib/simple/Directory.js +93 -16
  112. package/lib/simple/Phone.js +3262 -2740
  113. package/lib/simple/Websocket.js +7 -1
  114. package/lib/simple/index.js +620 -98
  115. package/lib/simple/room/LocalParticipant.js +620 -98
  116. package/lib/simple/room/Participant.js +620 -98
  117. package/lib/simple/room/RemoteParticipant.js +620 -98
  118. package/lib/simple/room/Room.js +620 -98
  119. package/lib/simple/room/Stream.js +620 -98
  120. package/lib/simple/room/__tests__/RemoteParticipant.test.js +620 -98
  121. package/lib/simple/utils.js +620 -98
  122. package/lib/utils/__tests__/api-requester.test.js +32 -6
  123. package/lib/utils/api-requester.js +24 -3
  124. package/lib/web-rtc-client.js +154 -55
  125. package/lib/websocket-client.js +7 -1
  126. package/package.json +1 -1
  127. package/src/api-client.js +4 -0
  128. package/src/checker/checks/aor.js +2 -0
  129. package/src/checker/checks/api.js +1 -0
  130. package/src/domain/CallLog.js +18 -11
  131. package/src/domain/CallSession.js +1 -2
  132. package/src/domain/Contact.js +3 -3
  133. package/src/domain/Phone/CTIPhone.js +6 -2
  134. package/src/domain/Phone/Phone.js +2 -0
  135. package/src/domain/Phone/WebRTCPhone.js +26 -16
  136. package/src/domain/Recording.js +48 -0
  137. package/src/domain/__tests__/CallLog.test.js +19 -0
  138. package/src/domain/__tests__/Session.test.js +7 -0
  139. package/src/index.js +6 -0
  140. package/src/lib/WazoSessionDescriptionHandler.js +21 -9
  141. package/src/service/IssueReporter.js +7 -1
  142. package/src/service/__tests__/IssueReporter.test.js +20 -1
  143. package/src/simple/Phone.js +5 -1
  144. package/src/simple/index.js +6 -0
  145. package/src/simple/room/Room.js +18 -15
  146. package/src/simple/room/Stream.js +1 -4
  147. package/src/utils/__tests__/api-requester.test.js +9 -4
  148. package/src/utils/api-requester.js +17 -2
  149. package/src/web-rtc-client.js +40 -13
@@ -415,13 +415,15 @@ class Room extends Emitter {
415
415
  }
416
416
  });
417
417
 
418
- this.on(this.ON_VIDEO_STREAM, (stream, streamId) => {
418
+ this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
419
419
  logger.info('on room video stream', { streamId });
420
420
 
421
+ this._mapMsid(sipSession.body.body);
422
+
421
423
  // ON_VIDEO_STREAM is called before PARTICIPANT_JOINED, so we have to keep stream in `_unassociatedVideoStreams`.
422
424
  this._unassociatedVideoStreams[streamId] = stream;
423
425
 
424
- const callId = this._getCallIdFromStreamId(streamId);
426
+ const callId = this._getCallIdFromTrackId(streamId);
425
427
  const participant = callId ? this._getParticipantFromCallId(callId) : null;
426
428
  if (participant) {
427
429
  this.__associateStreams(participant);
@@ -465,11 +467,12 @@ class Room extends Emitter {
465
467
  const sdp = sdpParser.parse(rawSdp);
466
468
  const labelMsidArray = sdp.media.filter(media => !!media.label).map(({ label, msid }) => ({
467
469
  label: String(label),
468
- msid: msid.split(' ')[1],
470
+ streamId: msid.split(' ')[0],
471
+ trackId: msid.split(' ')[1],
469
472
  }));
470
473
 
471
- labelMsidArray.forEach(({ label, msid }) => {
472
- this._callIdStreamIdMap[String(label)] = msid;
474
+ labelMsidArray.forEach(({ label, streamId, trackId }) => {
475
+ this._callIdStreamIdMap[String(label)] = { streamId, trackId };
473
476
 
474
477
  const callId = String(label);
475
478
  const participant = this._unassociatedParticipants[callId] || this._getParticipantFromCallId(callId);
@@ -701,9 +704,9 @@ class Room extends Emitter {
701
704
  _onParticipantTrackUpdate(oldParticipant: Participant, update: string): Participant {
702
705
  const newParticipant = oldParticipant;
703
706
 
704
- const label = this._callIdStreamIdMap[newParticipant.callId];
707
+ const { trackId } = this._callIdStreamIdMap[newParticipant.callId] || {};
705
708
  const pc = Wazo.Phone.phone.currentSipSession.sessionDescriptionHandler.peerConnection;
706
- const stream = pc.getRemoteStreams().find(otherStream => otherStream.getTracks().some(track => track.id === label));
709
+ const stream = pc.getRemoteStreams().find(someStream => someStream.getTracks().some(track => track.id === trackId));
707
710
 
708
711
  if (update === 'downgrade') {
709
712
  newParticipant.streams = [];
@@ -723,21 +726,21 @@ class Room extends Emitter {
723
726
 
724
727
  // Associate audio/video streams to the participant and triggers events on it
725
728
  __associateStreams(participant: Participant) {
726
- const streamId = this._callIdStreamIdMap[participant.callId];
727
- if (!streamId) {
729
+ const { trackId } = this._callIdStreamIdMap[participant.callId] || {};
730
+ if (!trackId) {
728
731
  this._unassociatedParticipants[participant.callId] = participant;
729
732
 
730
733
  return;
731
734
  }
732
- if (!streamId || !participant || !this.localParticipant || participant.callId === this.localParticipant.callId) {
735
+ if (!trackId || !participant || !this.localParticipant || participant.callId === this.localParticipant.callId) {
733
736
  return;
734
737
  }
735
738
 
736
- if (this._unassociatedVideoStreams[streamId]) {
739
+ if (this._unassociatedVideoStreams[trackId]) {
737
740
  // Try to associate stream
738
- this._associateStreamTo(this._unassociatedVideoStreams[streamId], participant);
741
+ this._associateStreamTo(this._unassociatedVideoStreams[trackId], participant);
739
742
 
740
- delete this._unassociatedVideoStreams[streamId];
743
+ delete this._unassociatedVideoStreams[trackId];
741
744
  delete this._unassociatedParticipants[participant.callId];
742
745
  }
743
746
  }
@@ -750,8 +753,8 @@ class Room extends Emitter {
750
753
  participant.onStreamSubscribed(stream);
751
754
  }
752
755
 
753
- _getCallIdFromStreamId(streamId: string) {
754
- return Object.keys(this._callIdStreamIdMap).find(key => this._callIdStreamIdMap[key] === streamId);
756
+ _getCallIdFromTrackId(trackId: string) {
757
+ return Object.keys(this._callIdStreamIdMap).find(key => this._callIdStreamIdMap[key].trackId === trackId);
755
758
  }
756
759
 
757
760
  _getParticipantFromCallId(callId: string) {
@@ -34,10 +34,7 @@ class Stream {
34
34
  element.onloadedmetadata = () => {
35
35
  const tracks = this.htmlStream ? this.htmlStream.getVideoTracks() : [];
36
36
  tracks.forEach(track => {
37
- // Do not re-enable the track if already mounted.
38
- if (!track.loaded) {
39
- track.enabled = true;
40
- }
37
+ track.enabled = true;
41
38
  // $FlowFixMe
42
39
  track.loaded = true;
43
40
  });
@@ -50,11 +50,16 @@ describe('Retrieving headers', () => {
50
50
  });
51
51
 
52
52
  describe('Calling fetch', () => {
53
- it('should call fetch without body but query string in get method', () => {
53
+ it('should call fetch without body but query string in get method', async () => {
54
54
  jest.mock('node-fetch/lib/index', () => {});
55
- global.fetch = jest.fn(() => Promise.resolve({ json: () => Promise.resolve({}) }));
56
-
57
- new ApiRequester({ server }).call(path, method, body, {});
55
+ global.fetch = jest.fn(() => Promise.resolve({
56
+ json: () => Promise.resolve({}),
57
+ headers: {
58
+ get: () => '',
59
+ },
60
+ }));
61
+
62
+ await new ApiRequester({ server }).call(path, method, body, {});
58
63
  expect(global.fetch).toBeCalledWith(url, { method: 'get', body: null, headers: {}, agent: null });
59
64
  });
60
65
  });
@@ -56,6 +56,7 @@ export default class ApiRequester {
56
56
  fetchOptions: Object;
57
57
  refreshTokenCallback: Function;
58
58
  refreshTokenPromise: ?Promise<any>;
59
+ shouldLogErrors: boolean;
59
60
 
60
61
  head: Function;
61
62
  get: Function;
@@ -95,6 +96,8 @@ export default class ApiRequester {
95
96
  this.token = token;
96
97
  }
97
98
 
99
+ this.shouldLogErrors = true;
100
+
98
101
  methods.forEach(method => {
99
102
  // $FlowFixMe
100
103
  ApiRequester.prototype[method] = function sugar(...args) {
@@ -118,6 +121,14 @@ export default class ApiRequester {
118
121
  this.fetchOptions = options;
119
122
  }
120
123
 
124
+ disableErrorLogging() {
125
+ this.shouldLogErrors = false;
126
+ }
127
+
128
+ enableErrorLogging() {
129
+ this.shouldLogErrors = true;
130
+ }
131
+
121
132
  async call(
122
133
  path: string,
123
134
  method: string = 'get',
@@ -178,7 +189,9 @@ export default class ApiRequester {
178
189
  ? exceptionClass.fromText(err, response.status)
179
190
  : exceptionClass.fromResponse(err, response.status);
180
191
 
181
- logger.error('API error', error);
192
+ if (this.shouldLogErrors) {
193
+ logger.error('API error', error);
194
+ }
182
195
 
183
196
  throw error;
184
197
  });
@@ -186,7 +199,9 @@ export default class ApiRequester {
186
199
 
187
200
  return newParse(response, isJson);
188
201
  }).catch(error => {
189
- logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
202
+ if (this.shouldLogErrors) {
203
+ logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
204
+ }
190
205
 
191
206
  throw error;
192
207
  });
@@ -15,12 +15,11 @@ import type SessionDescriptionHandlerConfiguration
15
15
  import type SessionDescriptionHandler
16
16
  from 'sip.js/lib/platform/web/session-description-handler/session-description-handler';
17
17
  import { UserAgentState } from 'sip.js/lib/api/user-agent-state';
18
- import { Message } from 'sip.js/lib/api/message';
19
18
  import { Parser } from 'sip.js/lib/core/messages/parser';
20
19
  import { C } from 'sip.js/lib/core/messages/methods/constants';
21
20
  import { URI } from 'sip.js/lib/grammar/uri';
22
21
  import { UserAgent } from 'sip.js/lib/api/user-agent';
23
- import { holdModifier } from 'sip.js/lib/platform/web/modifiers/modifiers';
22
+ import { holdModifier, stripVideo } from 'sip.js/lib/platform/web/modifiers/modifiers';
24
23
  import { Registerer } from 'sip.js/lib/api/registerer';
25
24
  import { Inviter } from 'sip.js/lib/api/inviter';
26
25
  import { Messager } from 'sip.js/lib/api/messager';
@@ -37,7 +36,7 @@ import Emitter from './utils/Emitter';
37
36
  import ApiClient from './api-client';
38
37
  import IssueReporter from './service/IssueReporter';
39
38
  import Heartbeat from './utils/Heartbeat';
40
- import { deactivateVideoModifier, hasAnActiveVideo } from './utils/sdp';
39
+ import { hasAnActiveVideo } from './utils/sdp';
41
40
 
42
41
  // We need to replace 0.0.0.0 to 127.0.0.1 in the sdp to avoid MOH during a createOffer.
43
42
  export const replaceLocalIpModifier = (description: Object) => Promise.resolve({
@@ -432,9 +431,15 @@ export default class WebRTCClient extends Emitter {
432
431
 
433
432
  call(number: string, enableVideo?: boolean, audioOnly: boolean = false, conference: boolean = false): Session {
434
433
  logger.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
435
- const inviterOptions = {};
434
+ const inviterOptions: Object = {
435
+ sessionDescriptionHandlerOptionsReInvite: {
436
+ conference,
437
+ audioOnly,
438
+ },
439
+ };
440
+
436
441
  if (audioOnly) {
437
- inviterOptions.sessionDescriptionHandlerModifiersReInvite = [deactivateVideoModifier];
442
+ inviterOptions.sessionDescriptionHandlerModifiersReInvite = [stripVideo];
438
443
  }
439
444
 
440
445
  const session = new Inviter(this.userAgent, this._makeURI(number), inviterOptions);
@@ -463,10 +468,11 @@ export default class WebRTCClient extends Emitter {
463
468
  sessionDescriptionHandlerOptions: this.getMediaConfiguration(enableVideo || false, conference),
464
469
  };
465
470
 
466
- inviteOptions.sessionDescriptionHandlerModifiers = [replaceLocalIpModifier];
471
+ inviteOptions.sessionDescriptionHandlerOptions.audioOnly = audioOnly;
467
472
 
473
+ inviteOptions.sessionDescriptionHandlerModifiers = [replaceLocalIpModifier];
468
474
  if (audioOnly) {
469
- inviteOptions.sessionDescriptionHandlerModifiers.push(deactivateVideoModifier);
475
+ inviteOptions.sessionDescriptionHandlerModifiers.push(stripVideo);
470
476
  }
471
477
 
472
478
  // Do not await invite here or we'll miss the Establishing state transition
@@ -680,6 +686,9 @@ export default class WebRTCClient extends Emitter {
680
686
  if (!this._isWeb()) {
681
687
  options.sessionDescriptionHandlerModifiers = [holdModifier];
682
688
  }
689
+ options.sessionDescriptionHandlerOptions = {
690
+ constraints: options.constraints,
691
+ };
683
692
 
684
693
  // Send re-INVITE
685
694
  return session.invite(options);
@@ -719,6 +728,9 @@ export default class WebRTCClient extends Emitter {
719
728
  // (eg: holdModifier)
720
729
  options.sessionDescriptionHandlerModifiers = [];
721
730
  }
731
+ options.sessionDescriptionHandlerOptions = {
732
+ constraints: options.constraints,
733
+ };
722
734
 
723
735
  // Send re-INVITE
724
736
  return session.invite(options);
@@ -948,7 +960,8 @@ export default class WebRTCClient extends Emitter {
948
960
  ? this.video.deviceId.exact : undefined;
949
961
  }
950
962
 
951
- reinvite(sipSession: Session, newConstraints: ?Object = null, conference: boolean = false) {
963
+ reinvite(sipSession: Session, newConstraints: ?Object = null, conference: boolean = false,
964
+ audioOnly: boolean = false) {
952
965
  if (!sipSession) {
953
966
  return false;
954
967
  }
@@ -958,16 +971,17 @@ export default class WebRTCClient extends Emitter {
958
971
  }
959
972
 
960
973
  const wasMuted = this.isAudioMuted(sipSession);
961
- // When upgrading to video, remove the `deactivateVideoModifier` modifiers
974
+ // When upgrading to video, remove the `stripVideo` modifiers
962
975
  if (newConstraints && newConstraints.video) {
963
976
  const modifiers = sipSession.sessionDescriptionHandlerModifiersReInvite;
964
977
  sipSession.sessionDescriptionHandlerModifiersReInvite = modifiers.filter(modifier =>
965
- modifier !== deactivateVideoModifier);
978
+ modifier !== stripVideo);
966
979
  }
967
980
 
968
981
  sipSession.sessionDescriptionHandlerOptionsReInvite = {
969
982
  ...sipSession.sessionDescriptionHandlerOptionsReInvite,
970
983
  conference,
984
+ audioOnly,
971
985
  };
972
986
 
973
987
  const shouldDoVideo = newConstraints ? newConstraints.video : this.sessionWantsToDoVideo(sipSession);
@@ -1007,6 +1021,8 @@ export default class WebRTCClient extends Emitter {
1007
1021
  },
1008
1022
  sessionDescriptionHandlerOptions: {
1009
1023
  constraints,
1024
+ conference,
1025
+ audioOnly,
1010
1026
  offerOptions: {
1011
1027
  iceRestart: false,
1012
1028
  },
@@ -1466,6 +1482,8 @@ export default class WebRTCClient extends Emitter {
1466
1482
 
1467
1483
  // Invitation and Inviter extends Session
1468
1484
  _setupSession(session: Session) {
1485
+ const sipSessionId = this.getSipSessionId(session);
1486
+
1469
1487
  // When receiving an Invitation, the delegate is not defined.
1470
1488
  if (!session.delegate) {
1471
1489
  session.delegate = {};
@@ -1489,8 +1507,18 @@ export default class WebRTCClient extends Emitter {
1489
1507
  };
1490
1508
  };
1491
1509
 
1510
+ const oldInviteRequest = session.onInviteRequest.bind(session);
1511
+ let hadRemoteVideo = false;
1512
+
1513
+ // Monkey patch `onInviteRequest` to be able to know if there was a remote video stream before `onInvite` is called
1514
+ // Becase when `onInvite` is called we already got the video track
1515
+ session.onInviteRequest = (request) => {
1516
+ hadRemoteVideo = this.hasARemoteVideoTrack(sipSessionId);
1517
+
1518
+ oldInviteRequest(request);
1519
+ };
1520
+
1492
1521
  session.delegate.onInvite = (request: IncomingRequestMessage) => {
1493
- const sipSessionId = this.getSipSessionId(session);
1494
1522
  let updatedCalleeName = null;
1495
1523
  let updatedNumber = null;
1496
1524
  if (session.assertedIdentity) {
@@ -1500,7 +1528,6 @@ export default class WebRTCClient extends Emitter {
1500
1528
  logger.info('re-invite received', { updatedCalleeName, updatedNumber });
1501
1529
 
1502
1530
  // Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
1503
- const hadRemoteVideo = this.hasARemoteVideoTrack(sipSessionId);
1504
1531
 
1505
1532
  // Update SDP
1506
1533
  // Remote video is handled by the `track` event. Here we're dealing with video stream removal.
@@ -1550,7 +1577,7 @@ export default class WebRTCClient extends Emitter {
1550
1577
  }
1551
1578
 
1552
1579
  _isAudioOnly(session: Session): boolean {
1553
- return session.sessionDescriptionHandlerModifiersReInvite.find(modifier => modifier === deactivateVideoModifier);
1580
+ return session.sessionDescriptionHandlerModifiersReInvite.find(modifier => modifier === stripVideo);
1554
1581
  }
1555
1582
 
1556
1583
  _setupMedias(session: Session, newStream: ?MediaStream) {