@wazo/sdk 0.37.26 → 0.37.27

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 (104) hide show
  1. package/README.md +95 -57
  2. package/dist/wazo-sdk.js +3 -3
  3. package/esm/__tests__/api-client.test.js +1 -1
  4. package/esm/__tests__/web-rtc-client.test.js +9 -4
  5. package/esm/api/agentd.js +1 -1
  6. package/esm/api/amid.js +1 -1
  7. package/esm/api/application.js +1 -1
  8. package/esm/api/auth.js +1 -1
  9. package/esm/api/call-logd.js +1 -1
  10. package/esm/api/calld.js +1 -1
  11. package/esm/api/chatd.js +1 -1
  12. package/esm/api/confd.js +1 -1
  13. package/esm/api/ctid-ng.js +1 -1
  14. package/esm/api/dird.js +1 -1
  15. package/esm/api/webhookd.js +1 -1
  16. package/esm/api-client.js +1 -1
  17. package/esm/checker/Checker.js +9 -4
  18. package/esm/checker/checks/aor.js +1 -1
  19. package/esm/checker/checks/api.js +1 -1
  20. package/esm/checker/checks/index.js +9 -4
  21. package/esm/checker/checks/wazo-websocket.js +1 -1
  22. package/esm/checker/checks/webrtc-transport.js +9 -4
  23. package/esm/checker/checks/webrtc.js +9 -4
  24. package/esm/domain/AdHocAPIConference.js +1 -1
  25. package/esm/domain/Features.js +1 -1
  26. package/esm/domain/Phone/CTIPhone.js +1 -1
  27. package/esm/domain/Phone/WebRTCPhone.js +7 -3
  28. package/esm/index.js +15 -6
  29. package/esm/lib/WazoSessionDescriptionHandler.js +9 -4
  30. package/esm/service/CallApi.js +1 -1
  31. package/esm/service/IssueReporter.js +1 -1
  32. package/esm/service/__tests__/IssueReporter.test.js +1 -1
  33. package/esm/service/getApiClient.js +1 -1
  34. package/esm/simple/Auth.js +15 -6
  35. package/esm/simple/Configuration.js +15 -6
  36. package/esm/simple/Directory.js +1 -1
  37. package/esm/simple/Phone.js +15 -6
  38. package/esm/simple/Websocket.js +1 -1
  39. package/esm/simple/index.js +15 -6
  40. package/esm/simple/room/LocalParticipant.js +15 -6
  41. package/esm/simple/room/Participant.js +15 -6
  42. package/esm/simple/room/RemoteParticipant.js +15 -6
  43. package/esm/simple/room/Room.js +15 -6
  44. package/esm/simple/room/SipRoom.js +15 -6
  45. package/esm/simple/room/Stream.js +15 -6
  46. package/esm/simple/room/__tests__/RemoteParticipant.test.js +15 -6
  47. package/esm/simple/utils.js +15 -6
  48. package/esm/utils/__tests__/api-requester.test.js +1 -1
  49. package/esm/utils/api-requester.js +1 -1
  50. package/esm/web-rtc-client.js +9 -4
  51. package/esm/websocket-client.js +1 -1
  52. package/lib/__tests__/api-client.test.js +1 -1
  53. package/lib/__tests__/web-rtc-client.test.js +9 -4
  54. package/lib/api/agentd.js +1 -1
  55. package/lib/api/amid.js +1 -1
  56. package/lib/api/application.js +1 -1
  57. package/lib/api/auth.js +1 -1
  58. package/lib/api/call-logd.js +1 -1
  59. package/lib/api/calld.js +1 -1
  60. package/lib/api/chatd.js +1 -1
  61. package/lib/api/confd.js +1 -1
  62. package/lib/api/ctid-ng.js +1 -1
  63. package/lib/api/dird.js +1 -1
  64. package/lib/api/webhookd.js +1 -1
  65. package/lib/api-client.js +1 -1
  66. package/lib/checker/Checker.js +9 -4
  67. package/lib/checker/checks/aor.js +1 -1
  68. package/lib/checker/checks/api.js +1 -1
  69. package/lib/checker/checks/index.js +9 -4
  70. package/lib/checker/checks/wazo-websocket.js +1 -1
  71. package/lib/checker/checks/webrtc-transport.js +9 -4
  72. package/lib/checker/checks/webrtc.js +9 -4
  73. package/lib/domain/AdHocAPIConference.js +1 -1
  74. package/lib/domain/Features.js +1 -1
  75. package/lib/domain/Phone/CTIPhone.js +1 -1
  76. package/lib/domain/Phone/WebRTCPhone.js +7 -3
  77. package/lib/index.js +15 -6
  78. package/lib/lib/WazoSessionDescriptionHandler.js +9 -4
  79. package/lib/service/CallApi.js +1 -1
  80. package/lib/service/IssueReporter.js +1 -1
  81. package/lib/service/__tests__/IssueReporter.test.js +1 -1
  82. package/lib/service/getApiClient.js +1 -1
  83. package/lib/simple/Auth.js +15 -6
  84. package/lib/simple/Configuration.js +15 -6
  85. package/lib/simple/Directory.js +1 -1
  86. package/lib/simple/Phone.js +15 -6
  87. package/lib/simple/Websocket.js +1 -1
  88. package/lib/simple/index.js +15 -6
  89. package/lib/simple/room/LocalParticipant.js +15 -6
  90. package/lib/simple/room/Participant.js +15 -6
  91. package/lib/simple/room/RemoteParticipant.js +15 -6
  92. package/lib/simple/room/Room.js +15 -6
  93. package/lib/simple/room/SipRoom.js +15 -6
  94. package/lib/simple/room/Stream.js +15 -6
  95. package/lib/simple/room/__tests__/RemoteParticipant.test.js +15 -6
  96. package/lib/simple/utils.js +15 -6
  97. package/lib/utils/__tests__/api-requester.test.js +1 -1
  98. package/lib/utils/api-requester.js +1 -1
  99. package/lib/web-rtc-client.js +9 -4
  100. package/lib/websocket-client.js +1 -1
  101. package/package.json +1 -1
  102. package/src/domain/Phone/WebRTCPhone.js +6 -2
  103. package/src/lib/WazoSessionDescriptionHandler.js +8 -3
  104. package/src/utils/api-requester.js +1 -1
