@wazo/sdk 0.38.12 → 0.38.15

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 (52) hide show
  1. package/dist/wazo-sdk.js +2 -2
  2. package/esm/__tests__/web-rtc-client.test.js +7 -0
  3. package/esm/checker/Checker.js +7 -0
  4. package/esm/checker/checks/index.js +7 -0
  5. package/esm/checker/checks/webrtc-transport.js +7 -0
  6. package/esm/checker/checks/webrtc.js +7 -0
  7. package/esm/domain/Features.js +5 -1
  8. package/esm/domain/Phone/CTIPhone.js +2 -0
  9. package/esm/index.js +22 -4
  10. package/esm/simple/Auth.js +22 -4
  11. package/esm/simple/Configuration.js +22 -4
  12. package/esm/simple/Phone.js +22 -4
  13. package/esm/simple/index.js +22 -4
  14. package/esm/simple/room/LocalParticipant.js +5525 -5507
  15. package/esm/simple/room/Participant.js +5529 -5511
  16. package/esm/simple/room/RemoteParticipant.js +22 -4
  17. package/esm/simple/room/Room.js +22 -4
  18. package/esm/simple/room/SipRoom.js +22 -4
  19. package/esm/simple/room/Stream.js +22 -4
  20. package/esm/simple/room/__tests__/Participant.test.js +22 -4
  21. package/esm/simple/room/__tests__/RemoteParticipant.test.js +22 -4
  22. package/esm/simple/utils.js +22 -4
  23. package/esm/web-rtc-client.js +7 -0
  24. package/lib/__tests__/web-rtc-client.test.js +7 -0
  25. package/lib/checker/Checker.js +7 -0
  26. package/lib/checker/checks/index.js +7 -0
  27. package/lib/checker/checks/webrtc-transport.js +7 -0
  28. package/lib/checker/checks/webrtc.js +7 -0
  29. package/lib/domain/Features.js +5 -1
  30. package/lib/domain/Phone/CTIPhone.js +2 -0
  31. package/lib/index.js +22 -4
  32. package/lib/simple/Auth.js +22 -4
  33. package/lib/simple/Configuration.js +22 -4
  34. package/lib/simple/Phone.js +22 -4
  35. package/lib/simple/index.js +22 -4
  36. package/lib/simple/room/LocalParticipant.js +6451 -6433
  37. package/lib/simple/room/Participant.js +7352 -7334
  38. package/lib/simple/room/RemoteParticipant.js +22 -4
  39. package/lib/simple/room/Room.js +22 -4
  40. package/lib/simple/room/SipRoom.js +22 -4
  41. package/lib/simple/room/Stream.js +22 -4
  42. package/lib/simple/room/__tests__/Participant.test.js +22 -4
  43. package/lib/simple/room/__tests__/RemoteParticipant.test.js +22 -4
  44. package/lib/simple/utils.js +22 -4
  45. package/lib/web-rtc-client.js +7 -0
  46. package/package.json +1 -1
  47. package/src/domain/Features.js +5 -1
  48. package/src/domain/Phone/CTIPhone.js +2 -0
  49. package/src/domain/Phone/Phone.js +2 -0
  50. package/src/simple/room/Participant.js +7 -1
  51. package/src/simple/room/Room.js +2 -2
  52. package/src/web-rtc-client.js +7 -0
@@ -4618,6 +4618,8 @@ class CTIPhone extends Emitter {
4618
4618
  }
4619
4619
 
4620
4620
  useLocalVideoElement() {}
4621
+
4622
+ setMediaConstraints() {}
4621
4623
  }
4622
4624
 
4623
4625
  /* */
@@ -7208,6 +7210,12 @@ class WebRTCClient extends Emitter {
7208
7210
  };
7209
7211
 
7210
7212
  const ua = new userAgent.UserAgent(webRTCConfiguration);
7213
+ if (ua.transport && ua.transport.connectPromise) {
7214
+ ua.transport.connectPromise.catch((e => {
7215
+ logger$8.warn('Transport connect error', e);
7216
+ }));
7217
+ }
7218
+
7211
7219
  ua.transport.onMessage = (rawMessage ) => {
7212
7220
  const message = parser.Parser.parseMessage(rawMessage, ua.transport.logger);
7213
7221
 
@@ -7429,6 +7437,7 @@ class WebRTCClient extends Emitter {
7429
7437
  conference,
7430
7438
  audioOnly,
7431
7439
  },
7440
+ earlyMedia: true,
7432
7441
  };
7433
7442
 
7434
7443
  if (audioOnly) {
@@ -12304,10 +12313,15 @@ class Participant extends Emitter {
12304
12313
  }
12305
12314
  }
12306
12315
 
