@wazo/sdk 1.0.0-alpha.0 → 1.0.0-alpha.2

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 (83) hide show
  1. package/dist/wazo-sdk.js +6 -6
  2. package/esm/__tests__/__voice__/call.test.js +44 -2
  3. package/esm/__tests__/api-client.test.js +20 -1
  4. package/esm/api/auth.js +13 -2
  5. package/esm/domain/Phone/WebRTCPhone.js +6 -7
  6. package/esm/index.js +2 -0
  7. package/esm/simple/Auth.js +6 -12
  8. package/esm/simple/Phone.js +1 -0
  9. package/esm/simple/__tests__/Auth.test.js +8 -64
  10. package/esm/state-machine/call-state-machine.js +1 -1
  11. package/esm/types/api/auth.d.ts.map +1 -1
  12. package/esm/types/domain/Phone/WebRTCPhone.d.ts.map +1 -1
  13. package/esm/types/index.d.ts +2 -0
  14. package/esm/types/index.d.ts.map +1 -1
  15. package/esm/types/simple/Auth.d.ts.map +1 -1
  16. package/esm/types/simple/Phone.d.ts.map +1 -1
  17. package/esm/types/state-machine/utils.d.ts +1 -1
  18. package/esm/types/state-machine/utils.d.ts.map +1 -1
  19. package/esm/types/utils/api-requester.d.ts.map +1 -1
  20. package/esm/types/utils/sdp.d.ts +2 -0
  21. package/esm/types/utils/sdp.d.ts.map +1 -1
  22. package/esm/types/utils/webrtc.d.ts +1 -0
  23. package/esm/types/utils/webrtc.d.ts.map +1 -1
  24. package/esm/types/voice/call.d.ts +19 -11
  25. package/esm/types/voice/call.d.ts.map +1 -1
  26. package/esm/types/voice/softphone.d.ts +18 -13
  27. package/esm/types/voice/softphone.d.ts.map +1 -1
  28. package/esm/utils/__tests__/api-requester.test.js +17 -0
  29. package/esm/utils/api-requester.js +9 -1
  30. package/esm/utils/sdp.js +13 -0
  31. package/esm/utils/webrtc.js +21 -1
  32. package/esm/voice/call.js +90 -30
  33. package/esm/voice/softphone.js +94 -23
  34. package/lib/__tests__/__voice__/call.test.js +43 -1
  35. package/lib/__tests__/api-client.test.js +20 -1
  36. package/lib/api/auth.js +13 -2
  37. package/lib/domain/Phone/WebRTCPhone.js +5 -6
  38. package/lib/index.js +6 -2
  39. package/lib/simple/Auth.js +6 -12
  40. package/lib/simple/Phone.js +1 -0
  41. package/lib/simple/__tests__/Auth.test.js +11 -64
  42. package/lib/state-machine/call-state-machine.js +1 -1
  43. package/lib/types/api/auth.d.ts.map +1 -1
  44. package/lib/types/domain/Phone/WebRTCPhone.d.ts.map +1 -1
  45. package/lib/types/index.d.ts +2 -0
  46. package/lib/types/index.d.ts.map +1 -1
  47. package/lib/types/simple/Auth.d.ts.map +1 -1
  48. package/lib/types/simple/Phone.d.ts.map +1 -1
  49. package/lib/types/state-machine/utils.d.ts +1 -1
  50. package/lib/types/state-machine/utils.d.ts.map +1 -1
  51. package/lib/types/utils/api-requester.d.ts.map +1 -1
  52. package/lib/types/utils/sdp.d.ts +2 -0
  53. package/lib/types/utils/sdp.d.ts.map +1 -1
  54. package/lib/types/utils/webrtc.d.ts +1 -0
  55. package/lib/types/utils/webrtc.d.ts.map +1 -1
  56. package/lib/types/voice/call.d.ts +19 -11
  57. package/lib/types/voice/call.d.ts.map +1 -1
  58. package/lib/types/voice/softphone.d.ts +18 -13
  59. package/lib/types/voice/softphone.d.ts.map +1 -1
  60. package/lib/utils/__tests__/api-requester.test.js +17 -0
  61. package/lib/utils/api-requester.js +9 -1
  62. package/lib/utils/sdp.js +16 -1
  63. package/lib/utils/webrtc.js +23 -2
  64. package/lib/voice/call.js +87 -28
  65. package/lib/voice/softphone.js +95 -23
  66. package/package.json +1 -1
  67. package/src/__tests__/__voice__/call.test.ts +47 -2
  68. package/src/__tests__/api-client.test.ts +22 -1
  69. package/src/api/auth.ts +25 -3
  70. package/src/domain/Phone/WebRTCPhone.ts +9 -9
  71. package/src/index.ts +2 -0
  72. package/src/simple/Auth.ts +6 -13
  73. package/src/simple/Phone.ts +1 -0
  74. package/src/simple/__tests__/Auth.test.ts +9 -87
  75. package/src/state-machine/call-state-machine.ts +1 -1
  76. package/src/state-machine/utils.ts +2 -2
  77. package/src/utils/__tests__/api-requester.test.ts +20 -0
  78. package/src/utils/api-requester.ts +9 -1
  79. package/src/utils/sdp.ts +16 -0
  80. package/src/utils/webrtc.ts +24 -2
  81. package/src/voice/call.ts +118 -40
  82. package/src/voice/softphone.ts +116 -30
  83. package/src/web-rtc-client.ts +1 -1
@@ -4,19 +4,23 @@ import { createActor } from 'xstate';
4
4
  import InvalidState from '../domain/InvalidState';
5
5
  import Wazo from '..';
