@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
@@ -1028,7 +1028,7 @@ const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
1028
1028
 
1029
1029
  // Use a function here to be able to mock it in tests
1030
1030
  const realFetch = () => {
1031
- if (typeof document !== 'undefined') {
1031
+ if (typeof document !== 'undefined' && window.fetch) {
1032
1032
  // Browser
1033
1033
  return window.fetch;
1034
1034
  }
@@ -5798,11 +5798,16 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
5798
5798
 
5799
5799
  // $FlowFixMe
5800
5800
  setRemoteSessionDescription(sessionDescription ) {
5801
- const result = super.setRemoteSessionDescription(sessionDescription);
5801
+ try {
5802
+ const result = super.setRemoteSessionDescription(sessionDescription);
5802
5803
 
5803
- this.eventEmitter.emit('setDescription', sessionDescription);
5804
+ this.eventEmitter.emit('setDescription', sessionDescription);
5804
5805
 
5805
- return result;
5806
+ return result;
5807
+ } catch (error) {
5808
+ this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
5809
+ throw error;
5810
+ }
5806
5811
  }
5807
5812
 
5808
5813
  // Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
@@ -9106,6 +9111,7 @@ class WebRTCPhone extends Emitter {
9106
9111
  _onCallTerminated(sipSession ) {
9107
9112
  logger$8.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9108
9113
 
9114
+ const sipSessionId = this.getSipSessionId(sipSession);
9109
9115
  const callSession = this._createCallSession(sipSession);
9110
9116
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
9111
9117
  const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
@@ -9123,7 +9129,6 @@ class WebRTCPhone extends Emitter {
9123
9129
  }, 5);
9124
9130
  }
9125
9131
 
9126
- const sipSessionId = this.getSipSessionId(sipSession);
9127
9132
  if (sipSessionId) {
9128
9133
  this.removeIncomingSessions(sipSessionId);
9129
9134
  }
@@ -9768,8 +9773,12 @@ class WebRTCPhone extends Emitter {
9768
9773
  }
9769
9774
 
9770
9775
  const sessionId = this.incomingSessions[0];
9776
+ const sipSession = this.client.getSipSession(sessionId);
9777
+ if (!sipSession) {
9778
+ return null;
9779
+ }
9771
9780
 
9772
- return this._createCallSession(this.client.getSipSession(sessionId));
9781
+ return this._createCallSession(sipSession);
9773
9782
  }
9774
9783
 
9775
9784
  sendMessage(sipSession = null, body , contentType = 'text/plain') {
@@ -39,7 +39,7 @@ IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
39
39
 
40
40
  // Use a function here to be able to mock it in tests
41
41
  const realFetch = () => {
42
- if (typeof document !== 'undefined') {
42
+ if (typeof document !== 'undefined' && window.fetch) {
43
43
  // Browser
44
44
  return window.fetch;
45
45
  }
@@ -1951,7 +1951,7 @@ const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
1951
1951
 
1952
1952
  // Use a function here to be able to mock it in tests
1953
1953
  const realFetch = () => {
1954
- if (typeof document !== 'undefined') {
1954
+ if (typeof document !== 'undefined' && window.fetch) {
1955
1955
  // Browser
1956
1956
  return window.fetch;
1957
1957
  }
@@ -6062,11 +6062,16 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
6062
6062
 
6063
6063
  // $FlowFixMe
6064
6064
  setRemoteSessionDescription(sessionDescription ) {
6065
- const result = super.setRemoteSessionDescription(sessionDescription);
6065
+ try {
6066
+ const result = super.setRemoteSessionDescription(sessionDescription);
6066
6067
 
6067
- this.eventEmitter.emit('setDescription', sessionDescription);
6068
+ this.eventEmitter.emit('setDescription', sessionDescription);
6068
6069
 
6069
- return result;
6070
+ return result;
6071
+ } catch (error) {
6072
+ this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
6073
+ throw error;
6074
+ }
6070
6075
  }
6071
6076
 
6072
6077
  // Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
@@ -9370,6 +9375,7 @@ class WebRTCPhone extends Emitter {
9370
9375
  _onCallTerminated(sipSession ) {
9371
9376
  logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9372
9377
 
9378
+ const sipSessionId = this.getSipSessionId(sipSession);
9373
9379
  const callSession = this._createCallSession(sipSession);
9374
9380
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
9375
9381
  const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
@@ -9387,7 +9393,6 @@ class WebRTCPhone extends Emitter {
9387
9393
  }, 5);
9388
9394
  }
9389
9395
 
9390
- const sipSessionId = this.getSipSessionId(sipSession);
9391
9396
  if (sipSessionId) {
9392
9397
  this.removeIncomingSessions(sipSessionId);
9393
9398
  }
@@ -10032,8 +10037,12 @@ class WebRTCPhone extends Emitter {
10032
10037
  }
10033
10038
 
10034
10039
  const sessionId = this.incomingSessions[0];
10040
+ const sipSession = this.client.getSipSession(sessionId);
10041
+ if (!sipSession) {
10042
+ return null;
10043
+ }
10035
10044
 
10036
- return this._createCallSession(this.client.getSipSession(sessionId));
10045
+ return this._createCallSession(sipSession);
10037
10046
  }
10038
10047
 
10039
10048
  sendMessage(sipSession = null, body , contentType = 'text/plain') {
@@ -132,7 +132,7 @@ const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
132
132
 
133
133
  // Use a function here to be able to mock it in tests
134
134
  const realFetch = () => {
135
- if (typeof document !== 'undefined') {
135
+ if (typeof document !== 'undefined' && window.fetch) {
136
136
  // Browser
137
137
  return window.fetch;
138
138
  }
@@ -6062,11 +6062,16 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
6062
6062
 
6063
6063
  // $FlowFixMe
6064
6064
  setRemoteSessionDescription(sessionDescription ) {
6065
- const result = super.setRemoteSessionDescription(sessionDescription);
6065
+ try {
6066
+ const result = super.setRemoteSessionDescription(sessionDescription);
6066
6067
 
6067
- this.eventEmitter.emit('setDescription', sessionDescription);
6068
+ this.eventEmitter.emit('setDescription', sessionDescription);
6068
6069
 
6069
- return result;
6070
+ return result;
6071
+ } catch (error) {
6072
+ this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
6073
+ throw error;
6074
+ }
6070
6075
  }
6071
6076
 
6072
6077
  // Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
@@ -9370,6 +9375,7 @@ class WebRTCPhone extends Emitter {
9370
9375
  _onCallTerminated(sipSession ) {
9371
9376
  logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9372
9377
 
9378
+ const sipSessionId = this.getSipSessionId(sipSession);
9373
9379
  const callSession = this._createCallSession(sipSession);
9374
9380
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
9375
9381
  const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
@@ -9387,7 +9393,6 @@ class WebRTCPhone extends Emitter {
9387
9393
  }, 5);
9388
9394
  }
9389
9395
 
9390
- const sipSessionId = this.getSipSessionId(sipSession);
9391
9396
  if (sipSessionId) {
9392
9397
  this.removeIncomingSessions(sipSessionId);
9393
9398
  }
@@ -10032,8 +10037,12 @@ class WebRTCPhone extends Emitter {
10032
10037
  }
10033
10038
 
10034
10039
  const sessionId = this.incomingSessions[0];
10040
+ const sipSession = this.client.getSipSession(sessionId);
10041
+ if (!sipSession) {
10042
+ return null;
10043
+ }
10035
10044
 
10036
- return this._createCallSession(this.client.getSipSession(sessionId));
10045
+ return this._createCallSession(sipSession);
10037
10046
  }
10038
10047
 
10039
10048
  sendMessage(sipSession = null, body , contentType = 'text/plain') {
@@ -132,7 +132,7 @@ const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
132
132
 
133
133
  // Use a function here to be able to mock it in tests
134
134
  const realFetch = () => {
135
- if (typeof document !== 'undefined') {
135
+ if (typeof document !== 'undefined' && window.fetch) {
136
136
  // Browser
137
137
  return window.fetch;
138
138
  }
@@ -6062,11 +6062,16 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
6062
6062
 
6063
6063
  // $FlowFixMe
6064
6064
  setRemoteSessionDescription(sessionDescription ) {
6065
- const result = super.setRemoteSessionDescription(sessionDescription);
6065
+ try {
6066
+ const result = super.setRemoteSessionDescription(sessionDescription);
6066
6067
 
6067
- this.eventEmitter.emit('setDescription', sessionDescription);
6068
+ this.eventEmitter.emit('setDescription', sessionDescription);
6068
6069
 
6069
- return result;
6070
+ return result;
6071
+ } catch (error) {
6072
+ this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
6073
+ throw error;
6074
+ }
6070
6075
  }
6071
6076
 
6072
6077
  // Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
@@ -9370,6 +9375,7 @@ class WebRTCPhone extends Emitter {
9370
9375
  _onCallTerminated(sipSession ) {
9371
9376
  logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9372
9377
 
9378
+ const sipSessionId = this.getSipSessionId(sipSession);
9373
9379
  const callSession = this._createCallSession(sipSession);
9374
9380
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
9375
9381
  const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
@@ -9387,7 +9393,6 @@ class WebRTCPhone extends Emitter {
9387
9393
  }, 5);
9388
9394
  }
9389
9395
 
9390
- const sipSessionId = this.getSipSessionId(sipSession);
9391
9396
  if (sipSessionId) {
9392
9397
  this.removeIncomingSessions(sipSessionId);
9393
9398
  }
@@ -10032,8 +10037,12 @@ class WebRTCPhone extends Emitter {
10032
10037
  }
10033
10038
 
10034
10039
  const sessionId = this.incomingSessions[0];
10040
+ const sipSession = this.client.getSipSession(sessionId);
10041
+ if (!sipSession) {
10042
+ return null;
10043
+ }
10035
10044
 
10036
- return this._createCallSession(this.client.getSipSession(sessionId));
10045
+ return this._createCallSession(sipSession);
10037
10046
  }
10038
10047
 
10039
10048
  sendMessage(sipSession = null, body , contentType = 'text/plain') {
@@ -463,7 +463,7 @@ const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
463
463
 
464
464
  // Use a function here to be able to mock it in tests
465
465
  const realFetch = () => {
466
- if (typeof document !== 'undefined') {
466
+ if (typeof document !== 'undefined' && window.fetch) {
467
467
  // Browser
468
468
  return window.fetch;
469
469
  }
@@ -6062,11 +6062,16 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
6062
6062
 
6063
6063
  // $FlowFixMe
6064
6064
  setRemoteSessionDescription(sessionDescription ) {
6065
- const result = super.setRemoteSessionDescription(sessionDescription);
6065
+ try {
6066
+ const result = super.setRemoteSessionDescription(sessionDescription);
6066
6067
 
6067
- this.eventEmitter.emit('setDescription', sessionDescription);
6068
+ this.eventEmitter.emit('setDescription', sessionDescription);
6068
6069
 
6069
- return result;
6070
+ return result;
6071
+ } catch (error) {
6072
+ this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
6073
+ throw error;
6074
+ }
6070
6075
  }
6071
6076
 
6072
6077
  // Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
@@ -9370,6 +9375,7 @@ class WebRTCPhone extends Emitter {
9370
9375
  _onCallTerminated(sipSession ) {
9371
9376
  logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9372
9377
 
9378
+ const sipSessionId = this.getSipSessionId(sipSession);
9373
9379
  const callSession = this._createCallSession(sipSession);
9374
9380
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
9375
9381
  const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
@@ -9387,7 +9393,6 @@ class WebRTCPhone extends Emitter {
9387
9393
  }, 5);
9388
9394
  }
9389
9395
 
9390
- const sipSessionId = this.getSipSessionId(sipSession);
9391
9396
  if (sipSessionId) {
9392
9397
  this.removeIncomingSessions(sipSessionId);
9393
9398
  }
@@ -10032,8 +10037,12 @@ class WebRTCPhone extends Emitter {
10032
10037
  }
10033
10038
 
10034
10039
  const sessionId = this.incomingSessions[0];
10040
+ const sipSession = this.client.getSipSession(sessionId);
10041
+ if (!sipSession) {
10042
+ return null;
10043
+ }
10035
10044
 
10036
- return this._createCallSession(this.client.getSipSession(sessionId));
10045
+ return this._createCallSession(sipSession);
10037
10046
  }
10038
10047
 
10039
10048
  sendMessage(sipSession = null, body , contentType = 'text/plain') {
@@ -463,7 +463,7 @@ const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
463
463
 
464
464
  // Use a function here to be able to mock it in tests
465
465
  const realFetch = () => {
466
- if (typeof document !== 'undefined') {
466
+ if (typeof document !== 'undefined' && window.fetch) {
467
467
  // Browser
468
468
  return window.fetch;
469
469
  }
@@ -6062,11 +6062,16 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
6062
6062
 
6063
6063
  // $FlowFixMe
6064
6064
  setRemoteSessionDescription(sessionDescription ) {
6065
- const result = super.setRemoteSessionDescription(sessionDescription);
6065
+ try {
6066
+ const result = super.setRemoteSessionDescription(sessionDescription);
6066
6067
 
6067
- this.eventEmitter.emit('setDescription', sessionDescription);
6068
+ this.eventEmitter.emit('setDescription', sessionDescription);
6068
6069
 
6069
- return result;
6070
+ return result;
6071
+ } catch (error) {
6072
+ this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
6073
+ throw error;
6074
+ }
6070
6075
  }
6071
6076
 
6072
6077
  // Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
@@ -9370,6 +9375,7 @@ class WebRTCPhone extends Emitter {
9370
9375
  _onCallTerminated(sipSession ) {
9371
9376
  logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9372
9377
 
9378
+ const sipSessionId = this.getSipSessionId(sipSession);
9373
9379
  const callSession = this._createCallSession(sipSession);
9374
9380
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
9375
9381
  const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
@@ -9387,7 +9393,6 @@ class WebRTCPhone extends Emitter {
9387
9393
  }, 5);
9388
9394
  }
9389
9395
 
9390
- const sipSessionId = this.getSipSessionId(sipSession);
9391
9396
  if (sipSessionId) {
9392
9397
  this.removeIncomingSessions(sipSessionId);
9393
9398
  }
@@ -10032,8 +10037,12 @@ class WebRTCPhone extends Emitter {
10032
10037
  }
10033
10038
 
10034
10039
  const sessionId = this.incomingSessions[0];
10040
+ const sipSession = this.client.getSipSession(sessionId);
10041
+ if (!sipSession) {
10042
+ return null;
10043
+ }
10035
10044
 
10036
- return this._createCallSession(this.client.getSipSession(sessionId));
10045
+ return this._createCallSession(sipSession);
10037
10046
  }
10038
10047
 
10039
10048
  sendMessage(sipSession = null, body , contentType = 'text/plain') {
@@ -106,7 +106,7 @@ const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
106
106
 
107
107
  // Use a function here to be able to mock it in tests
108
108
  const realFetch = () => {
109
- if (typeof document !== 'undefined') {
109
+ if (typeof document !== 'undefined' && window.fetch) {
110
110
  // Browser
111
111
  return window.fetch;
112
112
  }
@@ -6062,11 +6062,16 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
6062
6062
 
6063
6063
  // $FlowFixMe
6064
6064
  setRemoteSessionDescription(sessionDescription ) {
6065
- const result = super.setRemoteSessionDescription(sessionDescription);
6065
+ try {
6066
+ const result = super.setRemoteSessionDescription(sessionDescription);
6066
6067
 
6067
- this.eventEmitter.emit('setDescription', sessionDescription);
6068
+ this.eventEmitter.emit('setDescription', sessionDescription);
6068
6069
 
6069
- return result;
6070
+ return result;
6071
+ } catch (error) {
6072
+ this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
6073
+ throw error;
6074
+ }
6070
6075
  }
6071
6076
 
6072
6077
  // Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
@@ -9370,6 +9375,7 @@ class WebRTCPhone extends Emitter {
9370
9375
  _onCallTerminated(sipSession ) {
9371
9376
  logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9372
9377
 
9378
+ const sipSessionId = this.getSipSessionId(sipSession);
9373
9379
  const callSession = this._createCallSession(sipSession);
9374
9380
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
9375
9381
  const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
@@ -9387,7 +9393,6 @@ class WebRTCPhone extends Emitter {
9387
9393
  }, 5);
9388
9394
  }
9389
9395
 
9390
- const sipSessionId = this.getSipSessionId(sipSession);
9391
9396
  if (sipSessionId) {
9392
9397
  this.removeIncomingSessions(sipSessionId);
9393
9398
  }
@@ -10032,8 +10037,12 @@ class WebRTCPhone extends Emitter {
10032
10037
  }
10033
10038
 
10034
10039
  const sessionId = this.incomingSessions[0];
10040
+ const sipSession = this.client.getSipSession(sessionId);
10041
+ if (!sipSession) {
10042
+ return null;
10043
+ }
10035
10044
 
10036
- return this._createCallSession(this.client.getSipSession(sessionId));
10045
+ return this._createCallSession(sipSession);
10037
10046
  }
10038
10047
 
10039
10048
  sendMessage(sipSession = null, body , contentType = 'text/plain') {
@@ -1951,7 +1951,7 @@ const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
1951
1951
 
1952
1952
  // Use a function here to be able to mock it in tests
1953
1953
  const realFetch = () => {
1954
- if (typeof document !== 'undefined') {
1954
+ if (typeof document !== 'undefined' && window.fetch) {
1955
1955
  // Browser
1956
1956
  return window.fetch;
1957
1957
  }
@@ -6062,11 +6062,16 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
6062
6062
 
6063
6063
  // $FlowFixMe
6064
6064
  setRemoteSessionDescription(sessionDescription ) {
6065
- const result = super.setRemoteSessionDescription(sessionDescription);
6065
+ try {
6066
+ const result = super.setRemoteSessionDescription(sessionDescription);
6066
6067
 
6067
- this.eventEmitter.emit('setDescription', sessionDescription);
6068
+ this.eventEmitter.emit('setDescription', sessionDescription);
6068
6069
 
6069
- return result;
6070
+ return result;
6071
+ } catch (error) {
6072
+ this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
6073
+ throw error;
6074
+ }
6070
6075
  }
6071
6076
 
6072
6077
  // Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
@@ -9370,6 +9375,7 @@ class WebRTCPhone extends Emitter {
9370
9375
  _onCallTerminated(sipSession ) {
9371
9376
  logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9372
9377
 
9378
+ const sipSessionId = this.getSipSessionId(sipSession);
9373
9379
  const callSession = this._createCallSession(sipSession);
9374
9380
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
9375
9381
  const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
@@ -9387,7 +9393,6 @@ class WebRTCPhone extends Emitter {
9387
9393
  }, 5);
9388
9394
  }
9389
9395
 
9390
- const sipSessionId = this.getSipSessionId(sipSession);
9391
9396
  if (sipSessionId) {
9392
9397
  this.removeIncomingSessions(sipSessionId);
9393
9398
  }
@@ -10032,8 +10037,12 @@ class WebRTCPhone extends Emitter {
10032
10037
  }
10033
10038
 
10034
10039
  const sessionId = this.incomingSessions[0];
10040
+ const sipSession = this.client.getSipSession(sessionId);
10041
+ if (!sipSession) {
10042
+ return null;
10043
+ }
10035
10044
 
10036
- return this._createCallSession(this.client.getSipSession(sessionId));
10045
+ return this._createCallSession(sipSession);
10037
10046
  }
10038
10047
 
10039
10048
  sendMessage(sipSession = null, body , contentType = 'text/plain') {
@@ -1951,7 +1951,7 @@ const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
1951
1951
 
1952
1952
  // Use a function here to be able to mock it in tests
1953
1953
  const realFetch = () => {
1954
- if (typeof document !== 'undefined') {
1954
+ if (typeof document !== 'undefined' && window.fetch) {
1955
1955
  // Browser
1956
1956
  return window.fetch;
1957
1957
  }
@@ -6062,11 +6062,16 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
6062
6062
 
6063
6063
  // $FlowFixMe
6064
6064
  setRemoteSessionDescription(sessionDescription ) {
6065
- const result = super.setRemoteSessionDescription(sessionDescription);
6065
+ try {
6066
+ const result = super.setRemoteSessionDescription(sessionDescription);
6066
6067
 
6067
- this.eventEmitter.emit('setDescription', sessionDescription);
6068
+ this.eventEmitter.emit('setDescription', sessionDescription);
6068
6069
 
6069
- return result;
6070
+ return result;
6071
+ } catch (error) {
6072
+ this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
6073
+ throw error;
6074
+ }
6070
6075
  }
6071
6076
 
6072
6077
  // Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
@@ -9370,6 +9375,7 @@ class WebRTCPhone extends Emitter {
9370
9375
  _onCallTerminated(sipSession ) {
9371
9376
  logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9372
9377
 
9378
+ const sipSessionId = this.getSipSessionId(sipSession);
9373
9379
  const callSession = this._createCallSession(sipSession);
9374
9380
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
9375
9381
  const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
@@ -9387,7 +9393,6 @@ class WebRTCPhone extends Emitter {
9387
9393
  }, 5);
9388
9394
  }
9389
9395
 
9390
- const sipSessionId = this.getSipSessionId(sipSession);
9391
9396
  if (sipSessionId) {
9392
9397
  this.removeIncomingSessions(sipSessionId);
9393
9398
  }
@@ -10032,8 +10037,12 @@ class WebRTCPhone extends Emitter {
10032
10037
  }
10033
10038
 
10034
10039
  const sessionId = this.incomingSessions[0];
10040
+ const sipSession = this.client.getSipSession(sessionId);
10041
+ if (!sipSession) {
10042
+ return null;
10043
+ }
10035
10044
 
10036
- return this._createCallSession(this.client.getSipSession(sessionId));
10045
+ return this._createCallSession(sipSession);
10037
10046
  }
10038
10047
 
10039
10048
  sendMessage(sipSession = null, body , contentType = 'text/plain') {
@@ -1951,7 +1951,7 @@ const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
1951
1951
 
1952
1952
  // Use a function here to be able to mock it in tests
1953
1953
  const realFetch = () => {
1954
- if (typeof document !== 'undefined') {
1954
+ if (typeof document !== 'undefined' && window.fetch) {
1955
1955
  // Browser
1956
1956
  return window.fetch;
1957
1957
  }
@@ -6062,11 +6062,16 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
6062
6062
 
6063
6063
  // $FlowFixMe
6064
6064
  setRemoteSessionDescription(sessionDescription ) {
6065
- const result = super.setRemoteSessionDescription(sessionDescription);
6065
+ try {
6066
+ const result = super.setRemoteSessionDescription(sessionDescription);
6066
6067
 
6067
- this.eventEmitter.emit('setDescription', sessionDescription);
6068
+ this.eventEmitter.emit('setDescription', sessionDescription);
6068
6069
 
6069
- return result;
6070
+ return result;
6071
+ } catch (error) {
6072
+ this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
6073
+ throw error;
6074
+ }
6070
6075
  }
6071
6076
 
6072
6077
  // Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
@@ -9370,6 +9375,7 @@ class WebRTCPhone extends Emitter {
9370
9375
  _onCallTerminated(sipSession ) {
9371
9376
  logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9372
9377
 
9378
+ const sipSessionId = this.getSipSessionId(sipSession);
9373
9379
  const callSession = this._createCallSession(sipSession);
9374
9380
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
9375
9381
  const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
@@ -9387,7 +9393,6 @@ class WebRTCPhone extends Emitter {
9387
9393
  }, 5);
9388
9394
  }
9389
9395
 
9390
- const sipSessionId = this.getSipSessionId(sipSession);
9391
9396
  if (sipSessionId) {
9392
9397
  this.removeIncomingSessions(sipSessionId);
9393
9398
  }
@@ -10032,8 +10037,12 @@ class WebRTCPhone extends Emitter {
10032
10037
  }
10033
10038
 
10034
10039
  const sessionId = this.incomingSessions[0];
10040
+ const sipSession = this.client.getSipSession(sessionId);
10041
+ if (!sipSession) {
10042
+ return null;
10043
+ }
10035
10044
 
10036
- return this._createCallSession(this.client.getSipSession(sessionId));
10045
+ return this._createCallSession(sipSession);
10037
10046
  }
10038
10047
 
10039
10048
  sendMessage(sipSession = null, body , contentType = 'text/plain') {
@@ -440,7 +440,7 @@ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
440
440
 
441
441
  // Use a function here to be able to mock it in tests
442
442
  const realFetch = () => {
443
- if (typeof document !== 'undefined') {
443
+ if (typeof document !== 'undefined' && window.fetch) {
444
444
  // Browser
445
445
  return window.fetch;
446
446
  }
@@ -440,7 +440,7 @@ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
440
440
 
441
441
  // Use a function here to be able to mock it in tests
442
442
  const realFetch = () => {
443
- if (typeof document !== 'undefined') {
443
+ if (typeof document !== 'undefined' && window.fetch) {
444
444
  // Browser
445
445
  return window.fetch;
446
446
  }
@@ -104,7 +104,7 @@ const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
104
104
 
105
105
  // Use a function here to be able to mock it in tests
106
106
  const realFetch = () => {
107
- if (typeof document !== 'undefined') {
107
+ if (typeof document !== 'undefined' && window.fetch) {
108
108
  // Browser
109
109
  return window.fetch;
110
110
  }
@@ -823,11 +823,16 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
823
823
 
824
824
  // $FlowFixMe
825
825
  setRemoteSessionDescription(sessionDescription ) {
826
- const result = super.setRemoteSessionDescription(sessionDescription);
826
+ try {
827
+ const result = super.setRemoteSessionDescription(sessionDescription);
827
828
 
828
- this.eventEmitter.emit('setDescription', sessionDescription);
829
+ this.eventEmitter.emit('setDescription', sessionDescription);
829
830
 
830
- return result;
831
+ return result;
832
+ } catch (error) {
833
+ this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
834
+ throw error;
835
+ }
831
836
  }
832
837
 
833
838
  // Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
@@ -39,7 +39,7 @@ IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
39
39
 
40
40
  // Use a function here to be able to mock it in tests
41
41
  const realFetch = () => {
42
- if (typeof document !== 'undefined') {
42
+ if (typeof document !== 'undefined' && window.fetch) {
43
43
  // Browser
44
44
  return window.fetch;
45
45
  }
@@ -450,7 +450,7 @@ const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
450
450
 
451
451
  // Use a function here to be able to mock it in tests
452
452
  const realFetch = () => {
453
- if (typeof document !== 'undefined') {
453
+ if (typeof document !== 'undefined' && window.fetch) {
454
454
  // Browser
455
455
  return window.fetch;
456
456
  }