12307
- broadcastStatus(inboundStatus = null) {
12316
+ broadcastStatus(inboundStatus = null, sendReinvite ) {
12308
12317
  const status = inboundStatus || this.getStatus();
12309
12318
  logger$3.info('broadcasting participant status', { callId: this.callId, status });
12310
12319
 
12320
+ if (sendReinvite && !this.streams.length && Phone$1.phone) {
12321
+ // eslint-disable-next-line no-underscore-dangle
12322
+ Phone$1.phone._sendReinviteMessage(this.room.callSession, false);
12323
+ }
12324
+
12311
12325
  this.room.sendSignal({
12312
12326
  type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
12313
12327
  origin: this.callId,
@@ -12950,7 +12964,7 @@ class Room$1 extends Emitter {
12950
12964
  // callId is null, someone's requesting everyone's state;
12951
12965
  // or callId is set and matches ours;
12952
12966
  if (this.localParticipant && (!callId || callId === this.localParticipant.callId)) {
12953
- this.localParticipant.broadcastStatus();
12967
+ this.localParticipant.broadcastStatus(null, true);
12954
12968
  }
12955
12969
 
12956
12970
  // might as well update the requester's status
@@ -13052,7 +13066,7 @@ class Room$1 extends Emitter {
13052
13066
 
13053
13067
  this.connected = true;
13054
13068
 
13055
- localParticipant.broadcastStatus();
13069
+ localParticipant.broadcastStatus(null, true);
13056
13070
 
13057
13071
  // we're in the room, now let's request everyone's status
13058
13072
  if (this.localParticipant) {
@@ -13720,7 +13734,7 @@ SwitchboardCall.STATE = {
13720
13734
 
13721
13735
  //
13722
13736
 
13723
- const FEATURES = ['chat', 'video', 'call_recording', 'fax', 'mobile_double_call', 'mobile_gsm'];
13737
+ const FEATURES = ['chat', 'video', 'call_recording', 'fax', 'mobile_double_call', 'mobile_gsm', 'meeting'];
13724
13738
 
13725
13739
  const getScopeName = (featureName ) => `enterprise.app.${featureName}`;
13726
13740
 
@@ -13734,6 +13748,7 @@ class Features {
13734
13748
 
13735
13749
 
13736
13750
 
13751
+
13737
13752
 
13738
13753
  constructor() {
13739
13754
  this._hasChat = true;
@@ -13742,6 +13757,7 @@ class Features {
13742
13757
  this._hasFax = true;
13743
13758
  this._hasMobileDoubleCall = true;
13744
13759
  this._hasMobileGsm = true;
13760
+ this._hasMeeting = true;
13745
13761
  }
13746
13762
 
13747
13763
  async fetchAccess() {
@@ -13762,6 +13778,7 @@ class Features {
13762
13778
  this._hasFax = this._hasFeatures(scopes, 'fax');
13763
13779
  this._hasMobileDoubleCall = this._hasFeatures(scopes, 'mobile_double_call');
13764
13780
  this._hasMobileGsm = this._hasFeatures(scopes, 'mobile_gsm');
13781
+ this._hasMeeting = this._hasFeatures(scopes, 'meeting');
13765
13782
  }
13766
13783
 
13767
13784
  hasChat() { return this._hasChat; }
@@ -13770,6 +13787,7 @@ class Features {
13770
13787
  hasFax() { return this._hasFax; }
13771
13788
  hasMobileDoubleCall() { return this._hasMobileDoubleCall; }
13772
13789
  hasMobileGsm() { return this._hasMobileGsm; }
13790
+ hasMeeting() { return this._hasMeeting; }
13773
13791
 
13774
13792
  _hasFeatures(scopes , featureName ) {
13775
13793
  const scopeName = getScopeName(featureName);
@@ -5797,6 +5797,12 @@ class WebRTCClient extends Emitter {
5797
5797
  };
5798
5798
 
5799
5799
  const ua = new userAgent.UserAgent(webRTCConfiguration);
5800
+ if (ua.transport && ua.transport.connectPromise) {
5801
+ ua.transport.connectPromise.catch((e => {
5802
+ logger.warn('Transport connect error', e);
5803
+ }));
5804
+ }
5805
+
5800
5806
  ua.transport.onMessage = (rawMessage ) => {
5801
5807
  const message = parser.Parser.parseMessage(rawMessage, ua.transport.logger);
5802
5808
 
@@ -6018,6 +6024,7 @@ class WebRTCClient extends Emitter {
6018
6024
  conference,
6019
6025
  audioOnly,
6020
6026
  },
6027
+ earlyMedia: true,
6021
6028
  };
6022
6029
 
6023
6030
  if (audioOnly) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wazo/sdk",
3
- "version": "0.38.12",
3
+ "version": "0.38.15",
4
4
  "description": "Wazo's JavaScript Software Development Kit.",
5
5
  "main": "dist/wazo-sdk.js",
6
6
  "author": "Wazo (http://wazo.io)",
@@ -2,7 +2,7 @@
2
2
 
3
3
  import getApiClient from '../service/getApiClient';
4
4
 
5
- export const FEATURES = ['chat', 'video', 'call_recording', 'fax', 'mobile_double_call', 'mobile_gsm'];
5
+ export const FEATURES = ['chat', 'video', 'call_recording', 'fax', 'mobile_double_call', 'mobile_gsm', 'meeting'];
6
6
 
7
7
  export const getScopeName = (featureName: string) => `enterprise.app.${featureName}`;
8
8
 
@@ -16,6 +16,7 @@ class Features {
16
16
  _hasFax: boolean;
17
17
  _hasMobileDoubleCall: boolean;
18
18
  _hasMobileGsm: boolean;
19
+ _hasMeeting: boolean;
19
20
 
20
21
  constructor() {
21
22
  this._hasChat = true;
@@ -24,6 +25,7 @@ class Features {
24
25
  this._hasFax = true;
25
26
  this._hasMobileDoubleCall = true;
26
27
  this._hasMobileGsm = true;
28
+ this._hasMeeting = true;
27
29
  }
28
30
 
29
31
  async fetchAccess() {
@@ -44,6 +46,7 @@ class Features {
44
46
  this._hasFax = this._hasFeatures(scopes, 'fax');
45
47
  this._hasMobileDoubleCall = this._hasFeatures(scopes, 'mobile_double_call');
46
48
  this._hasMobileGsm = this._hasFeatures(scopes, 'mobile_gsm');
49
+ this._hasMeeting = this._hasFeatures(scopes, 'meeting');
47
50
  }
48
51
 
49
52
  hasChat() { return this._hasChat; }
@@ -52,6 +55,7 @@ class Features {
52
55
  hasFax() { return this._hasFax; }
53
56
  hasMobileDoubleCall() { return this._hasMobileDoubleCall; }
54
57
  hasMobileGsm() { return this._hasMobileGsm; }
58
+ hasMeeting() { return this._hasMeeting; }
55
59
 
56
60
  _hasFeatures(scopes: Object, featureName: string) {
57
61
  const scopeName = getScopeName(featureName);
@@ -341,4 +341,6 @@ export default class CTIPhone extends Emitter implements Phone {
341
341
  }
342
342
 
343
343
  useLocalVideoElement() {}
344
+
345
+ setMediaConstraints() {}
344
346
  }
@@ -110,4 +110,6 @@ export interface Phone {
110
110
  isRegistered(): boolean;
111
111
 
112
112
  hasIncomingCallSession(): boolean;
113
+
114
+ setMediaConstraints(media: MediaStreamConstraints): PhoneVoid;
113
115
  }
@@ -2,6 +2,7 @@
2
2
  import Emitter from '../../utils/Emitter';
3
3
  import IssueReporter from '../../service/IssueReporter';
4
4
 
5
+ import Phone from '../Phone';
5
6
  import Room, { SIGNAL_TYPE_PARTICIPANT_UPDATE } from './Room';
6
7
  import Contact from '../../domain/Contact';
7
8
  import getApiClient from '../../service/getApiClient';
@@ -296,10 +297,15 @@ class Participant extends Emitter {
296
297
  }
297
298
  }
298
299
 
299
- broadcastStatus(inboundStatus: Object = null) {
300
+ broadcastStatus(inboundStatus: Object = null, sendReinvite: ?boolean) {
300
301
  const status = inboundStatus || this.getStatus();
301
302
  logger.info('broadcasting participant status', { callId: this.callId, status });
302
303
 
304
+ if (sendReinvite && !this.streams.length && Phone.phone) {
305
+ // eslint-disable-next-line no-underscore-dangle
306
+ Phone.phone._sendReinviteMessage(this.room.callSession, false);
307
+ }
308
+
303
309
  this.room.sendSignal({
304
310
  type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
305
311
  origin: this.callId,
@@ -602,7 +602,7 @@ class Room extends Emitter {
602
602
  // callId is null, someone's requesting everyone's state;
603
603
  // or callId is set and matches ours;
604
604
  if (this.localParticipant && (!callId || callId === this.localParticipant.callId)) {
605
- this.localParticipant.broadcastStatus();
605
+ this.localParticipant.broadcastStatus(null, true);
606
606
  }
607
607
 
608
608
  // might as well update the requester's status
@@ -704,7 +704,7 @@ class Room extends Emitter {
704
704
 
705
705
  this.connected = true;
706
706
 
707
- localParticipant.broadcastStatus();
707
+ localParticipant.broadcastStatus(null, true);
708
708
 
709
709
  // we're in the room, now let's request everyone's status
710
710
  if (this.localParticipant) {
@@ -251,6 +251,12 @@ export default class WebRTCClient extends Emitter {
251
251
  };
252
252
 
253
253
  const ua = new UserAgent(webRTCConfiguration);
254
+ if (ua.transport && ua.transport.connectPromise) {
255
+ ua.transport.connectPromise.catch((e => {
256
+ logger.warn('Transport connect error', e);
257
+ }));
258
+ }
259
+
254
260
  ua.transport.onMessage = (rawMessage: string) => {
255
261
  const message = Parser.parseMessage(rawMessage, ua.transport.logger);
256
262
 
@@ -472,6 +478,7 @@ export default class WebRTCClient extends Emitter {
472
478
  conference,
473
479
  audioOnly,
474
480
  },
481
+ earlyMedia: true,
475
482
  };
476
483
 
477
484
  if (audioOnly) {