6
6
  import softphoneStateMachine, { Actions, States } from '../state-machine/softphone-state-machine';
7
- import { Actions as CallActions } from '../state-machine/call-state-machine';
8
7
  import WazoWebRTCClient from '../web-rtc-client';
9
8
  import IssueReporter from '../service/IssueReporter';
10
9
  import configureLogger from '../utils/sip-logger';
11
10
  import Call from './call';
12
11
  import { assertCan, can, getState, waitUntilState } from '../state-machine/utils';
13
12
  export const EVENT_INCOMING = 'incoming';
13
+ export const EVENT_OUTGOING = 'outgoing';
14
14
  export const EVENT_HEARTBEAT = 'heartbeat';
15
15
  export const EVENT_HEARTBEAT_TIMEOUT = 'heartbeatTimeout';
16
16
  export const EVENT_REGISTERED = 'registered';
17
17
  export const EVENT_UNREGISTERED = 'unregistered';
18
18
  export const EVENT_DISCONNECTED = 'disconnected';
19
19
  export const EVENT_VIDEO_INPUT_CHANGE = 'videoInputChange';
20
+ export const EVENT_TERMINATE_SOUND = 'terminateSound';
21
+ export const EVENT_PLAY_HANGUP_SOUND = 'playHangupSound';
22
+ export const EVENT_PLAY_RING_SOUND = 'playRingSound';
23
+ export const EVENT_PLAY_INBOUND_CALL_SOUND = 'playInboundCallSound';
20
24
  export const EVENT_ON_MESSAGE = 'message';
21
25
  export const EVENT_ON_CHAT = 'phone/ON_CHAT';
22
26
  export const EVENT_ON_SIGNAL = 'phone/ON_SIGNAL';
