@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
@@ -1038,7 +1038,7 @@ const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
1038
1038
 
1039
1039
  // Use a function here to be able to mock it in tests
1040
1040
  const realFetch = () => {
1041
- if (typeof document !== 'undefined') {
1041
+ if (typeof document !== 'undefined' && window.fetch) {
1042
1042
  // Browser
1043
1043
  return window.fetch;
1044
1044
  }
@@ -5808,11 +5808,16 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
5808
5808
 
5809
5809
  // $FlowFixMe
5810
5810
  setRemoteSessionDescription(sessionDescription ) {
5811
- const result = super.setRemoteSessionDescription(sessionDescription);
5811
+ try {
5812
+ const result = super.setRemoteSessionDescription(sessionDescription);
5812
5813
 
5813
- this.eventEmitter.emit('setDescription', sessionDescription);
5814
+ this.eventEmitter.emit('setDescription', sessionDescription);
5814
5815
 
5815
- return result;
5816
+ return result;
5817
+ } catch (error) {
5818
+ this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
5819
+ throw error;
5820
+ }
5816
5821
  }
5817
5822
 
5818
5823
  // Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
@@ -9116,6 +9121,7 @@ class WebRTCPhone extends Emitter {
9116
9121
  _onCallTerminated(sipSession ) {
9117
9122
  logger$8.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9118
9123
 
9124
+ const sipSessionId = this.getSipSessionId(sipSession);
9119
9125
  const callSession = this._createCallSession(sipSession);
9120
9126
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
9121
9127
  const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
@@ -9133,7 +9139,6 @@ class WebRTCPhone extends Emitter {
9133
9139
  }, 5);
9134
9140
  }
9135
9141
 
9136
- const sipSessionId = this.getSipSessionId(sipSession);
9137
9142
  if (sipSessionId) {
9138
9143
  this.removeIncomingSessions(sipSessionId);
9139
9144
  }
@@ -9778,8 +9783,12 @@ class WebRTCPhone extends Emitter {
9778
9783
  }
9779
9784
 
9780
9785
  const sessionId = this.incomingSessions[0];
9786
+ const sipSession = this.client.getSipSession(sessionId);
9787
+ if (!sipSession) {
9788
+ return null;
9789
+ }
9781
9790
 
9782
- return this._createCallSession(this.client.getSipSession(sessionId));
9791
+ return this._createCallSession(sipSession);
9783
9792
  }
9784
9793
 
9785
9794
  sendMessage(sipSession = null, body , contentType = 'text/plain') {
@@ -47,7 +47,7 @@ IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
47
47
 
48
48
  // Use a function here to be able to mock it in tests
49
49
  const realFetch = () => {
50
- if (typeof document !== 'undefined') {
50
+ if (typeof document !== 'undefined' && window.fetch) {
51
51
  // Browser
52
52
  return window.fetch;
53
53
  }
@@ -1961,7 +1961,7 @@ const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
1961
1961
 
1962
1962
  // Use a function here to be able to mock it in tests
1963
1963
  const realFetch = () => {
1964
- if (typeof document !== 'undefined') {
1964
+ if (typeof document !== 'undefined' && window.fetch) {
1965
1965
  // Browser
1966
1966
  return window.fetch;
1967
1967
  }
@@ -6072,11 +6072,16 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
6072
6072
 
6073
6073
  // $FlowFixMe
6074
6074
  setRemoteSessionDescription(sessionDescription ) {
6075
- const result = super.setRemoteSessionDescription(sessionDescription);
6075
+ try {
6076
+ const result = super.setRemoteSessionDescription(sessionDescription);
6076
6077
 
6077
- this.eventEmitter.emit('setDescription', sessionDescription);
6078
+ this.eventEmitter.emit('setDescription', sessionDescription);
6078
6079
 
6079
- return result;
6080
+ return result;
6081
+ } catch (error) {
6082
+ this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
6083
+ throw error;
6084
+ }
6080
6085
  }
6081
6086
 
6082
6087
  // Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
@@ -9380,6 +9385,7 @@ class WebRTCPhone extends Emitter {
9380
9385
  _onCallTerminated(sipSession ) {
9381
9386
  logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9382
9387
 
9388
+ const sipSessionId = this.getSipSessionId(sipSession);
9383
9389
  const callSession = this._createCallSession(sipSession);
9384
9390
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
9385
9391
  const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
@@ -9397,7 +9403,6 @@ class WebRTCPhone extends Emitter {
9397
9403
  }, 5);
9398
9404
  }
9399
9405
 
9400
- const sipSessionId = this.getSipSessionId(sipSession);
9401
9406
  if (sipSessionId) {
9402
9407
  this.removeIncomingSessions(sipSessionId);
9403
9408
  }
@@ -10042,8 +10047,12 @@ class WebRTCPhone extends Emitter {
10042
10047
  }
10043
10048
 
10044
10049
  const sessionId = this.incomingSessions[0];
10050
+ const sipSession = this.client.getSipSession(sessionId);
10051
+ if (!sipSession) {
10052
+ return null;
10053
+ }
10045
10054
 
10046
- return this._createCallSession(this.client.getSipSession(sessionId));
10055
+ return this._createCallSession(sipSession);
10047
10056
  }
10048
10057
 
10049
10058
  sendMessage(sipSession = null, body , contentType = 'text/plain') {
@@ -142,7 +142,7 @@ const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
142
142
 
143
143
  // Use a function here to be able to mock it in tests
144
144
  const realFetch = () => {
145
- if (typeof document !== 'undefined') {
145
+ if (typeof document !== 'undefined' && window.fetch) {
146
146
  // Browser
147
147
  return window.fetch;
148
148
  }
@@ -6072,11 +6072,16 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
6072
6072
 
6073
6073
  // $FlowFixMe
6074
6074
  setRemoteSessionDescription(sessionDescription ) {
6075
- const result = super.setRemoteSessionDescription(sessionDescription);
6075
+ try {
6076
+ const result = super.setRemoteSessionDescription(sessionDescription);
6076
6077
 
6077
- this.eventEmitter.emit('setDescription', sessionDescription);
6078
+ this.eventEmitter.emit('setDescription', sessionDescription);
6078
6079
 
6079
- return result;
6080
+ return result;
6081
+ } catch (error) {
6082
+ this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
6083
+ throw error;
6084
+ }
6080
6085
  }
6081
6086
 
6082
6087
  // Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
@@ -9380,6 +9385,7 @@ class WebRTCPhone extends Emitter {
9380
9385
  _onCallTerminated(sipSession ) {
9381
9386
  logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9382
9387
 
9388
+ const sipSessionId = this.getSipSessionId(sipSession);
9383
9389
  const callSession = this._createCallSession(sipSession);
9384
9390
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
9385
9391
  const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
@@ -9397,7 +9403,6 @@ class WebRTCPhone extends Emitter {
9397
9403
  }, 5);
9398
9404
  }
9399
9405
 
9400
- const sipSessionId = this.getSipSessionId(sipSession);
9401
9406
  if (sipSessionId) {
9402
9407
  this.removeIncomingSessions(sipSessionId);
9403
9408
  }
@@ -10042,8 +10047,12 @@ class WebRTCPhone extends Emitter {
10042
10047
  }
10043
10048
 
10044
10049
  const sessionId = this.incomingSessions[0];
10050
+ const sipSession = this.client.getSipSession(sessionId);
10051
+ if (!sipSession) {
10052
+ return null;
10053
+ }
10045
10054
 
10046
- return this._createCallSession(this.client.getSipSession(sessionId));
10055
+ return this._createCallSession(sipSession);
10047
10056
  }
10048
10057
 
10049
10058
  sendMessage(sipSession = null, body , contentType = 'text/plain') {
@@ -142,7 +142,7 @@ const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
142
142
 
143
143
  // Use a function here to be able to mock it in tests
144
144
  const realFetch = () => {
145
- if (typeof document !== 'undefined') {
145
+ if (typeof document !== 'undefined' && window.fetch) {
146
146
  // Browser
147
147
  return window.fetch;
148
148
  }
@@ -6072,11 +6072,16 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
6072
6072
 
6073
6073
  // $FlowFixMe
6074
6074
  setRemoteSessionDescription(sessionDescription ) {
6075
- const result = super.setRemoteSessionDescription(sessionDescription);
6075
+ try {
6076
+ const result = super.setRemoteSessionDescription(sessionDescription);
6076
6077
 
6077
- this.eventEmitter.emit('setDescription', sessionDescription);
6078
+ this.eventEmitter.emit('setDescription', sessionDescription);
6078
6079
 
6079
- return result;
6080
+ return result;
6081
+ } catch (error) {
6082
+ this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
6083
+ throw error;
6084
+ }
6080
6085
  }
6081
6086
 
6082
6087
  // Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
@@ -9380,6 +9385,7 @@ class WebRTCPhone extends Emitter {
9380
9385
  _onCallTerminated(sipSession ) {
9381
9386
  logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9382
9387
 
9388
+ const sipSessionId = this.getSipSessionId(sipSession);
9383
9389
  const callSession = this._createCallSession(sipSession);
9384
9390
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
9385
9391
  const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
@@ -9397,7 +9403,6 @@ class WebRTCPhone extends Emitter {
9397
9403
  }, 5);
9398
9404
  }
9399
9405
 
9400
- const sipSessionId = this.getSipSessionId(sipSession);
9401
9406
  if (sipSessionId) {
9402
9407
  this.removeIncomingSessions(sipSessionId);
9403
9408
  }
@@ -10042,8 +10047,12 @@ class WebRTCPhone extends Emitter {
10042
10047
  }
10043
10048
 
10044
10049
  const sessionId = this.incomingSessions[0];
10050
+ const sipSession = this.client.getSipSession(sessionId);
10051
+ if (!sipSession) {
10052
+ return null;
10053
+ }
10045
10054
 
10046
- return this._createCallSession(this.client.getSipSession(sessionId));
10055
+ return this._createCallSession(sipSession);
10047
10056
  }
10048
10057
 
10049
10058
  sendMessage(sipSession = null, body , contentType = 'text/plain') {
@@ -473,7 +473,7 @@ const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
473
473
 
474
474
  // Use a function here to be able to mock it in tests
475
475
  const realFetch = () => {
476
- if (typeof document !== 'undefined') {
476
+ if (typeof document !== 'undefined' && window.fetch) {
477
477
  // Browser
478
478
  return window.fetch;
479
479
  }
@@ -6072,11 +6072,16 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
6072
6072
 
6073
6073
  // $FlowFixMe
6074
6074
  setRemoteSessionDescription(sessionDescription ) {
6075
- const result = super.setRemoteSessionDescription(sessionDescription);
6075
+ try {
6076
+ const result = super.setRemoteSessionDescription(sessionDescription);
6076
6077
 
6077
- this.eventEmitter.emit('setDescription', sessionDescription);
6078
+ this.eventEmitter.emit('setDescription', sessionDescription);
6078
6079
 
6079
- return result;
6080
+ return result;
6081
+ } catch (error) {
6082
+ this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
6083
+ throw error;
6084
+ }
6080
6085
  }
6081
6086
 
6082
6087
  // Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
@@ -9380,6 +9385,7 @@ class WebRTCPhone extends Emitter {
9380
9385
  _onCallTerminated(sipSession ) {
9381
9386
  logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9382
9387
 
9388
+ const sipSessionId = this.getSipSessionId(sipSession);
9383
9389
  const callSession = this._createCallSession(sipSession);
9384
9390
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
9385
9391
  const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
@@ -9397,7 +9403,6 @@ class WebRTCPhone extends Emitter {
9397
9403
  }, 5);
9398
9404
  }
9399
9405
 
9400
- const sipSessionId = this.getSipSessionId(sipSession);
9401
9406
  if (sipSessionId) {
9402
9407
  this.removeIncomingSessions(sipSessionId);
9403
9408
  }
@@ -10042,8 +10047,12 @@ class WebRTCPhone extends Emitter {
10042
10047
  }
10043
10048
 
10044
10049
  const sessionId = this.incomingSessions[0];
10050
+ const sipSession = this.client.getSipSession(sessionId);
10051
+ if (!sipSession) {
10052
+ return null;
10053
+ }
10045
10054
 
10046
- return this._createCallSession(this.client.getSipSession(sessionId));
10055
+ return this._createCallSession(sipSession);
10047
10056
  }
10048
10057
 
10049
10058
  sendMessage(sipSession = null, body , contentType = 'text/plain') {
@@ -475,7 +475,7 @@ const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
475
475
 
476
476
  // Use a function here to be able to mock it in tests
477
477
  const realFetch = () => {
478
- if (typeof document !== 'undefined') {
478
+ if (typeof document !== 'undefined' && window.fetch) {
479
479
  // Browser
480
480
  return window.fetch;
481
481
  }
@@ -6074,11 +6074,16 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
6074
6074
 
6075
6075
  // $FlowFixMe
6076
6076
  setRemoteSessionDescription(sessionDescription ) {
6077
- const result = super.setRemoteSessionDescription(sessionDescription);
6077
+ try {
6078
+ const result = super.setRemoteSessionDescription(sessionDescription);
6078
6079
 
6079
- this.eventEmitter.emit('setDescription', sessionDescription);
6080
+ this.eventEmitter.emit('setDescription', sessionDescription);
6080
6081
 
6081
- return result;
6082
+ return result;
6083
+ } catch (error) {
6084
+ this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
6085
+ throw error;
6086
+ }
6082
6087
  }
6083
6088
 
6084
6089
  // Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
@@ -9382,6 +9387,7 @@ class WebRTCPhone extends Emitter {
9382
9387
  _onCallTerminated(sipSession ) {
9383
9388
  logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9384
9389
 
9390
+ const sipSessionId = this.getSipSessionId(sipSession);
9385
9391
  const callSession = this._createCallSession(sipSession);
9386
9392
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
9387
9393
  const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
@@ -9399,7 +9405,6 @@ class WebRTCPhone extends Emitter {
9399
9405
  }, 5);
9400
9406
  }
9401
9407
 
9402
- const sipSessionId = this.getSipSessionId(sipSession);
9403
9408
  if (sipSessionId) {
9404
9409
  this.removeIncomingSessions(sipSessionId);
9405
9410
  }
@@ -10044,8 +10049,12 @@ class WebRTCPhone extends Emitter {
10044
10049
  }
10045
10050
 
10046
10051
  const sessionId = this.incomingSessions[0];
10052
+ const sipSession = this.client.getSipSession(sessionId);
10053
+ if (!sipSession) {
10054
+ return null;
10055
+ }
10047
10056
 
10048
- return this._createCallSession(this.client.getSipSession(sessionId));
10057
+ return this._createCallSession(sipSession);
10049
10058
  }
10050
10059
 
10051
10060
  sendMessage(sipSession = null, body , contentType = 'text/plain') {
@@ -116,7 +116,7 @@ const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
116
116
 
117
117
  // Use a function here to be able to mock it in tests
118
118
  const realFetch = () => {
119
- if (typeof document !== 'undefined') {
119
+ if (typeof document !== 'undefined' && window.fetch) {
120
120
  // Browser
121
121
  return window.fetch;
122
122
  }
@@ -6072,11 +6072,16 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
6072
6072
 
6073
6073
  // $FlowFixMe
6074
6074
  setRemoteSessionDescription(sessionDescription ) {
6075
- const result = super.setRemoteSessionDescription(sessionDescription);
6075
+ try {
6076
+ const result = super.setRemoteSessionDescription(sessionDescription);
6076
6077
 
6077
- this.eventEmitter.emit('setDescription', sessionDescription);
6078
+ this.eventEmitter.emit('setDescription', sessionDescription);
6078
6079
 
6079
- return result;
6080
+ return result;
6081
+ } catch (error) {
6082
+ this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
6083
+ throw error;
6084
+ }
6080
6085
  }
6081
6086
 
6082
6087
  // Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
@@ -9380,6 +9385,7 @@ class WebRTCPhone extends Emitter {
9380
9385
  _onCallTerminated(sipSession ) {
9381
9386
  logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9382
9387
 
9388
+ const sipSessionId = this.getSipSessionId(sipSession);
9383
9389
  const callSession = this._createCallSession(sipSession);
9384
9390
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
9385
9391
  const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
@@ -9397,7 +9403,6 @@ class WebRTCPhone extends Emitter {
9397
9403
  }, 5);
9398
9404
  }
9399
9405
 
9400
- const sipSessionId = this.getSipSessionId(sipSession);
9401
9406
  if (sipSessionId) {
9402
9407
  this.removeIncomingSessions(sipSessionId);
9403
9408
  }
@@ -10042,8 +10047,12 @@ class WebRTCPhone extends Emitter {
10042
10047
  }
10043
10048
 
10044
10049
  const sessionId = this.incomingSessions[0];
10050
+ const sipSession = this.client.getSipSession(sessionId);
10051
+ if (!sipSession) {
10052
+ return null;
10053
+ }
10045
10054
 
10046
- return this._createCallSession(this.client.getSipSession(sessionId));
10055
+ return this._createCallSession(sipSession);
10047
10056
  }
10048
10057
 
10049
10058
  sendMessage(sipSession = null, body , contentType = 'text/plain') {
@@ -1961,7 +1961,7 @@ const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
1961
1961
 
1962
1962
  // Use a function here to be able to mock it in tests
1963
1963
  const realFetch = () => {
1964
- if (typeof document !== 'undefined') {
1964
+ if (typeof document !== 'undefined' && window.fetch) {
1965
1965
  // Browser
1966
1966
  return window.fetch;
1967
1967
  }
@@ -6072,11 +6072,16 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
6072
6072
 
6073
6073
  // $FlowFixMe
6074
6074
  setRemoteSessionDescription(sessionDescription ) {
6075
- const result = super.setRemoteSessionDescription(sessionDescription);
6075
+ try {
6076
+ const result = super.setRemoteSessionDescription(sessionDescription);
6076
6077
 
6077
- this.eventEmitter.emit('setDescription', sessionDescription);
6078
+ this.eventEmitter.emit('setDescription', sessionDescription);
6078
6079
 
6079
- return result;
6080
+ return result;
6081
+ } catch (error) {
6082
+ this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
6083
+ throw error;
6084
+ }
6080
6085
  }
6081
6086
 
6082
6087
  // Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
@@ -9380,6 +9385,7 @@ class WebRTCPhone extends Emitter {
9380
9385
  _onCallTerminated(sipSession ) {
9381
9386
  logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9382
9387
 
9388
+ const sipSessionId = this.getSipSessionId(sipSession);
9383
9389
  const callSession = this._createCallSession(sipSession);
9384
9390
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
9385
9391
  const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
@@ -9397,7 +9403,6 @@ class WebRTCPhone extends Emitter {
9397
9403
  }, 5);
9398
9404
  }
9399
9405
 
9400
- const sipSessionId = this.getSipSessionId(sipSession);
9401
9406
  if (sipSessionId) {
9402
9407
  this.removeIncomingSessions(sipSessionId);
9403
9408
  }
@@ -10042,8 +10047,12 @@ class WebRTCPhone extends Emitter {
10042
10047
  }
10043
10048
 
10044
10049
  const sessionId = this.incomingSessions[0];
10050
+ const sipSession = this.client.getSipSession(sessionId);
10051
+ if (!sipSession) {
10052
+ return null;
10053
+ }
10045
10054
 
10046
- return this._createCallSession(this.client.getSipSession(sessionId));
10055
+ return this._createCallSession(sipSession);
10047
10056
  }
10048
10057
 
10049
10058
  sendMessage(sipSession = null, body , contentType = 'text/plain') {
@@ -1961,7 +1961,7 @@ const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
1961
1961
 
1962
1962
  // Use a function here to be able to mock it in tests
1963
1963
  const realFetch = () => {
1964
- if (typeof document !== 'undefined') {
1964
+ if (typeof document !== 'undefined' && window.fetch) {
1965
1965
  // Browser
1966
1966
  return window.fetch;
1967
1967
  }
@@ -6072,11 +6072,16 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
6072
6072
 
6073
6073
  // $FlowFixMe
6074
6074
  setRemoteSessionDescription(sessionDescription ) {
6075
- const result = super.setRemoteSessionDescription(sessionDescription);
6075
+ try {
6076
+ const result = super.setRemoteSessionDescription(sessionDescription);
6076
6077
 
6077
- this.eventEmitter.emit('setDescription', sessionDescription);
6078
+ this.eventEmitter.emit('setDescription', sessionDescription);
6078
6079
 
6079
- return result;
6080
+ return result;
6081
+ } catch (error) {
6082
+ this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
6083
+ throw error;
6084
+ }
6080
6085
  }
6081
6086
 
6082
6087
  // Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
@@ -9380,6 +9385,7 @@ class WebRTCPhone extends Emitter {
9380
9385
  _onCallTerminated(sipSession ) {
9381
9386
  logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9382
9387
 
9388
+ const sipSessionId = this.getSipSessionId(sipSession);
9383
9389
  const callSession = this._createCallSession(sipSession);
9384
9390
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
9385
9391
  const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
@@ -9397,7 +9403,6 @@ class WebRTCPhone extends Emitter {
9397
9403
  }, 5);
9398
9404
  }
9399
9405
 
9400
- const sipSessionId = this.getSipSessionId(sipSession);
9401
9406
  if (sipSessionId) {
9402
9407
  this.removeIncomingSessions(sipSessionId);
9403
9408
  }
@@ -10042,8 +10047,12 @@ class WebRTCPhone extends Emitter {
10042
10047
  }
10043
10048
 
10044
10049
  const sessionId = this.incomingSessions[0];
10050
+ const sipSession = this.client.getSipSession(sessionId);
10051
+ if (!sipSession) {
10052
+ return null;
10053
+ }
10045
10054
 
10046
- return this._createCallSession(this.client.getSipSession(sessionId));
10055
+ return this._createCallSession(sipSession);
10047
10056
  }
10048
10057
 
10049
10058
  sendMessage(sipSession = null, body , contentType = 'text/plain') {
@@ -1963,7 +1963,7 @@ const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
1963
1963
 
1964
1964
  // Use a function here to be able to mock it in tests
1965
1965
  const realFetch = () => {
1966
- if (typeof document !== 'undefined') {
1966
+ if (typeof document !== 'undefined' && window.fetch) {
1967
1967
  // Browser
1968
1968
  return window.fetch;
1969
1969
  }
@@ -6074,11 +6074,16 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
6074
6074
 
6075
6075
  // $FlowFixMe
6076
6076
  setRemoteSessionDescription(sessionDescription ) {
6077
- const result = super.setRemoteSessionDescription(sessionDescription);
6077
+ try {
6078
+ const result = super.setRemoteSessionDescription(sessionDescription);
6078
6079
 
6079
- this.eventEmitter.emit('setDescription', sessionDescription);
6080
+ this.eventEmitter.emit('setDescription', sessionDescription);
6080
6081
 
6081
- return result;
6082
+ return result;
6083
+ } catch (error) {
6084
+ this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
6085
+ throw error;
6086
+ }
6082
6087
  }
6083
6088
 
6084
6089
  // Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
@@ -9382,6 +9387,7 @@ class WebRTCPhone extends Emitter {
9382
9387
  _onCallTerminated(sipSession ) {
9383
9388
  logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9384
9389
 
9390
+ const sipSessionId = this.getSipSessionId(sipSession);
9385
9391
  const callSession = this._createCallSession(sipSession);
9386
9392
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
9387
9393
  const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
@@ -9399,7 +9405,6 @@ class WebRTCPhone extends Emitter {
9399
9405
  }, 5);
9400
9406
  }
9401
9407
 
9402
- const sipSessionId = this.getSipSessionId(sipSession);
9403
9408
  if (sipSessionId) {
9404
9409
  this.removeIncomingSessions(sipSessionId);
9405
9410
  }
@@ -10044,8 +10049,12 @@ class WebRTCPhone extends Emitter {
10044
10049
  }
10045
10050
 
10046
10051
  const sessionId = this.incomingSessions[0];
10052
+ const sipSession = this.client.getSipSession(sessionId);
10053
+ if (!sipSession) {
10054
+ return null;
10055
+ }
10047
10056
 
10048
- return this._createCallSession(this.client.getSipSession(sessionId));
10057
+ return this._createCallSession(sipSession);
10049
10058
  }
10050
10059
 
10051
10060
  sendMessage(sipSession = null, body , contentType = 'text/plain') {
@@ -446,7 +446,7 @@ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
446
446
 
447
447
  // Use a function here to be able to mock it in tests
448
448
  const realFetch = () => {
449
- if (typeof document !== 'undefined') {
449
+ if (typeof document !== 'undefined' && window.fetch) {
450
450
  // Browser
451
451
  return window.fetch;
452
452
  }
@@ -448,7 +448,7 @@ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
448
448
 
449
449
  // Use a function here to be able to mock it in tests
450
450
  const realFetch = () => {
451
- if (typeof document !== 'undefined') {
451
+ if (typeof document !== 'undefined' && window.fetch) {
452
452
  // Browser
453
453
  return window.fetch;
454
454
  }
@@ -115,7 +115,7 @@ const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
115
115
 
116
116
  // Use a function here to be able to mock it in tests
117
117
  const realFetch = () => {
118
- if (typeof document !== 'undefined') {
118
+ if (typeof document !== 'undefined' && window.fetch) {
119
119
  // Browser
120
120
  return window.fetch;
121
121
  }
@@ -834,11 +834,16 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
834
834
 
835
835
  // $FlowFixMe
836
836
  setRemoteSessionDescription(sessionDescription ) {
837
- const result = super.setRemoteSessionDescription(sessionDescription);
837
+ try {
838
+ const result = super.setRemoteSessionDescription(sessionDescription);
838
839
 
839
- this.eventEmitter.emit('setDescription', sessionDescription);
840
+ this.eventEmitter.emit('setDescription', sessionDescription);
840
841
 
841
- return result;
842
+ return result;
843
+ } catch (error) {
844
+ this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
845
+ throw error;
846
+ }
842
847
  }
843
848
 
844
849
  // Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
@@ -49,7 +49,7 @@ IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
49
49
 
50
50
  // Use a function here to be able to mock it in tests
51
51
  const realFetch = () => {
52
- if (typeof document !== 'undefined') {
52
+ if (typeof document !== 'undefined' && window.fetch) {
53
53
  // Browser
54
54
  return window.fetch;
55
55
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wazo/sdk",
3
- "version": "0.37.26",
3
+ "version": "0.37.27",
4
4
  "description": "Wazo's JavaScript Software Development Kit.",
5
5
  "main": "dist/wazo-sdk.js",
6
6
  "author": "Wazo (http://wazo.io)",