@@ -684,6 +684,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
684
684
  _onCallTerminated(sipSession: Session) {
685
685
  logger.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
686
686
 
687
+ const sipSessionId = this.getSipSessionId(sipSession);
687
688
  const callSession = this._createCallSession(sipSession);
688
689
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
689
690
  const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
@@ -701,7 +702,6 @@ export default class WebRTCPhone extends Emitter implements Phone {
701
702
  }, 5);
702
703
  }
703
704
 
704
- const sipSessionId = this.getSipSessionId(sipSession);
705
705
  if (sipSessionId) {
706
706
  this.removeIncomingSessions(sipSessionId);
707
707
  }
@@ -1346,8 +1346,12 @@ export default class WebRTCPhone extends Emitter implements Phone {
1346
1346
  }
1347
1347
 
1348
1348
  const sessionId = this.incomingSessions[0];
1349
+ const sipSession = this.client.getSipSession(sessionId);
1350
+ if (!sipSession) {
1351
+ return null;
1352
+ }
1349
1353
 
1350
- return this._createCallSession(this.client.getSipSession(sessionId));
1354
+ return this._createCallSession(sipSession);
1351
1355
  }
1352
1356
 
1353
1357
  sendMessage(sipSession: Session = null, body: string, contentType: string = 'text/plain') {
@@ -62,11 +62,16 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
62
62
 
63
63
  // $FlowFixMe
64
64
  setRemoteSessionDescription(sessionDescription: RTCSessionDescriptionInit): Promise<void> {
65
- const result = super.setRemoteSessionDescription(sessionDescription);
65
+ try {
66
+ const result = super.setRemoteSessionDescription(sessionDescription);
66
67
 
67
- this.eventEmitter.emit('setDescription', sessionDescription);
68
+ this.eventEmitter.emit('setDescription', sessionDescription);
68
69
 
69
- return result;
70
+ return result;
71
+ } catch (error) {
72
+ this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
73
+ throw error;
74
+ }
70
75
  }
71
76
 
72
77
  // Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
@@ -25,7 +25,7 @@ const logger = IssueReporter ? IssueReporter.loggerFor('api') : console;
25
25
 
26
26
  // Use a function here to be able to mock it in tests
27
27
  export const realFetch = () => {
28
- if (typeof document !== 'undefined') {
28
+ if (typeof document !== 'undefined' && window.fetch) {
29
29
  // Browser
30
30
  return window.fetch;
31
31
  }