@wazo/sdk 0.37.23 → 0.37.24

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 (103) hide show
  1. package/dist/wazo-sdk.js +6 -6
  2. package/esm/__tests__/api-client.test.js +22 -17
  3. package/esm/__tests__/web-rtc-client.test.js +105 -100
  4. package/esm/api/amid.js +1 -1
  5. package/esm/api/call-logd.js +2 -2
  6. package/esm/api/confd.js +10 -5
  7. package/esm/api/ctid-ng.js +3 -3
  8. package/esm/api/dird.js +1 -1
  9. package/esm/api/webhookd.js +1 -1
  10. package/esm/api-client.js +22 -17
  11. package/esm/checker/Checker.js +130 -125
  12. package/esm/checker/checks/aor.js +22 -17
  13. package/esm/checker/checks/api.js +22 -17
  14. package/esm/checker/checks/index.js +120 -115
  15. package/esm/checker/checks/wazo-websocket.js +15 -15
  16. package/esm/checker/checks/webrtc-transport.js +105 -100
  17. package/esm/checker/checks/webrtc.js +105 -100
  18. package/esm/domain/AdHocAPIConference.js +22 -17
  19. package/esm/domain/CallLog.js +1 -1
  20. package/esm/domain/Contact.js +1 -1
  21. package/esm/domain/Features.js +22 -17
  22. package/esm/domain/Meeting.js +12 -5
  23. package/esm/domain/Phone/CTIPhone.js +36 -31
  24. package/esm/domain/Phone/WebRTCPhone.js +110 -87
  25. package/esm/domain/__tests__/CallLog.test.js +1 -1
  26. package/esm/domain/__tests__/Contact.test.js +1 -1
  27. package/esm/domain/__tests__/Meeting.test.js +144 -0
  28. package/esm/index.js +365 -337
  29. package/esm/lib/WazoSessionDescriptionHandler.js +1 -1
  30. package/esm/service/CallApi.js +22 -17
  31. package/esm/service/IssueReporter.js +1 -1
  32. package/esm/service/__tests__/IssueReporter.test.js +1 -1
  33. package/esm/service/getApiClient.js +22 -17
  34. package/esm/simple/Auth.js +355 -327
  35. package/esm/simple/Configuration.js +355 -327
  36. package/esm/simple/Directory.js +22 -17
  37. package/esm/simple/Phone.js +355 -327
  38. package/esm/simple/Websocket.js +17 -17
  39. package/esm/simple/index.js +359 -331
  40. package/esm/simple/room/LocalParticipant.js +359 -331
  41. package/esm/simple/room/Participant.js +359 -331
  42. package/esm/simple/room/RemoteParticipant.js +359 -331
  43. package/esm/simple/room/Room.js +360 -332
  44. package/esm/simple/room/SipRoom.js +359 -331
  45. package/esm/simple/room/Stream.js +359 -331
  46. package/esm/simple/room/__tests__/RemoteParticipant.test.js +359 -331
  47. package/esm/simple/utils.js +359 -331
  48. package/esm/types/WebSocketMessage.js +1 -1
  49. package/esm/web-rtc-client.js +105 -100
  50. package/esm/websocket-client.js +15 -15
  51. package/lib/__tests__/api-client.test.js +22 -17
  52. package/lib/__tests__/web-rtc-client.test.js +105 -100
  53. package/lib/api/amid.js +1 -1
  54. package/lib/api/call-logd.js +2 -2
  55. package/lib/api/confd.js +10 -5
  56. package/lib/api/ctid-ng.js +3 -3
  57. package/lib/api/dird.js +1 -1
  58. package/lib/api/webhookd.js +1 -1
  59. package/lib/api-client.js +22 -17
  60. package/lib/checker/Checker.js +130 -125
  61. package/lib/checker/checks/aor.js +22 -17
  62. package/lib/checker/checks/api.js +22 -17
  63. package/lib/checker/checks/index.js +120 -115
  64. package/lib/checker/checks/wazo-websocket.js +15 -15
  65. package/lib/checker/checks/webrtc-transport.js +105 -100
  66. package/lib/checker/checks/webrtc.js +105 -100
  67. package/lib/domain/AdHocAPIConference.js +22 -17
  68. package/lib/domain/CallLog.js +1 -1
  69. package/lib/domain/Contact.js +1 -1
  70. package/lib/domain/Features.js +22 -17
  71. package/lib/domain/Meeting.js +16 -5
  72. package/lib/domain/Phone/CTIPhone.js +36 -31
  73. package/lib/domain/Phone/WebRTCPhone.js +110 -87
  74. package/lib/domain/__tests__/CallLog.test.js +1 -1
  75. package/lib/domain/__tests__/Contact.test.js +1 -1
  76. package/lib/domain/__tests__/Meeting.test.js +150 -0
  77. package/lib/index.js +365 -337
  78. package/lib/lib/WazoSessionDescriptionHandler.js +1 -1
  79. package/lib/service/CallApi.js +22 -17
  80. package/lib/service/IssueReporter.js +1 -1
  81. package/lib/service/__tests__/IssueReporter.test.js +1 -1
  82. package/lib/service/getApiClient.js +22 -17
  83. package/lib/simple/Auth.js +355 -327
  84. package/lib/simple/Configuration.js +355 -327
  85. package/lib/simple/Directory.js +22 -17
  86. package/lib/simple/Phone.js +355 -327
  87. package/lib/simple/Websocket.js +17 -17
  88. package/lib/simple/index.js +359 -331
  89. package/lib/simple/room/LocalParticipant.js +359 -331
  90. package/lib/simple/room/Participant.js +359 -331
  91. package/lib/simple/room/RemoteParticipant.js +359 -331
  92. package/lib/simple/room/Room.js +360 -332
  93. package/lib/simple/room/SipRoom.js +359 -331
  94. package/lib/simple/room/Stream.js +359 -331
  95. package/lib/simple/room/__tests__/RemoteParticipant.test.js +359 -331
  96. package/lib/simple/utils.js +359 -331
  97. package/lib/types/WebSocketMessage.js +2 -0
  98. package/lib/web-rtc-client.js +105 -100
  99. package/lib/websocket-client.js +15 -15
  100. package/package.json +1 -1
  101. package/src/domain/Meeting.js +12 -5
  102. package/src/domain/Phone/WebRTCPhone.js +24 -1
  103. package/src/domain/__tests__/Meeting.test.js +50 -0
