@wazo/sdk 0.38.13 → 0.38.16

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 (70) hide show
  1. package/dist/wazo-sdk.js +2 -2
  2. package/esm/__tests__/api-client.test.js +5 -0
  3. package/esm/__tests__/web-rtc-client.test.js +12 -0
  4. package/esm/api/dird.js +5 -0
  5. package/esm/api-client.js +5 -0
  6. package/esm/checker/Checker.js +12 -0
  7. package/esm/checker/checks/aor.js +5 -0
  8. package/esm/checker/checks/api.js +5 -0
  9. package/esm/checker/checks/index.js +12 -0
  10. package/esm/checker/checks/webrtc-transport.js +12 -0
  11. package/esm/checker/checks/webrtc.js +12 -0
  12. package/esm/domain/AdHocAPIConference.js +5 -0
  13. package/esm/domain/Features.js +5 -0
  14. package/esm/domain/Phone/CTIPhone.js +7 -0
  15. package/esm/index.js +22 -3
  16. package/esm/service/CallApi.js +5 -0
  17. package/esm/service/getApiClient.js +5 -0
  18. package/esm/simple/Auth.js +22 -3
  19. package/esm/simple/Configuration.js +22 -3
  20. package/esm/simple/Directory.js +5 -0
  21. package/esm/simple/Phone.js +22 -3
  22. package/esm/simple/index.js +22 -3
  23. package/esm/simple/room/LocalParticipant.js +5528 -5509
  24. package/esm/simple/room/Participant.js +5531 -5512
  25. package/esm/simple/room/RemoteParticipant.js +22 -3
  26. package/esm/simple/room/Room.js +22 -3
  27. package/esm/simple/room/SipRoom.js +22 -3
  28. package/esm/simple/room/Stream.js +22 -3
  29. package/esm/simple/room/__tests__/Participant.test.js +22 -3
  30. package/esm/simple/room/__tests__/RemoteParticipant.test.js +22 -3
  31. package/esm/simple/utils.js +22 -3
  32. package/esm/web-rtc-client.js +12 -0
  33. package/lib/__tests__/api-client.test.js +5 -0
  34. package/lib/__tests__/web-rtc-client.test.js +12 -0
  35. package/lib/api/dird.js +5 -0
  36. package/lib/api-client.js +5 -0
  37. package/lib/checker/Checker.js +12 -0
  38. package/lib/checker/checks/aor.js +5 -0
  39. package/lib/checker/checks/api.js +5 -0
  40. package/lib/checker/checks/index.js +12 -0
  41. package/lib/checker/checks/webrtc-transport.js +12 -0
  42. package/lib/checker/checks/webrtc.js +12 -0
  43. package/lib/domain/AdHocAPIConference.js +5 -0
  44. package/lib/domain/Features.js +5 -0
  45. package/lib/domain/Phone/CTIPhone.js +7 -0
  46. package/lib/index.js +22 -3
  47. package/lib/service/CallApi.js +5 -0
  48. package/lib/service/getApiClient.js +5 -0
  49. package/lib/simple/Auth.js +22 -3
  50. package/lib/simple/Configuration.js +22 -3
  51. package/lib/simple/Directory.js +5 -0
  52. package/lib/simple/Phone.js +22 -3
  53. package/lib/simple/index.js +22 -3
  54. package/lib/simple/room/LocalParticipant.js +6444 -6425
  55. package/lib/simple/room/Participant.js +6447 -6428
  56. package/lib/simple/room/RemoteParticipant.js +22 -3
  57. package/lib/simple/room/Room.js +22 -3
  58. package/lib/simple/room/SipRoom.js +22 -3
  59. package/lib/simple/room/Stream.js +22 -3
  60. package/lib/simple/room/__tests__/Participant.test.js +22 -3
  61. package/lib/simple/room/__tests__/RemoteParticipant.test.js +22 -3
  62. package/lib/simple/utils.js +22 -3
  63. package/lib/web-rtc-client.js +12 -0
  64. package/package.json +1 -1
  65. package/src/api/dird.js +5 -0
  66. package/src/domain/Phone/CTIPhone.js +2 -0
  67. package/src/domain/Phone/Phone.js +2 -0
  68. package/src/simple/room/Participant.js +7 -1
  69. package/src/simple/room/Room.js +2 -2
  70. package/src/web-rtc-client.js +7 -0