@@ -28,7 +32,6 @@ export class Softphone extends EventEmitter {
28
32
  audioRingDeviceId;
29
33
  audioOutputVolume;
30
34
  audioRingVolume;
31
- eventEmitter;
32
35
  calls;
33
36
  client;
34
37
  session;
@@ -36,6 +39,7 @@ export class Softphone extends EventEmitter {
36
39
  softphoneActor;
37
40
  options;
38
41
  shouldSendReinvite;
42
+ ringingEnabled = true;
39
43
  constructor() {
40
44
  super();
41
45
  this.calls = [];
@@ -114,19 +118,20 @@ export class Softphone extends EventEmitter {
114
118
  logger.warn('softphone - calling with empty number, bailing.');
115
119
  return Promise.resolve(null);
116
120
  }
117
- if (this.getState() !== States.UNREGISTERED) {
118
- throw new InvalidState(`Invalid state ${States.UNREGISTERED}`, States.UNREGISTERED);
119
- }
120
- if (this.getState() !== States.REGISTERING) {
121
+ if (this.state === States.REGISTERING) {
121
122
  logger.info('softphone - calling when registering, waiting for Softphone to be registered ...');
122
123
  await waitUntilState(this.softphoneActor, States.REGISTERED);
123
124
  }
125
+ if (this.state !== States.UNREGISTERED) {
126
+ throw new InvalidState(`Invalid state ${States.UNREGISTERED}`, States.UNREGISTERED);
127
+ }
124
128
  // Hold other calls
125
129
  this.holdAllCalls();
126
130
  let sipCall;
127
131
  try {
128
132
  sipCall = this.client.call(options.params.To, options.withCamera, options.audioOnly, options.conference, options);
129
133
  const call = new Call(sipCall, this);
134
+ this.emit(EVENT_OUTGOING, call);
130
135
  return call;
131
136
  }
132
137
  catch (error) {
@@ -137,6 +142,58 @@ export class Softphone extends EventEmitter {
137
142
  removeCall(callToRemove) {
138
143
  this.calls = this.calls.filter((call) => call.id !== callToRemove.id);
139
144
  }
145
+ onCallTerminated(call) {
146
+ logger.info('softphone - on call terminated', { id: call.id });
147
+ const currentCall = this.getCurrentCall();
148
+ const isCurrentCall = currentCall?.id === call.id;
149
+ const isRinging = call.isRinging();
150
+ const isCurrentIncomingCall = isCurrentCall && isRinging;
151
+ const incomingCalls = this.getIncomingCalls();
152
+ const nbIncomingCalls = incomingCalls.length;
153
+ // Send an event to terminate ringing sound
154
+ if (isCurrentIncomingCall) {
155
+ setTimeout(() => {
156
+ // Avoid race condition when the other is calling and hanging up immediately
157
+ this.emit(EVENT_TERMINATE_SOUND, call, 'call terminated');
158
+ }, 5);
159
+ }
160
+ // If the terminated call was an incoming call, we have to re-trigger if it's was the first incoming call
161
+ // Otherwise, we have to re-trigger an incoming call event if another call is incoming
162
+ const shouldRetrigger = isCurrentCall ? nbIncomingCalls : isCurrentIncomingCall;
163
+ // Re-trigger incoming call event for remaining incoming calls
164
+ logger.info('Softphone - check to re-trigger incoming call', { shouldRetrigger, nbIncomingCalls });
165
+ if (shouldRetrigger && nbIncomingCalls > 1) {
166
+ const nextCall = incomingCalls.find(c => c.id !== call.id);
167
+ // Avoid race condition
168
+ setTimeout(() => {
169
+ if (this.ringingEnabled) {
170
+ if (currentCall) {
171
+ this.emit(EVENT_PLAY_RING_SOUND, this.audioRingDeviceId, this.audioRingVolume, nextCall);
172
+ }
173
+ else {
174
+ this.emit(EVENT_PLAY_INBOUND_CALL_SOUND, this.audioOutputDeviceId, this.audioOutputVolume, nextCall);
175
+ }
176
+ }
177
+ this.emit(EVENT_INCOMING, nextCall);
178
+ }, 100);
179
+ }
180
+ // @ts-ignore: does not exist
181
+ if (!call.sipCall.isCanceled) {
182
+ setTimeout(() => {
183
+ this.emit(EVENT_PLAY_HANGUP_SOUND, this.audioOutputDeviceId, this.audioOutputVolume, call);
184
+ }, 10);
185
+ }
186
+ this.client.onCallEnded(call.sipCall);
187
+ this.removeCall(call);
188
+ }
189
+ enableRinging() {
190
+ logger.info('softphone - enable ringing');
191
+ this.ringingEnabled = true;
192
+ }
193
+ disableRinging() {
194
+ logger.info('softphone - disable ringing');
195
+ this.ringingEnabled = false;
196
+ }
140
197
  holdAllCalls(exceptCall = null) {
141
198
  this.calls.filter(call => !call.isHeld() && call.id === exceptCall?.id).forEach(call => call.hold());
142
199
  }
@@ -190,24 +247,36 @@ export class Softphone extends EventEmitter {
190
247
  logger.info('softphone - changing ring volume', { volume });
191
248
  this.audioRingVolume = volume;
192
249
  }
193
- getCalls() {
194
- return this.calls;
195
- }
196
250
  getCurrentCall() {
197
251
  return this.calls.find(call => call.isEstablished());
198
252
  }
199
- getState() {
200
- return this.softphoneActor.getSnapshot().value;
253
+ getIncomingCalls() {
254
+ return this.calls.filter(call => call.isRinging());
255
+ }
256
+ get state() {
257
+ return getState(this.softphoneActor);
201
258
  }
202
259
  getUserAgent() {
203
260
  return this.client?.config?.userAgentString || 'softphone';
204
261
  }
262
+ isRegistered() {
263
+ return this.state === States.REGISTERED;
264
+ }
205
265
  _bindEvents() {
206
266
  this.client.on(this.client.INVITE, (sipSession) => {
207
267
  const call = new Call(sipSession, this);
208
- call._sendAction(CallActions.INCOMING_CALL);
268
+ logger.info('softphone - on invite', { callId: call.id, number: call.number });
269
+ call.onCallIncoming();
209
270
  this.calls.push(call);
210
- this.eventEmitter.emit(EVENT_INCOMING, call);
271
+ this.emit(EVENT_INCOMING, call);
272
+ if (!this.getCurrentCall()) {
273
+ if (this.ringingEnabled) {
274
+ this.emit(EVENT_PLAY_RING_SOUND, this.audioRingDeviceId, this.audioRingVolume, call);
275
+ }
276
+ }
277
+ else {
278
+ this.emit(EVENT_PLAY_INBOUND_CALL_SOUND, this.audioOutputDeviceId, this.audioOutputVolume, call);
279
+ }
211
280
  });
212
281
  this.client.on(this.client.ON_REINVITE, (sipCall, request, updatedCalleeName, updatedNumber, hadRemoteVideo) => {
213
282
  logger.info('softphone - on reinvite', {
@@ -220,6 +289,8 @@ export class Softphone extends EventEmitter {
220
289
  this._onCallEvent(sipCall, 'onReinvite', request, updatedCalleeName, updatedNumber, hadRemoteVideo);
221
290
  });
222
291
  this.client.on(this.client.ACCEPTED, async (sipCall) => {
292
+ const call = this._getCall(sipCall);
293
+ this.emit(EVENT_TERMINATE_SOUND, call, 'call accepted');
223
294
  this._onCallEvent(sipCall, 'onAccepted');
224
295
  if (this.audioOutputDeviceId) {
225
296
  await this.client.changeAudioOutputDevice(this.audioOutputDeviceId);
@@ -249,12 +320,12 @@ export class Softphone extends EventEmitter {
249
320
  });
250
321
  this.client.on(this.client.UNREGISTERED, () => {
251
322
  logger.info('softphone - unregistered');
252
- this.eventEmitter.emit(EVENT_UNREGISTERED);
323
+ this.emit(EVENT_UNREGISTERED);
253
324
  this._sendAction(Actions.UNREGISTERED);
254
325
  });
255
326
  this.client.on(this.client.ON_DISCONNECTED, () => {
256
327
  logger.info('softphone - disconnected');
257
- this.eventEmitter.emit(EVENT_DISCONNECTED);
328
+ this.emit(EVENT_DISCONNECTED);
258
329
  this._sendAction(Actions.TRANSPORT_CLOSED);
259
330
  });
260
331
  this.client.on(this.client.REGISTERED, () => {
@@ -265,7 +336,7 @@ export class Softphone extends EventEmitter {
265
336
  }
266
337
  this.stopHeartbeat();
267
338
  this._sendAction(Actions.REGISTER_DONE);
268
- this.eventEmitter.emit(EVENT_REGISTERED);
339
+ this.emit(EVENT_REGISTERED);
269
340
  // If the phone registered with a current callSession (eg: when switching network):
270
341
  // send a reinvite to renegociate ICE with new IP
271
342
  if (this.shouldSendReinvite) {
@@ -281,7 +352,7 @@ export class Softphone extends EventEmitter {
281
352
  });
282
353
  this.client.on(this.client.DISCONNECTED, () => {
283
354
  logger.info('softphone - disconnected');
284
- this.eventEmitter.emit(EVENT_DISCONNECTED);
355
+ this.emit(EVENT_DISCONNECTED);
285
356
  // Do not trigger heartbeat if already running
286
357
  if (!this.client.hasHeartbeat()) {
287
358
  this.startHeartbeat();
@@ -290,17 +361,17 @@ export class Softphone extends EventEmitter {
290
361
  this.shouldSendReinvite = this.calls.length > 0;
291
362
  });
292
363
  this.client.on('onVideoInputChange', stream => {
293
- this.eventEmitter.emit(EVENT_VIDEO_INPUT_CHANGE, stream);
364
+ this.emit(EVENT_VIDEO_INPUT_CHANGE, stream);
294
365
  });
295
366
  this.client.on(this.client.MESSAGE, (message) => {
296
367
  this._onMessage(message);
297
- this.eventEmitter.emit(EVENT_ON_MESSAGE, message);
368
+ this.emit(EVENT_ON_MESSAGE, message);
298
369
  });
299
370
  this.client.setOnHeartbeatTimeout(() => {
300
- this.eventEmitter.emit(EVENT_HEARTBEAT_TIMEOUT);
371
+ this.emit(EVENT_HEARTBEAT_TIMEOUT);
301
372
  });
302
373
  this.client.setOnHeartbeatCallback(() => {
303
- this.eventEmitter.emit(EVENT_HEARTBEAT);
374
+ this.emit(EVENT_HEARTBEAT);
304
375
  });
305
376
  }
306
377
  _sendAction(action) {
@@ -333,11 +404,11 @@ export class Softphone extends EventEmitter {
333
404
  const { type, content, } = body;
334
405
  switch (type) {
335
406
  case MESSAGE_TYPE_CHAT:
336
- this.eventEmitter.emit(EVENT_ON_CHAT, content);
407
+ this.emit(EVENT_ON_CHAT, content);
337
408
  break;
338
409
  case MESSAGE_TYPE_SIGNAL:
339
410
  {
340
- this.eventEmitter.emit(EVENT_ON_SIGNAL, content);
411
+ this.emit(EVENT_ON_SIGNAL, content);
341
412
  break;
342
413
  }
343
414
  default:
@@ -18,6 +18,7 @@ const softphone_1 = __importDefault(require("../../voice/softphone"));
18
18
  const call_1 = __importDefault(require("../../voice/call"));
19
19
  const call_state_machine_1 = require("../../state-machine/call-state-machine");
20
20
  const softphone_state_machine_1 = require("../../state-machine/softphone-state-machine");
21
+ const Call_1 = __importDefault(require("../../domain/Call"));
21
22
  const InvalidStateTransition_1 = __importDefault(require("../../domain/InvalidStateTransition"));
22
23
  const uaOptions = {
23
24
  logBuiltinEnabled: false,
@@ -42,6 +43,7 @@ jest.mock('../../web-rtc-client', () => jest.fn().mockImplementation(() => ({
42
43
  answer: jest.fn(() => Promise.resolve()),
43
44
  hangup: jest.fn(() => Promise.resolve()),
44
45
  register: jest.fn(() => Promise.resolve()),
46
+ onCallEnded: jest.fn(() => Promise.resolve()),
45
47
  setOnHeartbeatTimeout: jest.fn(() => Promise.resolve()),
46
48
  setOnHeartbeatCallback: jest.fn(() => Promise.resolve()),
47
49
  on: jest.fn(),
@@ -49,22 +51,60 @@ jest.mock('../../web-rtc-client', () => jest.fn().mockImplementation(() => ({
49
51
  const ua = new sip_js_1.UserAgent(uaOptions);
50
52
  const sipCall = new sip_js_1.Inviter(ua, sip_js_1.UserAgent.makeURI('sip:1234@my.stack.io'));
51
53
  softphone_1.default.connect();
54
+ // @ts-ignore: private method
52
55
  softphone_1.default._sendAction(softphone_state_machine_1.Actions.REGISTER_DONE);
53
56
  const invalidStateTransition = (state, action) => new InvalidStateTransition_1.default(`Invalid state transition from ${state} with action ${action}`, state, action);
54
57
  describe('Call', () => {
58
+ describe('parsing an API call', () => {
59
+ it('Should parse an API call and transform it to a Call instance', () => __awaiter(void 0, void 0, void 0, function* () {
60
+ const apiCall = new Call_1.default({
61
+ id: '1234',
62
+ sipCallId: 'abcd',
63
+ isCaller: false,
64
+ isVideo: true,
65
+ recording: true,
66
+ callerName: '',
67
+ callerNumber: '',
68
+ calleeName: '',
69
+ calleeNumber: '0123423223',
70
+ dialedExtension: '',
71
+ lineId: null,
72
+ muted: true,
73
+ onHold: false,
74
+ startingTime: new Date(),
75
+ status: 'Up',
76
+ talkingToIds: [],
77
+ });
78
+ const call = call_1.default.parseCall(apiCall);
79
+ expect(call.recording).toBeTruthy();
80
+ expect(call.id).toBe(apiCall.sipCallId);
81
+ expect(call.apiId).toBe(apiCall.id);
82
+ expect(call.number).toBe(apiCall.calleeNumber);
83
+ expect(call.answerTime).toStrictEqual(apiCall.startingTime);
84
+ expect(call.isMuted()).toBeTruthy();
85
+ expect(call.state).toStrictEqual({ [call_state_machine_1.States.ESTABLISHED]: call_state_machine_1.EstablishedStates.MUTED });
86
+ }));
87
+ });
55
88
  describe('accept', () => {
56
89
  it('Should throw an error when accepting a not ringing call', () => __awaiter(void 0, void 0, void 0, function* () {
57
90
  const call = new call_1.default(sipCall, softphone_1.default);
58
91
  yield expect(call.accept()).rejects.toThrowError(invalidStateTransition(call_state_machine_1.States.IDLE, call_state_machine_1.Actions.ACCEPT));
59
92
  }));
60
- it.only('Should throw an error when the softphone is not registered', () => __awaiter(void 0, void 0, void 0, function* () {
93
+ it('Should throw an error when the softphone is not registered', () => __awaiter(void 0, void 0, void 0, function* () {
61
94
  const call = new call_1.default(sipCall, softphone_1.default);
95
+ // @ts-ignore: private method
62
96
  call._sendAction(call_state_machine_1.Actions.INCOMING_CALL);
97
+ // @ts-ignore: private method
63
98
  softphone_1.default._sendAction(softphone_state_machine_1.Actions.TRANSPORT_CLOSED);
64
99
  yield expect(call.accept()).rejects.toThrowError(invalidStateTransition(call_state_machine_1.States.RINGING, call_state_machine_1.Actions.ACCEPT));
100
+ // Revert softphone state
101
+ softphone_1.default.connect();
102
+ // @ts-ignore: private method
103
+ softphone_1.default._sendAction(softphone_state_machine_1.Actions.REGISTER_DONE);
65
104
  }));
66
105
  it('Should not throw an error when accepting a not ringing call', () => __awaiter(void 0, void 0, void 0, function* () {
67
106
  const call = new call_1.default(sipCall, softphone_1.default);
107
+ // @ts-ignore: private method
68
108
  call._sendAction(call_state_machine_1.Actions.INCOMING_CALL);
69
109
  yield call.accept();
70
110
  expect(softphone_1.default.client.answer).toHaveBeenCalled();
@@ -77,7 +117,9 @@ describe('Call', () => {
77
117
  }));
78
118
  it('Should not throw an error when terminating an established call', () => __awaiter(void 0, void 0, void 0, function* () {
79
119
  const call = new call_1.default(sipCall, softphone_1.default);
120
+ // @ts-ignore: private method
80
121
  call._sendAction(call_state_machine_1.Actions.MAKE_CALL);
122
+ // @ts-ignore: private method
81
123
  call._sendAction(call_state_machine_1.Actions.REMOTLY_ACCEPTED);
82
124
  yield call.hangup();
83
125
  expect(softphone_1.default.client.hangup).toHaveBeenCalled();
@@ -127,7 +127,6 @@ describe('With correct API results', () => {
127
127
  body: JSON.stringify({ saml_session_id: samlSessionId }),
128
128
  signal: expect.any(Object),
129
129
  headers: {
130
- 'X-Auth-Token': token,
131
130
  'Content-Type': 'application/json',
132
131
  Accept: 'application/json',
133
132
  },
@@ -135,6 +134,26 @@ describe('With correct API results', () => {
135
134
  });
136
135
  }));
137
136
  });
137
+ describe('samlLogIn mobile test', () => {
138
+ it('should retrieve user token', () => __awaiter(void 0, void 0, void 0, function* () {
139
+ Wazo.Auth.mobile = true;
140
+ const samlSessionId = 'a1b2C3d4';
141
+ const result = yield client.auth.samlLogIn(samlSessionId);
142
+ expect(result).toBeInstanceOf(Session_1.default);
143
+ expect(result === null || result === void 0 ? void 0 : result.token).toBe(1);
144
+ expect(global.fetch).toBeCalledWith(`https://${server}/api/auth/${authVersion}/token`, {
145
+ method: 'post',
146
+ body: JSON.stringify({ saml_session_id: samlSessionId }),
147
+ signal: expect.any(Object),
148
+ headers: {
149
+ 'Content-Type': 'application/json',
150
+ 'Wazo-Session-Type': 'mobile',
151
+ Accept: 'application/json',
152
+ },
153
+ agent: null,
154
+ });
155
+ }));
156
+ });
138
157
  describe('logOut test', () => {
139
158
  it('should delete the specified token', () => __awaiter(void 0, void 0, void 0, function* () {
140
159
  const oldToken = 123;
package/lib/api/auth.js CHANGED
@@ -48,10 +48,21 @@ exports.default = ((client, baseUrl) => ({
48
48
  },
49
49
  logOut: (token) => client.delete(`${baseUrl}/token/${token}`, null, {}, api_requester_1.default.successResponseParser),
50
50
  samlLogIn: (samlSessionId) => __awaiter(void 0, void 0, void 0, function* () {
51
+ const headers = {
52
+ Accept: 'application/json',
53
+ 'Content-Type': 'application/json',
54
+ };
51
55
  const body = {
52
56
  saml_session_id: samlSessionId,
53
57
  };
54
- return client.post(`${baseUrl}/token`, body).then(Session_1.default.parse);
58
+ if (client.clientId) {
59
+ body.access_type = 'offline';
60
+ body.client_id = client.clientId;
61
+ }
62
+ if (Wazo.Auth.mobile) {
63
+ headers['Wazo-Session-Type'] = 'mobile';
64
+ }
65
+ return client.post(`${baseUrl}/token`, body, headers).then(Session_1.default.parse);
55
66
  }),
56
67
  initiateIdpAuthentication: (domain, redirectUrl) => __awaiter(void 0, void 0, void 0, function* () {
57
68
  const body = {
@@ -62,7 +73,7 @@ exports.default = ((client, baseUrl) => ({
62
73
  Accept: 'application/json',
63
74
  'Content-Type': 'application/json',
64
75
  };
65
- return client.post(`${baseUrl}/saml/sso`, body, headers, (response) => response);
76
+ return client.post(`${baseUrl}/saml/sso`, body, headers);
66
77
  }),
67
78
  refreshToken: (refreshToken, backend, expiration, isMobile, tenantId, domainName) => {
68
79
  const body = {
@@ -66,6 +66,7 @@ exports.MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
66
66
  exports.MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
67
67
  exports.events = [exports.ON_USER_AGENT, exports.ON_REGISTERED, exports.ON_UNREGISTERED, exports.ON_PROGRESS, exports.ON_CALL_ACCEPTED, exports.ON_CALL_ANSWERED, exports.ON_CALL_INCOMING, exports.ON_CALL_OUTGOING, exports.ON_CALL_MUTED, exports.ON_CALL_UNMUTED, exports.ON_CALL_RESUMED, exports.ON_CALL_HELD, exports.ON_CALL_UNHELD, exports.ON_CAMERA_DISABLED, exports.ON_CALL_FAILED, exports.ON_CALL_ENDED, exports.ON_CALL_REJECTED, exports.ON_MESSAGE, exports.ON_REINVITE, exports.ON_TRACK, exports.ON_AUDIO_STREAM, exports.ON_VIDEO_STREAM, exports.ON_REMOVE_STREAM, exports.ON_SHARE_SCREEN_ENDED, exports.ON_TERMINATE_SOUND, exports.ON_PLAY_RING_SOUND, exports.ON_PLAY_INBOUND_CALL_SIGNAL_SOUND, exports.ON_PLAY_HANGUP_SOUND, exports.ON_PLAY_PROGRESS_SOUND, exports.ON_VIDEO_INPUT_CHANGE, exports.ON_SHARE_SCREEN_STARTED, exports.ON_CALL_ERROR, exports.ON_CHAT, exports.ON_SIGNAL, exports.ON_NETWORK_STATS, exports.ON_DISCONNECTED, exports.ON_EARLY_MEDIA];
68
68
  const logger = IssueReporter_1.default.loggerFor('webrtc-phone');
69
+ // @deprecated: Use Wazo.Voice.Softphone instead
69
70
  class WebRTCPhone extends Emitter_1.default {
70
71
  constructor(client, audioOutputDeviceId, allowVideo = false, audioRingDeviceId) {
71
72
  super();
@@ -1468,14 +1469,12 @@ class WebRTCPhone extends Emitter_1.default {
1468
1469
  });
1469
1470
  }
1470
1471
  _createCallSession(sipSession, fromSession, extra = {}) {
1471
- // eslint-disable-next-line
1472
- const identity = sipSession ? sipSession.remoteIdentity || sipSession.assertedIdentity : null;
1473
- // @ts-ignore: private
1474
- const number = identity ? identity.uri._normal.user : null;
1475
- const { state, } = sipSession || {};
1472
+ const number = (0, sdp_1.getCallNumber)(sipSession);
1473
+ const displayName = (0, sdp_1.getCallDisplayName)(sipSession);
1474
+ const { state } = sipSession || {};
1476
1475
  const sessionId = (0, sdp_1.getSipSessionId)(sipSession);
1477
1476
  fromSession = fromSession || this.callSessions[sessionId];
1478
- const callSession = new CallSession_1.default(Object.assign({ callId: fromSession && fromSession.callId, sipCallId: sessionId, sipStatus: state, displayName: identity ? identity.displayName || number : number,
1477
+ const callSession = new CallSession_1.default(Object.assign({ callId: fromSession && fromSession.callId, sipCallId: sessionId, sipStatus: state, displayName,
1479
1478
  // @ts-ignore: date / number
1480
1479
  startTime: fromSession ? fromSession.startTime : new Date(), creationTime: fromSession ? fromSession.creationTime : null, answerTime: fromSession ? fromSession.answerTime : null, endTime: fromSession ? fromSession.endTime : null, answered: state === session_state_1.SessionState.Established, paused: this.client.isCallHeld(sipSession), isCaller: fromSession ? fromSession.isCaller : 'incoming' in extra ? !extra.incoming : false, cameraEnabled: fromSession ? fromSession.isCameraEnabled() : this.client.hasVideo(sessionId), number, ringing: false, muted: fromSession ? fromSession.isMuted() : this.client.isAudioMuted(sipSession), videoMuted: fromSession ? fromSession.isVideoMuted() : false, recording: fromSession ? fromSession.isRecording() : false, recordingPaused: false, sipSession, conference: !!fromSession && fromSession.isConference() }, extra));
1481
1480
  this.callSessions[sessionId] = callSession;
package/lib/index.js CHANGED
@@ -17,8 +17,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.WazoApiClient = exports.WebRTCClient = exports.SOCKET_EVENTS = exports.WebSocketClient = exports.AdHocAPIConference = exports.CallApi = exports.setIsMobile = exports.setOnRefreshTokenError = exports.setOnRefreshToken = exports.setCurrentServer = exports.setApiToken = exports.getApiClient = exports.SipLine = exports.MeetingAuthorization = exports.MeetingStatus = exports.ApiRequester = exports.Checker = exports.DebugDevice = exports.Meeting = exports.CTIPhone = exports.WebRTCPhone = exports.CallerID = exports.SwitchboardCall = exports.IndirectTransfer = exports.CallSession = exports.Room = exports.Relocation = exports.Voicemail = exports.Session = exports.LINE_STATE = exports.PROFILE_STATE = exports.Profile = exports.NotificationOptions = exports.Line = exports.Incall = exports.FORWARD_KEYS = exports.ForwardOption = exports.Features = exports.COUNTRIES = exports.Contact = exports.ChatRoom = exports.ChatMessage = exports.Recording = exports.CallLog = exports.Call = exports.SFUNotAvailableError = exports.ServerError = exports.BadResponse = exports.IssueReporter = exports.Emitter = void 0;
21
- exports.SessionDescriptionHandler = exports.ExternalApp = exports.Agent = void 0;
20
+ exports.SOCKET_EVENTS = exports.WebSocketClient = exports.AdHocAPIConference = exports.CallApi = exports.setIsMobile = exports.setOnRefreshTokenError = exports.setOnRefreshToken = exports.setCurrentServer = exports.setApiToken = exports.getApiClient = exports.SipLine = exports.MeetingAuthorization = exports.MeetingStatus = exports.ApiRequester = exports.Checker = exports.DebugDevice = exports.Meeting = exports.CTIPhone = exports.WebRTCPhone = exports.CallerID = exports.SwitchboardCall = exports.IndirectTransfer = exports.CallSession = exports.Room = exports.Relocation = exports.Voicemail = exports.Session = exports.LINE_STATE = exports.PROFILE_STATE = exports.Profile = exports.NotificationOptions = exports.Line = exports.Incall = exports.FORWARD_KEYS = exports.ForwardOption = exports.Features = exports.COUNTRIES = exports.Contact = exports.ChatRoom = exports.ChatMessage = exports.Recording = exports.CallLog = exports.Call = exports.SFUNotAvailableError = exports.InvalidState = exports.InvalidStateTransition = exports.ServerError = exports.BadResponse = exports.IssueReporter = exports.Emitter = void 0;
21
+ exports.SessionDescriptionHandler = exports.ExternalApp = exports.Agent = exports.WazoApiClient = exports.WebRTCClient = void 0;
22
22
  const index_1 = __importDefault(require("./simple/index"));
23
23
  var Emitter_1 = require("./utils/Emitter");
24
24
  Object.defineProperty(exports, "Emitter", { enumerable: true, get: function () { return __importDefault(Emitter_1).default; } });
@@ -28,6 +28,10 @@ var BadResponse_1 = require("./domain/BadResponse");
28
28
  Object.defineProperty(exports, "BadResponse", { enumerable: true, get: function () { return __importDefault(BadResponse_1).default; } });
29
29
  var ServerError_1 = require("./domain/ServerError");
30
30
  Object.defineProperty(exports, "ServerError", { enumerable: true, get: function () { return __importDefault(ServerError_1).default; } });
31
+ var InvalidStateTransition_1 = require("./domain/InvalidStateTransition");
32
+ Object.defineProperty(exports, "InvalidStateTransition", { enumerable: true, get: function () { return __importDefault(InvalidStateTransition_1).default; } });
33
+ var InvalidState_1 = require("./domain/InvalidState");
34
+ Object.defineProperty(exports, "InvalidState", { enumerable: true, get: function () { return __importDefault(InvalidState_1).default; } });
31
35
  var SFUNotAvailableError_1 = require("./domain/SFUNotAvailableError");
32
36
  Object.defineProperty(exports, "SFUNotAvailableError", { enumerable: true, get: function () { return __importDefault(SFUNotAvailableError_1).default; } });
33
37
  var Call_1 = require("./domain/Call");
@@ -156,25 +156,19 @@ class Auth {
156
156
  }
157
157
  initiateIdpAuthentication(domain, redirectUrl) {
158
158
  return __awaiter(this, void 0, void 0, function* () {
159
- let response;
160
159
  try {
161
- response = yield (0, getApiClient_1.default)().auth.initiateIdpAuthentication(domain, redirectUrl);
160
+ return yield (0, getApiClient_1.default)().auth.initiateIdpAuthentication(domain, redirectUrl);
162
161
  }
163
162
  catch (e) {
164
- logger.error('Error during IdP authentication initiation:', e.message);
165
- return;
166
- }
167
- if (!response.ok) {
168
- if (response.status === 404) {
169
- throw new NoSamlRouteError('No route found for saml sso');
163
+ logger.error('Error during IdP authentication initialization:', e.message);
164
+ if (e.status === 404) {
165
+ throw new NoSamlRouteError('No route found for SAML SSO');
170
166
  }
171
- if (response.status === 500) {
167
+ if (e.status === 500) {
172
168
  throw new SamlConfigError('SAML/server configuration error');
173
169
  }
174
- const error = yield response.json();
175
- throw new Error(error.message || error.reason);
170
+ throw e;
176
171
  }
177
- return response.json();
178
172
  });
179
173
  }
180
174
  logInViaRefreshToken(refreshToken) {
@@ -50,6 +50,7 @@ const logger = IssueReporter_1.default.loggerFor('simple-phone');
50
50
  const sipLogger = IssueReporter_1.default.loggerFor('sip.js');
51
51
  const protocolLogger = IssueReporter_1.default.loggerFor('sip');
52
52
  const protocolDebugMessages = ['Received WebSocket text message:', 'Sending WebSocket message:'];
53
+ // @deprecated: Use Wazo.Voice.Softphone instead
53
54
  class Phone extends Emitter_1.default {
54
55
  constructor() {
55
56
  super();
@@ -31,7 +31,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
31
31
  step((generator = generator.apply(thisArg, _arguments || [])).next());
32
32
  });
33
33
  };
34
+ var __importDefault = (this && this.__importDefault) || function (mod) {
35
+ return (mod && mod.__esModule) ? mod : { "default": mod };
36
+ };
34
37
  Object.defineProperty(exports, "__esModule", { value: true });
38
+ const BadResponse_1 = __importDefault(require("../../domain/BadResponse"));
39
+ const ServerError_1 = __importDefault(require("../../domain/ServerError"));
35
40
  const getApiClient_1 = __importStar(require("../../service/getApiClient"));
36
41
  const Auth_1 = require("../Auth");
37
42
  const Auth = new Auth_1.Auth();
@@ -144,12 +149,8 @@ describe('simple/Auth', () => {
144
149
  });
145
150
  describe('initiateIdpAuthentication', () => {
146
151
  const validResponse = { location: 'idp.com/auth', saml_session_id: 'a1b2C3d4' };
147
- it('should return a `location` and `saml_session_id` if the response is ok', () => __awaiter(void 0, void 0, void 0, function* () {
148
- const initiateIdpAuthentication = jest.fn(() => Promise.resolve({
149
- ok: true,
150
- status: 303,
151
- json: () => Promise.resolve(validResponse),
152
- }));
152
+ it('should return a `location` and `saml_session_id` if the response is valid', () => __awaiter(void 0, void 0, void 0, function* () {
153
+ const initiateIdpAuthentication = jest.fn(() => validResponse);
153
154
  getApiClient_1.default.mockImplementation(() => ({
154
155
  auth: {
155
156
  initiateIdpAuthentication,
@@ -159,70 +160,16 @@ describe('simple/Auth', () => {
159
160
  expect(response).toBe(validResponse);
160
161
  }));
161
162
  it('should return a `NoSamlRouteError` if the response is a 404', () => __awaiter(void 0, void 0, void 0, function* () {
162
- const initiateIdpAuthentication = jest.fn(() => Promise.resolve({
163
- ok: false,
164
- status: 404,
165
- }));
166
- getApiClient_1.default.mockImplementation(() => ({
167
- auth: {
168
- initiateIdpAuthentication,
169
- },
170
- }));
171
- yield expect(Auth.initiateIdpAuthentication('example.com', 'https://myapp.xyz')).rejects.toThrow('No route found for saml sso');
172
- }));
173
- it('should return an error `message` if the response is NOT ok', () => __awaiter(void 0, void 0, void 0, function* () {
174
- const initiateIdpAuthentication = jest.fn(() => Promise.resolve({
175
- ok: false,
176
- json: () => Promise.resolve({ message: 'an error message', reason: 'an error reason' }),
177
- }));
178
- getApiClient_1.default.mockImplementation(() => ({
179
- auth: {
180
- initiateIdpAuthentication,
181
- },
182
- }));
183
- yield expect(Auth.initiateIdpAuthentication('example.com', 'https://myapp.xyz')).rejects.toThrow('an error message');
184
- }));
185
- it('should return an error `reason` if there is no `message` and the response is NOT ok', () => __awaiter(void 0, void 0, void 0, function* () {
186
- const initiateIdpAuthentication = jest.fn(() => Promise.resolve({
187
- ok: false,
188
- json: () => Promise.resolve({ reason: 'an error reason' }),
189
- }));
190
- getApiClient_1.default.mockImplementation(() => ({
191
- auth: {
192
- initiateIdpAuthentication,
193
- },
194
- }));
195
- yield expect(Auth.initiateIdpAuthentication('example.com', 'https://myapp.xyz')).rejects.toThrow('an error reason');
196
- }));
197
- it('should return an error with a null message if there is no `message` and `reason`', () => __awaiter(void 0, void 0, void 0, function* () {
198
- const initiateIdpAuthentication = jest.fn(() => Promise.resolve({
199
- ok: false,
200
- json: () => Promise.resolve({}),
201
- }));
163
+ const initiateIdpAuthentication = jest.fn(() => { throw BadResponse_1.default.fromText('an error message', 404); });
202
164
  getApiClient_1.default.mockImplementation(() => ({
203
165
  auth: {
204
166
  initiateIdpAuthentication,
205
167
  },
206
168
  }));
207
- yield expect(Auth.initiateIdpAuthentication('example.com', 'https://myapp.xyz')).rejects.toThrow('');
169
+ yield expect(Auth.initiateIdpAuthentication('example.com', 'https://myapp.xyz')).rejects.toThrow('No route found for SAML SSO');
208
170
  }));
209
- it('should return a NoSAMLRouteError if the response is a 404', () => __awaiter(void 0, void 0, void 0, function* () {
210
- const initiateIdpAuthentication = jest.fn(() => Promise.resolve({
211
- ok: false,
212
- status: 404,
213
- }));
214
- getApiClient_1.default.mockImplementation(() => ({
215
- auth: {
216
- initiateIdpAuthentication,
217
- },
218
- }));
219
- yield expect(Auth.initiateIdpAuthentication('example.com', 'https://myapp.xyz')).rejects.toThrow('No route found for saml sso');
220
- }));
221
- it('should return a SamlConfigError if the response is a 500', () => __awaiter(void 0, void 0, void 0, function* () {
222
- const initiateIdpAuthentication = jest.fn(() => Promise.resolve({
223
- ok: false,
224
- status: 500,
225
- }));
171
+ it('should return a `SamlConfigError` if the response is a 500', () => __awaiter(void 0, void 0, void 0, function* () {
172
+ const initiateIdpAuthentication = jest.fn(() => { throw ServerError_1.default.fromText('an error message', 500); });
226
173
  getApiClient_1.default.mockImplementation(() => ({
227
174
  auth: {
228
175
  initiateIdpAuthentication,
@@ -35,7 +35,7 @@ exports.EstablishedActions = {
35
35
  };
36
36
  const callMachine = (0, xstate_1.setup)({
37
37
  guards: {
38
- isRegistered: () => softphone_1.default.getState() === softphone_state_machine_1.States.REGISTERED,
38
+ isRegistered: () => softphone_1.default.state === softphone_state_machine_1.States.REGISTERED,
39
39
  },
40
40
  }).createMachine({
41
41
  id: 'call',
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/api/auth.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,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