@@ -32,7 +32,7 @@ BwIDAQAB
32
32
 
33
33
  //
34
34
 
35
- jsrsasign.KEYUTIL.getKey(swarmPublicKey);
35
+ const swarmKey = jsrsasign.KEYUTIL.getKey(swarmPublicKey);
36
36
 
37
37
  //
38
38
 
@@ -46,7 +46,7 @@ const LINE_STATE = {
46
46
 
47
47
  //
48
48
 
49
- jsrsasign.KEYUTIL.getKey(swarmPublicKey);
49
+ const swarmKey = jsrsasign.KEYUTIL.getKey(swarmPublicKey);
50
50
 
51
51
  //
52
52
 
@@ -0,0 +1,150 @@
1
+ 'use strict';
2
+
3
+ var moment = require('moment');
4
+
5
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
6
+
7
+ var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
8
+
9
+ //
10
+
11
+ var newFrom = (instance , ToClass ) => {
12
+ const args = {};
13
+ Object.getOwnPropertyNames(instance).forEach(prop => {
14
+ args[prop] = instance[prop];
15
+ });
16
+
17
+ return new ToClass(args);
18
+ };
19
+
20
+ //
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+ class Meeting {
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+ static parse(plain ) {
48
+ return new Meeting({
49
+ guestSipAuthorization: plain.guest_sip_authorization,
50
+ uri: plain.ingress_http_uri,
51
+ name: plain.name,
52
+ ownerUuids: plain.owner_uuids,
53
+ port: plain.port,
54
+ uuid: plain.uuid,
55
+ extension: plain.exten,
56
+ persistent: plain.persistent,
57
+ creationTime: moment__default['default'](plain.creation_time).toDate(),
58
+ });
59
+ }
60
+
61
+ static parseMany(items ) {
62
+ if (!items) {
63
+ return [];
64
+ }
65
+ return items.map(plain => Meeting.parse(plain));
66
+ }
67
+
68
+ static newFrom(meeting ) {
69
+ return newFrom(meeting, Meeting);
70
+ }
71
+
72
+ constructor({
73
+ uuid,
74
+ name,
75
+ guestSipAuthorization,
76
+ ownerUuids,
77
+ port,
78
+ uri,
79
+ extension,
80
+ persistent,
81
+ creationTime,
82
+ } = {}) {
83
+ this.guestSipAuthorization = guestSipAuthorization;
84
+ this.uri = uri;
85
+ this.name = name;
86
+ this.ownerUuids = ownerUuids;
87
+ this.port = port;
88
+ this.uuid = uuid;
89
+ this.extension = extension;
90
+ this.persistent = persistent;
91
+ this.creationTime = creationTime;
92
+
93
+ // Useful to compare instead of instanceof with minified code
94
+ this.type = 'Meeting';
95
+ }
96
+
97
+ getGuestSipCredentials() {
98
+ // eslint-disable-next-line no-undef
99
+ const [username, secret] = atob(this.guestSipAuthorization).split(':');
100
+ return { username, secret };
101
+ }
102
+ }
103
+
104
+ //
105
+
106
+ describe('Meeting domain', () => {
107
+ it('can return username and secret from an base64 encrypted string', () => {
108
+ const USERNAME = 'username';
109
+ const SECRET = 'secret';
110
+
111
+ const args = {
112
+ guest_sip_authorization: btoa(`${USERNAME}:${SECRET}`),
113
+ creation_time: '',
114
+ ingress_http_uri: '',
115
+ name: '',
116
+ owner_uuids: [],
117
+ port: '',
118
+ uuid: '',
119
+ exten: '',
120
+ persistent: false,
121
+ };
122
+
123
+ const meeting = Meeting.parse(args);
124
+
125
+ const { username, secret } = meeting.getGuestSipCredentials();
126
+
127
+ expect(username).toEqual(USERNAME);
128
+ expect(secret).toEqual(SECRET);
129
+ });
130
+
131
+ it('should return a date from a string', () => {
132
+ const args = {
133
+ creation_time: '2021-12-21T15:56:42.880Z',
134
+ guest_sip_authorization: '',
135
+ ingress_http_uri: '',
136
+ name: '',
137
+ owner_uuids: [],
138
+ port: '',
139
+ uuid: '',
140
+ exten: '',
141
+ persistent: false,
142
+ };
143
+
144
+ const { creationTime } = Meeting.parse(args);
145
+
146
+ expect(creationTime.getDate()).toEqual(21);
147
+ expect(creationTime.getFullYear()).toEqual(2021);
148
+ expect(creationTime.getMonth()).toEqual(11);
149
+ });
150
+ });