@@ -4616,6 +4616,8 @@ class CTIPhone extends Emitter {
4616
4616
  }
4617
4617
 
4618
4618
  useLocalVideoElement() {}
4619
+
4620
+ setMediaConstraints() {}
4619
4621
  }
4620
4622
 
4621
4623
  /* */
@@ -4793,6 +4795,11 @@ var dirdMethods = (client , baseUrl ) => ({
4793
4795
  listPersonalContacts: (queryParams = null) =>
4794
4796
  client.get(`${baseUrl}/personal`, queryParams).then(response => Contact.parseManyPersonal(response.items)),
4795
4797
 
4798
+ fetchPersonalContact: (contactUuid ) =>
4799
+ client
4800
+ .get(`${baseUrl}/personal/${contactUuid}`)
4801
+ .then(Contact.parsePersonal),
4802
+
4796
4803
  addContact: (contact ) =>
4797
4804
  client.post(`${baseUrl}/personal`, getContactPayload(contact)).then(Contact.parsePersonal),
4798
4805
 
@@ -7206,6 +7213,12 @@ class WebRTCClient extends Emitter {
7206
7213
  };
7207
7214
 
7208
7215
  const ua = new userAgent.UserAgent(webRTCConfiguration);
7216
+ if (ua.transport && ua.transport.connectPromise) {
7217
+ ua.transport.connectPromise.catch((e => {
7218
+ logger$8.warn('Transport connect error', e);
7219
+ }));
7220
+ }
7221
+
7209
7222
  ua.transport.onMessage = (rawMessage ) => {
7210
7223
  const message = parser.Parser.parseMessage(rawMessage, ua.transport.logger);
7211
7224
 
@@ -7427,6 +7440,7 @@ class WebRTCClient extends Emitter {
7427
7440
  conference,
7428
7441
  audioOnly,
7429
7442
  },
7443
+ earlyMedia: true,
7430
7444
  };
7431
7445
 
7432
7446
  if (audioOnly) {
@@ -12441,10 +12455,15 @@ class Participant extends Emitter {
12441
12455
  }
12442
12456
  }
12443
12457
 
12444
- broadcastStatus(inboundStatus = null) {
12458
+ broadcastStatus(inboundStatus = null, sendReinvite ) {
12445
12459
  const status = inboundStatus || this.getStatus();
12446
12460
  logger$2.info('broadcasting participant status', { callId: this.callId, status });
12447
12461
 
12462
+ if (sendReinvite && !this.streams.length && Phone$1.phone) {
12463
+ // eslint-disable-next-line no-underscore-dangle
12464
+ Phone$1.phone._sendReinviteMessage(this.room.callSession, false);
12465
+ }
12466
+
12448
12467
  this.room.sendSignal({
12449
12468
  type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
12450
12469
  origin: this.callId,
@@ -14494,7 +14513,7 @@ class Room extends Emitter {
14494
14513
  // callId is null, someone's requesting everyone's state;
14495
14514
  // or callId is set and matches ours;
14496
14515
  if (this.localParticipant && (!callId || callId === this.localParticipant.callId)) {
14497
- this.localParticipant.broadcastStatus();
14516
+ this.localParticipant.broadcastStatus(null, true);
14498
14517
  }
14499
14518
 
14500
14519
  // might as well update the requester's status
@@ -14596,7 +14615,7 @@ class Room extends Emitter {
14596
14615
 
14597
14616
  this.connected = true;
14598
14617
 
14599
- localParticipant.broadcastStatus();
14618
+ localParticipant.broadcastStatus(null, true);
14600
14619
 
14601
14620
  // we're in the room, now let's request everyone's status
14602
14621
  if (this.localParticipant) {
@@ -4618,6 +4618,8 @@ class CTIPhone extends Emitter {
4618
4618
  }
4619
4619
 
4620
4620
  useLocalVideoElement() {}
4621
+
4622
+ setMediaConstraints() {}
4621
4623
  }
4622
4624
 
4623
4625
  /* */
@@ -4795,6 +4797,11 @@ var dirdMethods = (client , baseUrl ) => ({
4795
4797
  listPersonalContacts: (queryParams = null) =>
4796
4798
  client.get(`${baseUrl}/personal`, queryParams).then(response => Contact.parseManyPersonal(response.items)),
4797
4799
 
4800
+ fetchPersonalContact: (contactUuid ) =>
4801
+ client
4802
+ .get(`${baseUrl}/personal/${contactUuid}`)
4803
+ .then(Contact.parsePersonal),
4804
+
4798
4805
  addContact: (contact ) =>
4799
4806
  client.post(`${baseUrl}/personal`, getContactPayload(contact)).then(Contact.parsePersonal),
4800
4807
 
@@ -7208,6 +7215,12 @@ class WebRTCClient extends Emitter {
7208
7215
  };
7209
7216
 
7210
7217
  const ua = new userAgent.UserAgent(webRTCConfiguration);
7218
+ if (ua.transport && ua.transport.connectPromise) {
7219
+ ua.transport.connectPromise.catch((e => {
7220
+ logger$8.warn('Transport connect error', e);
7221
+ }));
7222
+ }
7223
+
7211
7224
  ua.transport.onMessage = (rawMessage ) => {
7212
7225
  const message = parser.Parser.parseMessage(rawMessage, ua.transport.logger);
7213
7226
 
@@ -7429,6 +7442,7 @@ class WebRTCClient extends Emitter {
7429
7442
  conference,
7430
7443
  audioOnly,
7431
7444
  },
7445
+ earlyMedia: true,
7432
7446
  };
7433
7447
 
7434
7448
  if (audioOnly) {
@@ -12443,10 +12457,15 @@ class Participant extends Emitter {
12443
12457
  }
12444
12458
  }
12445
12459
 
12446
- broadcastStatus(inboundStatus = null) {
12460
+ broadcastStatus(inboundStatus = null, sendReinvite ) {
12447
12461
  const status = inboundStatus || this.getStatus();
12448
12462
  logger$2.info('broadcasting participant status', { callId: this.callId, status });
12449
12463
 
12464
+ if (sendReinvite && !this.streams.length && Phone$1.phone) {
12465
+ // eslint-disable-next-line no-underscore-dangle
12466
+ Phone$1.phone._sendReinviteMessage(this.room.callSession, false);
12467
+ }
12468
+
12450
12469
  this.room.sendSignal({
12451
12470
  type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
12452
12471
  origin: this.callId,
@@ -14507,7 +14526,7 @@ class Room extends Emitter {
14507
14526
  // callId is null, someone's requesting everyone's state;
14508
14527
  // or callId is set and matches ours;
14509
14528
  if (this.localParticipant && (!callId || callId === this.localParticipant.callId)) {
14510
- this.localParticipant.broadcastStatus();
14529
+ this.localParticipant.broadcastStatus(null, true);
14511
14530
  }
14512
14531
 
14513
14532
  // might as well update the requester's status
@@ -14609,7 +14628,7 @@ class Room extends Emitter {
14609
14628
 
14610
14629
  this.connected = true;
14611
14630
 
14612
- localParticipant.broadcastStatus();
14631
+ localParticipant.broadcastStatus(null, true);
14613
14632
 
14614
14633
  // we're in the room, now let's request everyone's status
14615
14634
  if (this.localParticipant) {
@@ -4616,6 +4616,8 @@ class CTIPhone extends Emitter {
4616
4616
  }
4617
4617
 
4618
4618
  useLocalVideoElement() {}
4619
+
4620
+ setMediaConstraints() {}
4619
4621
  }
4620
4622
 
4621
4623
  /* */
@@ -4793,6 +4795,11 @@ var dirdMethods = (client , baseUrl ) => ({
4793
4795
  listPersonalContacts: (queryParams = null) =>
4794
4796
  client.get(`${baseUrl}/personal`, queryParams).then(response => Contact.parseManyPersonal(response.items)),
4795
4797
 
4798
+ fetchPersonalContact: (contactUuid ) =>
4799
+ client
4800
+ .get(`${baseUrl}/personal/${contactUuid}`)
4801
+ .then(Contact.parsePersonal),
4802
+
4796
4803
  addContact: (contact ) =>
4797
4804
  client.post(`${baseUrl}/personal`, getContactPayload(contact)).then(Contact.parsePersonal),
4798
4805
 
@@ -7206,6 +7213,12 @@ class WebRTCClient extends Emitter {
7206
7213
  };
7207
7214
 
7208
7215
  const ua = new userAgent.UserAgent(webRTCConfiguration);
7216
+ if (ua.transport && ua.transport.connectPromise) {
7217
+ ua.transport.connectPromise.catch((e => {
7218
+ logger$8.warn('Transport connect error', e);
7219
+ }));
7220
+ }
7221
+
7209
7222
  ua.transport.onMessage = (rawMessage ) => {
7210
7223
  const message = parser.Parser.parseMessage(rawMessage, ua.transport.logger);
7211
7224
 
@@ -7427,6 +7440,7 @@ class WebRTCClient extends Emitter {
7427
7440
  conference,
7428
7441
  audioOnly,
7429
7442
  },
7443
+ earlyMedia: true,
7430
7444
  };
7431
7445
 
7432
7446
  if (audioOnly) {
@@ -12302,10 +12316,15 @@ class Participant extends Emitter {
12302
12316
  }
12303
12317
  }
12304
12318
 
12305
- broadcastStatus(inboundStatus = null) {
12319
+ broadcastStatus(inboundStatus = null, sendReinvite ) {
12306
12320
  const status = inboundStatus || this.getStatus();
12307
12321
  logger$3.info('broadcasting participant status', { callId: this.callId, status });
12308
12322
 
12323
+ if (sendReinvite && !this.streams.length && Phone$1.phone) {
12324
+ // eslint-disable-next-line no-underscore-dangle
12325
+ Phone$1.phone._sendReinviteMessage(this.room.callSession, false);
12326
+ }
12327
+
12309
12328
  this.room.sendSignal({
12310
12329
  type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
12311
12330
  origin: this.callId,
@@ -12948,7 +12967,7 @@ class Room$1 extends Emitter {
12948
12967
  // callId is null, someone's requesting everyone's state;
12949
12968
  // or callId is set and matches ours;
12950
12969
  if (this.localParticipant && (!callId || callId === this.localParticipant.callId)) {
12951
- this.localParticipant.broadcastStatus();
12970
+ this.localParticipant.broadcastStatus(null, true);
12952
12971
  }
12953
12972
 
12954
12973
  // might as well update the requester's status
@@ -13050,7 +13069,7 @@ class Room$1 extends Emitter {
13050
13069
 
13051
13070
  this.connected = true;
13052
13071
 
13053
- localParticipant.broadcastStatus();
13072
+ localParticipant.broadcastStatus(null, true);
13054
13073
 
13055
13074
  // we're in the room, now let's request everyone's status
13056
13075
  if (this.localParticipant) {
@@ -4616,6 +4616,8 @@ class CTIPhone extends Emitter {
4616
4616
  }
4617
4617
 
4618
4618
  useLocalVideoElement() {}
4619
+
4620
+ setMediaConstraints() {}
4619
4621
  }
4620
4622
 
4621
4623
  /* */
@@ -4793,6 +4795,11 @@ var dirdMethods = (client , baseUrl ) => ({
4793
4795
  listPersonalContacts: (queryParams = null) =>
4794
4796
  client.get(`${baseUrl}/personal`, queryParams).then(response => Contact.parseManyPersonal(response.items)),
4795
4797
 
4798
+ fetchPersonalContact: (contactUuid ) =>
4799
+ client
4800
+ .get(`${baseUrl}/personal/${contactUuid}`)
4801
+ .then(Contact.parsePersonal),
4802
+
4796
4803
  addContact: (contact ) =>
4797
4804
  client.post(`${baseUrl}/personal`, getContactPayload(contact)).then(Contact.parsePersonal),
4798
4805
 
@@ -7206,6 +7213,12 @@ class WebRTCClient extends Emitter {
7206
7213
  };
7207
7214
 
7208
7215
  const ua = new userAgent.UserAgent(webRTCConfiguration);
7216
+ if (ua.transport && ua.transport.connectPromise) {
7217
+ ua.transport.connectPromise.catch((e => {
7218
+ logger$8.warn('Transport connect error', e);
7219
+ }));
7220
+ }
7221
+
7209
7222
  ua.transport.onMessage = (rawMessage ) => {
7210
7223
  const message = parser.Parser.parseMessage(rawMessage, ua.transport.logger);
7211
7224
 
@@ -7427,6 +7440,7 @@ class WebRTCClient extends Emitter {
7427
7440
  conference,
7428
7441
  audioOnly,
7429
7442
  },
7443
+ earlyMedia: true,
7430
7444
  };
7431
7445
 
7432
7446
  if (audioOnly) {
@@ -12302,10 +12316,15 @@ class Participant extends Emitter {
12302
12316
  }
12303
12317
  }
12304
12318
 
12305
- broadcastStatus(inboundStatus = null) {
12319
+ broadcastStatus(inboundStatus = null, sendReinvite ) {
12306
12320
  const status = inboundStatus || this.getStatus();
12307
12321
  logger$3.info('broadcasting participant status', { callId: this.callId, status });
12308
12322
 
12323
+ if (sendReinvite && !this.streams.length && Phone$1.phone) {
12324
+ // eslint-disable-next-line no-underscore-dangle
12325
+ Phone$1.phone._sendReinviteMessage(this.room.callSession, false);
12326
+ }
12327
+
12309
12328
  this.room.sendSignal({
12310
12329
  type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
12311
12330
  origin: this.callId,
@@ -12948,7 +12967,7 @@ class Room$1 extends Emitter {
12948
12967
  // callId is null, someone's requesting everyone's state;
12949
12968
  // or callId is set and matches ours;
12950
12969
  if (this.localParticipant && (!callId || callId === this.localParticipant.callId)) {
12951
- this.localParticipant.broadcastStatus();
12970
+ this.localParticipant.broadcastStatus(null, true);
12952
12971
  }
12953
12972
 
12954
12973
  // might as well update the requester's status
@@ -13050,7 +13069,7 @@ class Room$1 extends Emitter {
13050
13069
 
13051
13070
  this.connected = true;
13052
13071
 
13053
- localParticipant.broadcastStatus();
13072
+ localParticipant.broadcastStatus(null, true);
13054
13073
 
13055
13074
  // we're in the room, now let's request everyone's status
13056
13075
  if (this.localParticipant) {
@@ -4616,6 +4616,8 @@ class CTIPhone extends Emitter {
4616
4616
  }
4617
4617
 
4618
4618
  useLocalVideoElement() {}
4619
+
4620
+ setMediaConstraints() {}
4619
4621
  }
4620
4622
 
4621
4623
  /* */
@@ -4793,6 +4795,11 @@ var dirdMethods = (client , baseUrl ) => ({
4793
4795
  listPersonalContacts: (queryParams = null) =>
4794
4796
  client.get(`${baseUrl}/personal`, queryParams).then(response => Contact.parseManyPersonal(response.items)),
4795
4797
 
4798
+ fetchPersonalContact: (contactUuid ) =>
4799
+ client
4800
+ .get(`${baseUrl}/personal/${contactUuid}`)
4801
+ .then(Contact.parsePersonal),
4802
+
4796
4803
  addContact: (contact ) =>
4797
4804
  client.post(`${baseUrl}/personal`, getContactPayload(contact)).then(Contact.parsePersonal),
4798
4805
 
@@ -7206,6 +7213,12 @@ class WebRTCClient extends Emitter {
7206
7213
  };
7207
7214
 
7208
7215
  const ua = new userAgent.UserAgent(webRTCConfiguration);
7216
+ if (ua.transport && ua.transport.connectPromise) {
7217
+ ua.transport.connectPromise.catch((e => {
7218
+ logger$8.warn('Transport connect error', e);
7219
+ }));
7220
+ }
7221
+
7209
7222
  ua.transport.onMessage = (rawMessage ) => {
7210
7223
  const message = parser.Parser.parseMessage(rawMessage, ua.transport.logger);
7211
7224
 
@@ -7427,6 +7440,7 @@ class WebRTCClient extends Emitter {
7427
7440
  conference,
7428
7441
  audioOnly,
7429
7442
  },
7443
+ earlyMedia: true,
7430
7444
  };
7431
7445
 
7432
7446
  if (audioOnly) {
@@ -12302,10 +12316,15 @@ class Participant extends Emitter {
12302
12316
  }
12303
12317
  }
12304
12318
 
12305
- broadcastStatus(inboundStatus = null) {
12319
+ broadcastStatus(inboundStatus = null, sendReinvite ) {
12306
12320
  const status = inboundStatus || this.getStatus();
12307
12321
  logger$3.info('broadcasting participant status', { callId: this.callId, status });
12308
12322
 
12323
+ if (sendReinvite && !this.streams.length && Phone$1.phone) {
12324
+ // eslint-disable-next-line no-underscore-dangle
12325
+ Phone$1.phone._sendReinviteMessage(this.room.callSession, false);
12326
+ }
12327
+
12309
12328
  this.room.sendSignal({
12310
12329
  type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
12311
12330
  origin: this.callId,
@@ -12948,7 +12967,7 @@ class Room$1 extends Emitter {
12948
12967
  // callId is null, someone's requesting everyone's state;
12949
12968
  // or callId is set and matches ours;
12950
12969
  if (this.localParticipant && (!callId || callId === this.localParticipant.callId)) {
12951
- this.localParticipant.broadcastStatus();
12970
+ this.localParticipant.broadcastStatus(null, true);
12952
12971
  }
12953
12972
 
12954
12973
  // might as well update the requester's status
@@ -13050,7 +13069,7 @@ class Room$1 extends Emitter {
13050
13069
 
13051
13070
  this.connected = true;
13052
13071
 
13053
- localParticipant.broadcastStatus();
13072
+ localParticipant.broadcastStatus(null, true);
13054
13073
 
13055
13074
  // we're in the room, now let's request everyone's status
13056
13075
  if (this.localParticipant) {
@@ -4616,6 +4616,8 @@ class CTIPhone extends Emitter {
4616
4616
  }
4617
4617
 
4618
4618
  useLocalVideoElement() {}
4619
+
4620
+ setMediaConstraints() {}
4619
4621
  }
4620
4622
 
4621
4623
  /* */
@@ -4793,6 +4795,11 @@ var dirdMethods = (client , baseUrl ) => ({
4793
4795
  listPersonalContacts: (queryParams = null) =>
4794
4796
  client.get(`${baseUrl}/personal`, queryParams).then(response => Contact.parseManyPersonal(response.items)),
4795
4797
 
4798
+ fetchPersonalContact: (contactUuid ) =>
4799
+ client
4800
+ .get(`${baseUrl}/personal/${contactUuid}`)
4801
+ .then(Contact.parsePersonal),
4802
+
4796
4803
  addContact: (contact ) =>
4797
4804
  client.post(`${baseUrl}/personal`, getContactPayload(contact)).then(Contact.parsePersonal),
4798
4805
 
@@ -7206,6 +7213,12 @@ class WebRTCClient extends Emitter {
7206
7213
  };
7207
7214
 
7208
7215
  const ua = new userAgent.UserAgent(webRTCConfiguration);
7216
+ if (ua.transport && ua.transport.connectPromise) {
7217
+ ua.transport.connectPromise.catch((e => {
7218
+ logger$8.warn('Transport connect error', e);
7219
+ }));
7220
+ }
7221
+
7209
7222
  ua.transport.onMessage = (rawMessage ) => {
7210
7223
  const message = parser.Parser.parseMessage(rawMessage, ua.transport.logger);
7211
7224
 
@@ -7427,6 +7440,7 @@ class WebRTCClient extends Emitter {
7427
7440
  conference,
7428
7441
  audioOnly,
7429
7442
  },
7443
+ earlyMedia: true,
7430
7444
  };
7431
7445
 
7432
7446
  if (audioOnly) {
@@ -12302,10 +12316,15 @@ class Participant extends Emitter {
12302
12316
  }
12303
12317
  }
12304
12318
 
12305
- broadcastStatus(inboundStatus = null) {
12319
+ broadcastStatus(inboundStatus = null, sendReinvite ) {
12306
12320
  const status = inboundStatus || this.getStatus();
12307
12321
  logger$3.info('broadcasting participant status', { callId: this.callId, status });
12308
12322
 
12323
+ if (sendReinvite && !this.streams.length && Phone$1.phone) {
12324
+ // eslint-disable-next-line no-underscore-dangle
12325
+ Phone$1.phone._sendReinviteMessage(this.room.callSession, false);
12326
+ }
12327
+
12309
12328
  this.room.sendSignal({
12310
12329
  type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
12311
12330
  origin: this.callId,
@@ -12948,7 +12967,7 @@ class Room$1 extends Emitter {
12948
12967
  // callId is null, someone's requesting everyone's state;
12949
12968
  // or callId is set and matches ours;
12950
12969
  if (this.localParticipant && (!callId || callId === this.localParticipant.callId)) {
12951
- this.localParticipant.broadcastStatus();
12970
+ this.localParticipant.broadcastStatus(null, true);
12952
12971
  }
12953
12972
 
12954
12973
  // might as well update the requester's status
@@ -13050,7 +13069,7 @@ class Room$1 extends Emitter {
13050
13069
 
13051
13070
  this.connected = true;
13052
13071
 
13053
- localParticipant.broadcastStatus();
13072
+ localParticipant.broadcastStatus(null, true);
13054
13073
 
13055
13074
  // we're in the room, now let's request everyone's status
13056
13075
  if (this.localParticipant) {
@@ -4618,6 +4618,8 @@ class CTIPhone extends Emitter {
4618
4618
  }
4619
4619
 
4620
4620
  useLocalVideoElement() {}
4621
+
4622
+ setMediaConstraints() {}
4621
4623
  }
4622
4624
 
4623
4625
  /* */
@@ -4795,6 +4797,11 @@ var dirdMethods = (client , baseUrl ) => ({
4795
4797
  listPersonalContacts: (queryParams = null) =>
4796
4798
  client.get(`${baseUrl}/personal`, queryParams).then(response => Contact.parseManyPersonal(response.items)),
4797
4799
 
4800
+ fetchPersonalContact: (contactUuid ) =>
4801
+ client
4802
+ .get(`${baseUrl}/personal/${contactUuid}`)
4803
+ .then(Contact.parsePersonal),
4804
+
4798
4805
  addContact: (contact ) =>
4799
4806
  client.post(`${baseUrl}/personal`, getContactPayload(contact)).then(Contact.parsePersonal),
4800
4807
 
@@ -7208,6 +7215,12 @@ class WebRTCClient extends Emitter {
7208
7215
  };
7209
7216
 
7210
7217
  const ua = new userAgent.UserAgent(webRTCConfiguration);
7218
+ if (ua.transport && ua.transport.connectPromise) {
7219
+ ua.transport.connectPromise.catch((e => {
7220
+ logger$8.warn('Transport connect error', e);
7221
+ }));
7222
+ }
7223
+
7211
7224
  ua.transport.onMessage = (rawMessage ) => {
7212
7225
  const message = parser.Parser.parseMessage(rawMessage, ua.transport.logger);
7213
7226
 
@@ -7429,6 +7442,7 @@ class WebRTCClient extends Emitter {
7429
7442
  conference,
7430
7443
  audioOnly,
7431
7444
  },
7445
+ earlyMedia: true,
7432
7446
  };
7433
7447
 
7434
7448
  if (audioOnly) {
@@ -12304,10 +12318,15 @@ class Participant extends Emitter {
12304
12318
  }
12305
12319
  }
12306
12320
 
12307
- broadcastStatus(inboundStatus = null) {
12321
+ broadcastStatus(inboundStatus = null, sendReinvite ) {
12308
12322
  const status = inboundStatus || this.getStatus();
12309
12323
  logger$3.info('broadcasting participant status', { callId: this.callId, status });
12310
12324
 
12325
+ if (sendReinvite && !this.streams.length && Phone$1.phone) {
12326
+ // eslint-disable-next-line no-underscore-dangle
12327
+ Phone$1.phone._sendReinviteMessage(this.room.callSession, false);
12328
+ }
12329
+
12311
12330
  this.room.sendSignal({
12312
12331
  type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
12313
12332
  origin: this.callId,
@@ -12950,7 +12969,7 @@ class Room$1 extends Emitter {
12950
12969
  // callId is null, someone's requesting everyone's state;
12951
12970
  // or callId is set and matches ours;
12952
12971
  if (this.localParticipant && (!callId || callId === this.localParticipant.callId)) {
12953
- this.localParticipant.broadcastStatus();
12972
+ this.localParticipant.broadcastStatus(null, true);
12954
12973
  }
12955
12974
 
12956
12975
  // might as well update the requester's status
@@ -13052,7 +13071,7 @@ class Room$1 extends Emitter {
13052
13071
 
13053
13072
  this.connected = true;
13054
13073
 
13055
- localParticipant.broadcastStatus();
13074
+ localParticipant.broadcastStatus(null, true);
13056
13075
 
13057
13076
  // we're in the room, now let's request everyone's status
13058
13077
  if (this.localParticipant) {
@@ -4540,6 +4540,11 @@ var dirdMethods = (client , baseUrl ) => ({
4540
4540
  listPersonalContacts: (queryParams = null) =>
4541
4541
  client.get(`${baseUrl}/personal`, queryParams).then(response => Contact.parseManyPersonal(response.items)),
4542
4542
 
4543
+ fetchPersonalContact: (contactUuid ) =>
4544
+ client
4545
+ .get(`${baseUrl}/personal/${contactUuid}`)
4546
+ .then(Contact.parsePersonal),
4547
+
4543
4548
  addContact: (contact ) =>
4544
4549
  client.post(`${baseUrl}/personal`, getContactPayload(contact)).then(Contact.parsePersonal),
4545
4550
 
@@ -5797,6 +5802,12 @@ class WebRTCClient extends Emitter {
5797
5802
  };
5798
5803
 
5799
5804
  const ua = new userAgent.UserAgent(webRTCConfiguration);
5805
+ if (ua.transport && ua.transport.connectPromise) {
5806
+ ua.transport.connectPromise.catch((e => {
5807
+ logger.warn('Transport connect error', e);
5808
+ }));
5809
+ }
5810
+
5800
5811
  ua.transport.onMessage = (rawMessage ) => {
5801
5812
  const message = parser.Parser.parseMessage(rawMessage, ua.transport.logger);
5802
5813
 
@@ -6018,6 +6029,7 @@ class WebRTCClient extends Emitter {
6018
6029
  conference,
6019
6030
  audioOnly,
6020
6031
  },
6032
+ earlyMedia: true,
6021
6033
  };
6022
6034
 
6023
6035
  if (audioOnly) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wazo/sdk",
3
- "version": "0.38.13",
3
+ "version": "0.38.16",
4
4
  "description": "Wazo's JavaScript Software Development Kit.",
5
5
  "main": "dist/wazo-sdk.js",
6
6
  "author": "Wazo (http://wazo.io)",
package/src/api/dird.js CHANGED
@@ -35,6 +35,11 @@ export default (client: ApiRequester, baseUrl: string) => ({
35
35
  listPersonalContacts: (queryParams: ContactSearchQueryParams = null): Promise<Array<Contact>> =>
36
36
  client.get(`${baseUrl}/personal`, queryParams).then(response => Contact.parseManyPersonal(response.items)),
37
37
 
38
+ fetchPersonalContact: (contactUuid: string): Promise<Contact> =>
39
+ client
40
+ .get(`${baseUrl}/personal/${contactUuid}`)
41
+ .then(Contact.parsePersonal),
42
+
38
43
  addContact: (contact: NewContact): Promise<Contact> =>
39
44
  client.post(`${baseUrl}/personal`, getContactPayload(contact)).then(Contact.parsePersonal),
40
45
 
@@ -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) {