@webex/plugin-meetings 3.0.0-beta.1 → 3.0.0-beta.11

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 (281) hide show
  1. package/dist/common/browser-detection.js.map +1 -1
  2. package/dist/common/collection.js.map +1 -1
  3. package/dist/common/config.js.map +1 -1
  4. package/dist/common/errors/captcha-error.js +7 -0
  5. package/dist/common/errors/captcha-error.js.map +1 -1
  6. package/dist/common/errors/intent-to-join.js +8 -0
  7. package/dist/common/errors/intent-to-join.js.map +1 -1
  8. package/dist/common/errors/join-meeting.js +8 -0
  9. package/dist/common/errors/join-meeting.js.map +1 -1
  10. package/dist/common/errors/media.js +7 -0
  11. package/dist/common/errors/media.js.map +1 -1
  12. package/dist/common/errors/parameter.js.map +1 -1
  13. package/dist/common/errors/password-error.js +7 -0
  14. package/dist/common/errors/password-error.js.map +1 -1
  15. package/dist/common/errors/permission.js +7 -0
  16. package/dist/common/errors/permission.js.map +1 -1
  17. package/dist/common/errors/reconnection-in-progress.js.map +1 -1
  18. package/dist/common/errors/reconnection.js +7 -0
  19. package/dist/common/errors/reconnection.js.map +1 -1
  20. package/dist/common/errors/stats.js +7 -0
  21. package/dist/common/errors/stats.js.map +1 -1
  22. package/dist/common/errors/webex-errors.js +5 -29
  23. package/dist/common/errors/webex-errors.js.map +1 -1
  24. package/dist/common/errors/webex-meetings-error.js +5 -2
  25. package/dist/common/errors/webex-meetings-error.js.map +1 -1
  26. package/dist/common/events/events-scope.js.map +1 -1
  27. package/dist/common/events/events.js.map +1 -1
  28. package/dist/common/events/trigger-proxy.js.map +1 -1
  29. package/dist/common/events/util.js.map +1 -1
  30. package/dist/common/logs/logger-config.js.map +1 -1
  31. package/dist/common/logs/logger-proxy.js.map +1 -1
  32. package/dist/common/logs/request.js +3 -0
  33. package/dist/common/logs/request.js.map +1 -1
  34. package/dist/common/queue.js.map +1 -1
  35. package/dist/config.js +1 -0
  36. package/dist/config.js.map +1 -1
  37. package/dist/constants.js +15 -74
  38. package/dist/constants.js.map +1 -1
  39. package/dist/locus-info/controlsUtils.js.map +1 -1
  40. package/dist/locus-info/embeddedAppsUtils.js.map +1 -1
  41. package/dist/locus-info/fullState.js.map +1 -1
  42. package/dist/locus-info/hostUtils.js.map +1 -1
  43. package/dist/locus-info/index.js +43 -5
  44. package/dist/locus-info/index.js.map +1 -1
  45. package/dist/locus-info/infoUtils.js +4 -0
  46. package/dist/locus-info/infoUtils.js.map +1 -1
  47. package/dist/locus-info/mediaSharesUtils.js.map +1 -1
  48. package/dist/locus-info/parser.js +12 -3
  49. package/dist/locus-info/parser.js.map +1 -1
  50. package/dist/locus-info/selfUtils.js.map +1 -1
  51. package/dist/media/index.js +71 -210
  52. package/dist/media/index.js.map +1 -1
  53. package/dist/media/internal-media-core-wrapper.js +22 -0
  54. package/dist/media/internal-media-core-wrapper.js.map +1 -0
  55. package/dist/media/properties.js +32 -25
  56. package/dist/media/properties.js.map +1 -1
  57. package/dist/media/util.js +0 -27
  58. package/dist/media/util.js.map +1 -1
  59. package/dist/mediaQualityMetrics/config.js.map +1 -1
  60. package/dist/meeting/effectsState.js +8 -1
  61. package/dist/meeting/effectsState.js.map +1 -1
  62. package/dist/meeting/index.js +1146 -602
  63. package/dist/meeting/index.js.map +1 -1
  64. package/dist/meeting/muteState.js +6 -0
  65. package/dist/meeting/muteState.js.map +1 -1
  66. package/dist/meeting/request.js +83 -24
  67. package/dist/meeting/request.js.map +1 -1
  68. package/dist/meeting/state.js.map +1 -1
  69. package/dist/meeting/util.js +5 -44
  70. package/dist/meeting/util.js.map +1 -1
  71. package/dist/meeting-info/collection.js +4 -1
  72. package/dist/meeting-info/collection.js.map +1 -1
  73. package/dist/meeting-info/index.js +5 -0
  74. package/dist/meeting-info/index.js.map +1 -1
  75. package/dist/meeting-info/meeting-info-v2.js +14 -2
  76. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  77. package/dist/meeting-info/request.js +3 -0
  78. package/dist/meeting-info/request.js.map +1 -1
  79. package/dist/meeting-info/util.js.map +1 -1
  80. package/dist/meeting-info/utilv2.js.map +1 -1
  81. package/dist/meetings/collection.js +4 -1
  82. package/dist/meetings/collection.js.map +1 -1
  83. package/dist/meetings/index.js +136 -25
  84. package/dist/meetings/index.js.map +1 -1
  85. package/dist/meetings/request.js +4 -0
  86. package/dist/meetings/request.js.map +1 -1
  87. package/dist/meetings/util.js +24 -1
  88. package/dist/meetings/util.js.map +1 -1
  89. package/dist/member/index.js +30 -7
  90. package/dist/member/index.js.map +1 -1
  91. package/dist/member/util.js +2 -1
  92. package/dist/member/util.js.map +1 -1
  93. package/dist/members/collection.js +1 -0
  94. package/dist/members/collection.js.map +1 -1
  95. package/dist/members/index.js +82 -1
  96. package/dist/members/index.js.map +1 -1
  97. package/dist/members/request.js +19 -9
  98. package/dist/members/request.js.map +1 -1
  99. package/dist/members/util.js.map +1 -1
  100. package/dist/metrics/config.js.map +1 -1
  101. package/dist/metrics/constants.js.map +1 -1
  102. package/dist/metrics/index.js +8 -0
  103. package/dist/metrics/index.js.map +1 -1
  104. package/dist/multistream/mediaRequestManager.js +133 -0
  105. package/dist/multistream/mediaRequestManager.js.map +1 -0
  106. package/dist/multistream/multistreamMedia.js +116 -0
  107. package/dist/multistream/multistreamMedia.js.map +1 -0
  108. package/dist/multistream/receiveSlot.js +209 -0
  109. package/dist/multistream/receiveSlot.js.map +1 -0
  110. package/dist/multistream/receiveSlotManager.js +195 -0
  111. package/dist/multistream/receiveSlotManager.js.map +1 -0
  112. package/dist/multistream/remoteMedia.js +289 -0
  113. package/dist/multistream/remoteMedia.js.map +1 -0
  114. package/dist/multistream/remoteMediaGroup.js +243 -0
  115. package/dist/multistream/remoteMediaGroup.js.map +1 -0
  116. package/dist/multistream/remoteMediaManager.js +1113 -0
  117. package/dist/multistream/remoteMediaManager.js.map +1 -0
  118. package/dist/networkQualityMonitor/index.js +10 -2
  119. package/dist/networkQualityMonitor/index.js.map +1 -1
  120. package/dist/personal-meeting-room/index.js +11 -0
  121. package/dist/personal-meeting-room/index.js.map +1 -1
  122. package/dist/personal-meeting-room/request.js +2 -1
  123. package/dist/personal-meeting-room/request.js.map +1 -1
  124. package/dist/personal-meeting-room/util.js.map +1 -1
  125. package/dist/reachability/index.js +17 -7
  126. package/dist/reachability/index.js.map +1 -1
  127. package/dist/reachability/request.js +1 -0
  128. package/dist/reachability/request.js.map +1 -1
  129. package/dist/reactions/reactions.js +111 -0
  130. package/dist/reactions/reactions.js.map +1 -0
  131. package/dist/reactions/reactions.type.js +40 -0
  132. package/dist/reactions/reactions.type.js.map +1 -0
  133. package/dist/reconnection-manager/index.js +130 -132
  134. package/dist/reconnection-manager/index.js.map +1 -1
  135. package/dist/roap/index.js +58 -231
  136. package/dist/roap/index.js.map +1 -1
  137. package/dist/roap/request.js +7 -116
  138. package/dist/roap/request.js.map +1 -1
  139. package/dist/roap/turnDiscovery.js +20 -6
  140. package/dist/roap/turnDiscovery.js.map +1 -1
  141. package/dist/statsAnalyzer/global.js +2 -0
  142. package/dist/statsAnalyzer/global.js.map +1 -1
  143. package/dist/statsAnalyzer/index.js +58 -37
  144. package/dist/statsAnalyzer/index.js.map +1 -1
  145. package/dist/statsAnalyzer/mqaUtil.js +9 -3
  146. package/dist/statsAnalyzer/mqaUtil.js.map +1 -1
  147. package/dist/transcription/index.js +10 -3
  148. package/dist/transcription/index.js.map +1 -1
  149. package/package.json +21 -20
  150. package/src/common/{browser-detection.js → browser-detection.ts} +1 -1
  151. package/src/common/collection.ts +6 -6
  152. package/src/common/{config.js → config.ts} +1 -1
  153. package/src/common/errors/{captcha-error.js → captcha-error.ts} +5 -1
  154. package/src/common/errors/{intent-to-join.js → intent-to-join.ts} +6 -1
  155. package/src/common/errors/{join-meeting.js → join-meeting.ts} +6 -1
  156. package/src/common/errors/{media.js → media.ts} +5 -1
  157. package/src/common/errors/parameter.ts +3 -2
  158. package/src/common/errors/{password-error.js → password-error.ts} +5 -1
  159. package/src/common/errors/{permission.js → permission.ts} +5 -1
  160. package/src/common/errors/{reconnection-in-progress.js → reconnection-in-progress.ts} +0 -0
  161. package/src/common/errors/{reconnection.js → reconnection.ts} +5 -1
  162. package/src/common/errors/{stats.js → stats.ts} +5 -1
  163. package/src/common/errors/{webex-errors.js → webex-errors.ts} +1 -20
  164. package/src/common/errors/{webex-meetings-error.js → webex-meetings-error.ts} +3 -1
  165. package/src/common/events/{events-scope.js → events-scope.ts} +1 -1
  166. package/src/common/events/{events.js → events.ts} +0 -0
  167. package/src/common/events/{trigger-proxy.js → trigger-proxy.ts} +1 -2
  168. package/src/common/events/{util.js → util.ts} +1 -1
  169. package/src/common/logs/{logger-config.js → logger-config.ts} +1 -2
  170. package/src/common/logs/{logger-proxy.js → logger-proxy.ts} +1 -1
  171. package/src/common/logs/{request.js → request.ts} +12 -2
  172. package/src/common/queue.ts +1 -2
  173. package/src/{config.js → config.ts} +2 -0
  174. package/src/constants.ts +139 -179
  175. package/src/locus-info/{controlsUtils.js → controlsUtils.ts} +4 -4
  176. package/src/locus-info/{embeddedAppsUtils.js → embeddedAppsUtils.ts} +5 -6
  177. package/src/locus-info/{fullState.js → fullState.ts} +1 -1
  178. package/src/locus-info/{hostUtils.js → hostUtils.ts} +5 -5
  179. package/src/locus-info/{index.js → index.ts} +67 -32
  180. package/src/locus-info/{infoUtils.js → infoUtils.ts} +7 -4
  181. package/src/locus-info/{mediaSharesUtils.js → mediaSharesUtils.ts} +13 -13
  182. package/src/locus-info/{parser.js → parser.ts} +22 -12
  183. package/src/locus-info/{selfUtils.js → selfUtils.ts} +17 -19
  184. package/src/media/{index.js → index.ts} +130 -205
  185. package/src/media/internal-media-core-wrapper.ts +9 -0
  186. package/src/media/{properties.js → properties.ts} +35 -29
  187. package/src/media/util.ts +16 -0
  188. package/src/mediaQualityMetrics/{config.js → config.ts} +1 -1
  189. package/src/meeting/{effectsState.js → effectsState.ts} +12 -6
  190. package/src/meeting/{index.js → index.ts} +993 -474
  191. package/src/meeting/{muteState.js → muteState.ts} +16 -11
  192. package/src/meeting/{request.js → request.ts} +148 -36
  193. package/src/meeting/{state.js → state.ts} +6 -6
  194. package/src/meeting/{util.js → util.ts} +9 -51
  195. package/src/meeting-info/{collection.js → collection.ts} +4 -1
  196. package/src/meeting-info/{index.js → index.ts} +10 -6
  197. package/src/meeting-info/{meeting-info-v2.js → meeting-info-v2.ts} +28 -10
  198. package/src/meeting-info/{request.js → request.ts} +6 -2
  199. package/src/meeting-info/{util.js → util.ts} +6 -5
  200. package/src/meeting-info/{utilv2.js → utilv2.ts} +8 -7
  201. package/src/meetings/{collection.js → collection.ts} +5 -2
  202. package/src/meetings/{index.js → index.ts} +118 -22
  203. package/src/meetings/{request.js → request.ts} +6 -1
  204. package/src/meetings/{util.js → util.ts} +28 -5
  205. package/src/member/{index.js → index.ts} +46 -15
  206. package/src/member/{util.js → util.ts} +17 -16
  207. package/src/members/{collection.js → collection.ts} +2 -1
  208. package/src/members/{index.js → index.ts} +94 -26
  209. package/src/members/{request.js → request.ts} +16 -5
  210. package/src/members/{util.js → util.ts} +7 -7
  211. package/src/metrics/{config.js → config.ts} +0 -2
  212. package/src/metrics/{constants.js → constants.ts} +0 -0
  213. package/src/metrics/{index.js → index.ts} +27 -8
  214. package/src/multistream/mediaRequestManager.ts +166 -0
  215. package/src/multistream/multistreamMedia.ts +92 -0
  216. package/src/multistream/receiveSlot.ts +141 -0
  217. package/src/multistream/receiveSlotManager.ts +142 -0
  218. package/src/multistream/remoteMedia.ts +228 -0
  219. package/src/multistream/remoteMediaGroup.ts +224 -0
  220. package/src/multistream/remoteMediaManager.ts +911 -0
  221. package/src/networkQualityMonitor/{index.js → index.ts} +18 -3
  222. package/src/personal-meeting-room/{index.js → index.ts} +17 -4
  223. package/src/personal-meeting-room/{request.js → request.ts} +3 -1
  224. package/src/personal-meeting-room/{util.js → util.ts} +1 -1
  225. package/src/reachability/{index.js → index.ts} +28 -17
  226. package/src/reachability/request.ts +4 -2
  227. package/src/reactions/reactions.ts +104 -0
  228. package/src/reactions/reactions.type.ts +36 -0
  229. package/src/reconnection-manager/{index.js → index.ts} +81 -65
  230. package/src/roap/index.ts +229 -0
  231. package/src/roap/{request.js → request.ts} +15 -74
  232. package/src/roap/turnDiscovery.ts +26 -11
  233. package/src/statsAnalyzer/{global.js → global.ts} +2 -0
  234. package/src/statsAnalyzer/{index.js → index.ts} +66 -61
  235. package/src/statsAnalyzer/{mqaUtil.js → mqaUtil.ts} +6 -1
  236. package/src/transcription/{index.js → index.ts} +16 -11
  237. package/test/integration/spec/journey.js +1 -1
  238. package/test/integration/spec/space-meeting.js +1 -2
  239. package/test/unit/spec/locus-info/infoUtils.js +17 -1
  240. package/test/unit/spec/media/index.ts +207 -0
  241. package/test/unit/spec/media/properties.ts +73 -82
  242. package/test/unit/spec/meeting/effectsState.js +1 -3
  243. package/test/unit/spec/meeting/index.js +672 -245
  244. package/test/unit/spec/meeting/muteState.js +7 -0
  245. package/test/unit/spec/meeting/request.js +25 -1
  246. package/test/unit/spec/meeting/utils.js +63 -2
  247. package/test/unit/spec/meetings/index.js +0 -4
  248. package/test/unit/spec/members/index.js +164 -2
  249. package/test/unit/spec/multistream/mediaRequestManager.ts +515 -0
  250. package/test/unit/spec/multistream/receiveSlot.ts +104 -0
  251. package/test/unit/spec/multistream/receiveSlotManager.ts +173 -0
  252. package/test/unit/spec/multistream/remoteMedia.ts +225 -0
  253. package/test/unit/spec/multistream/remoteMediaGroup.ts +396 -0
  254. package/test/unit/spec/multistream/remoteMediaManager.ts +1309 -0
  255. package/test/unit/spec/reconnection-manager/index.js +68 -2
  256. package/test/unit/spec/roap/index.ts +63 -35
  257. package/test/unit/spec/stats-analyzer/index.js +19 -22
  258. package/dist/peer-connection-manager/index.js +0 -794
  259. package/dist/peer-connection-manager/index.js.map +0 -1
  260. package/dist/peer-connection-manager/util.js +0 -124
  261. package/dist/peer-connection-manager/util.js.map +0 -1
  262. package/dist/roap/collection.js +0 -73
  263. package/dist/roap/collection.js.map +0 -1
  264. package/dist/roap/handler.js +0 -337
  265. package/dist/roap/handler.js.map +0 -1
  266. package/dist/roap/state.js +0 -164
  267. package/dist/roap/state.js.map +0 -1
  268. package/dist/roap/util.js +0 -102
  269. package/dist/roap/util.js.map +0 -1
  270. package/src/media/util.js +0 -38
  271. package/src/peer-connection-manager/index.js +0 -723
  272. package/src/peer-connection-manager/util.ts +0 -117
  273. package/src/roap/collection.js +0 -63
  274. package/src/roap/handler.js +0 -252
  275. package/src/roap/index.js +0 -380
  276. package/src/roap/state.js +0 -149
  277. package/src/roap/util.js +0 -93
  278. package/test/unit/spec/peerconnection-manager/index.js +0 -188
  279. package/test/unit/spec/peerconnection-manager/utils.js +0 -48
  280. package/test/unit/spec/peerconnection-manager/utils.test-fixtures.ts +0 -389
  281. package/test/unit/spec/roap/util.js +0 -30
@@ -18,11 +18,10 @@ import {
18
18
  import BEHAVIORAL_METRICS from '../metrics/constants';
19
19
  import ReconnectionError from '../common/errors/reconnection';
20
20
  import ReconnectInProgress from '../common/errors/reconnection-in-progress';
21
- import PeerConnectionManager from '../peer-connection-manager';
22
21
  import {eventType, reconnection, errorObjects} from '../metrics/config';
23
22
  import Media from '../media';
24
23
  import Metrics from '../metrics';
25
- import RoapCollection from '../roap/collection';
24
+ import Meeting from '../meeting';
26
25
 
27
26
  /**
28
27
  * Used to indicate that the reconnect logic needs to be retried.
@@ -39,6 +38,8 @@ class NeedsRetryError extends Error {}
39
38
  * @extends {Error}
40
39
  */
41
40
  class NeedsRejoinError extends Error {
41
+ wasSharing: any;
42
+
42
43
  /**
43
44
  * Creates an instance of NeedsRejoinError.
44
45
  * @param {Object} params
@@ -46,7 +47,14 @@ class NeedsRejoinError extends Error {
46
47
  * @param {Error} params.error
47
48
  * @memberof NeedsRejoinError
48
49
  */
49
- constructor({wasSharing, error = new Error('Meeting needs to be rejoined')}) {
50
+ constructor({
51
+ wasSharing,
52
+ error = new Error('Meeting needs to be rejoined'),
53
+ }: {
54
+ wasSharing?: boolean;
55
+ error?: Error;
56
+ }) {
57
+ // @ts-ignore
50
58
  super(error);
51
59
 
52
60
  this.wasSharing = wasSharing;
@@ -58,10 +66,19 @@ class NeedsRejoinError extends Error {
58
66
  * @class ReconnectionManager
59
67
  */
60
68
  export default class ReconnectionManager {
69
+ autoRejoinEnabled: any;
70
+ iceState: any;
71
+ maxRejoinAttempts: any;
72
+ meeting: any;
73
+ rejoinAttempts: any;
74
+ shareStatus: any;
75
+ status: any;
76
+ tryCount: any;
77
+ webex: any;
61
78
  /**
62
79
  * @param {Meeting} meeting
63
80
  */
64
- constructor(meeting) {
81
+ constructor(meeting: Meeting) {
65
82
  /**
66
83
  * Stores ICE reconnection state data.
67
84
  *
@@ -74,6 +91,7 @@ export default class ReconnectionManager {
74
91
  disconnected: false,
75
92
  resolve: () => {},
76
93
  timer: undefined,
94
+ // @ts-ignore
77
95
  timeoutDuration: meeting.config.reconnection.iceReconnectionTimeout
78
96
  };
79
97
 
@@ -99,6 +117,7 @@ export default class ReconnectionManager {
99
117
  */
100
118
  // TODO : change this logic to not save the meeting instance
101
119
  // It gets complicated when meeting ends on remote side , We have a old meeting instance which is not up to date
120
+ // @ts-ignore
102
121
  this.webex = meeting.webex;
103
122
  /**
104
123
  * @instance
@@ -110,8 +129,10 @@ export default class ReconnectionManager {
110
129
  // try moving this to meetings collection
111
130
  this.meeting = meeting;
112
131
 
132
+ // @ts-ignore
113
133
  this.maxRejoinAttempts = meeting.config.reconnection.maxRejoinAttempts;
114
134
  this.rejoinAttempts = RECONNECTION.STATE.DEFAULT_TRY_COUNT;
135
+ // @ts-ignore
115
136
  this.autoRejoinEnabled = meeting.config.reconnection.autoRejoin;
116
137
 
117
138
 
@@ -119,6 +140,21 @@ export default class ReconnectionManager {
119
140
  this.reset();
120
141
  }
121
142
 
143
+ /**
144
+ * @public
145
+ * @memberof ReconnectionManager
146
+ * @returns {void}
147
+ */
148
+ resetReconnectionTimer() {
149
+ this.iceState.resolve();
150
+ this.iceState.resolve = () => {};
151
+
152
+ if (this.iceState.timer) {
153
+ clearTimeout(this.iceState.timer);
154
+ delete this.iceState.timer;
155
+ }
156
+ }
157
+
122
158
  /**
123
159
  * Sets the iceState to connected and clears any disconnect timeouts and
124
160
  * related timeout data within the iceState.
@@ -127,17 +163,11 @@ export default class ReconnectionManager {
127
163
  * @public
128
164
  * @memberof ReconnectionManager
129
165
  */
130
- iceReconnected() {
166
+ public iceReconnected() {
131
167
  if (this.iceState.disconnected) {
132
168
  LoggerProxy.logger.log('ReconnectionManager:index#iceReconnected --> ice has reconnected');
133
169
 
134
- this.iceState.resolve();
135
- this.iceState.resolve = () => {};
136
-
137
- if (this.iceState.timer) {
138
- clearTimeout(this.iceState.timer);
139
- delete this.iceState.timer;
140
- }
170
+ this.resetReconnectionTimer();
141
171
 
142
172
  this.iceState.disconnected = false;
143
173
  }
@@ -153,13 +183,13 @@ export default class ReconnectionManager {
153
183
  * @public
154
184
  * @memberof ReconnectionManager
155
185
  */
156
- waitForIceReconnect() {
186
+ public waitForIceReconnect() {
157
187
  if (!this.iceState.disconnected) {
158
188
  LoggerProxy.logger.log('ReconnectionManager:index#waitForIceReconnect --> waiting for ice reconnect');
159
189
 
160
190
  this.iceState.disconnected = true;
161
191
 
162
- return new Promise((resolve, reject) => {
192
+ return new Promise<void>((resolve, reject) => {
163
193
  this.iceState.timer = setTimeout(() => {
164
194
  if (this.iceState.disconnected === false) {
165
195
  resolve();
@@ -183,7 +213,7 @@ export default class ReconnectionManager {
183
213
  * @public
184
214
  * @memberof ReconnectionManager
185
215
  */
186
- reset() {
216
+ public reset() {
187
217
  this.status = RECONNECTION.STATE.DEFAULT_STATUS;
188
218
  this.tryCount = RECONNECTION.STATE.DEFAULT_TRY_COUNT;
189
219
  this.rejoinAttempts = RECONNECTION.STATE.DEFAULT_TRY_COUNT;
@@ -194,18 +224,28 @@ export default class ReconnectionManager {
194
224
  * @public
195
225
  * @memberof ReconnectionManager
196
226
  */
197
- cleanUp() {
227
+ public cleanUp() {
198
228
  this.reset();
199
229
  this.meeting = null;
200
230
  }
201
231
 
232
+
233
+ /**
234
+ * @public
235
+ * @memberof ReconnectionManager
236
+ * @returns {Boolean} true if reconnection operation is in progress
237
+ */
238
+ isReconnectInProgress() {
239
+ return (this.status === RECONNECTION.STATE.IN_PROGRESS);
240
+ }
241
+
202
242
  /**
203
243
  * @returns {Boolean}
204
244
  * @throws {ReconnectionError}
205
245
  * @private
206
246
  * @memberof ReconnectionManager
207
247
  */
208
- validate() {
248
+ private validate() {
209
249
  if (this.meeting.config.reconnection.enabled) {
210
250
  if (
211
251
  this.status === RECONNECTION.STATE.DEFAULT_STATUS ||
@@ -233,7 +273,13 @@ export default class ReconnectionManager {
233
273
  * @public
234
274
  * @memberof ReconnectionManager
235
275
  */
236
- async reconnect({networkDisconnect = false, networkRetry = false} = {}) {
276
+ public async reconnect({
277
+ networkDisconnect = false,
278
+ networkRetry = false,
279
+ }: {
280
+ networkDisconnect?: boolean;
281
+ networkRetry?: boolean;
282
+ } = {}) {
237
283
  LoggerProxy.logger.info(`ReconnectionManager:index#reconnect --> Reconnection start for meeting ${this.meeting.id}.`);
238
284
  // First, validate that we can reconnect, if not, it will throw an error
239
285
  try {
@@ -315,7 +361,7 @@ export default class ReconnectionManager {
315
361
  * @private
316
362
  * @memberof ReconnectionManager
317
363
  */
318
- async executeReconnection({networkDisconnect = false}) {
364
+ private async executeReconnection({ networkDisconnect = false }: { networkDisconnect?: boolean }) {
319
365
  this.status = RECONNECTION.STATE.IN_PROGRESS;
320
366
 
321
367
  LoggerProxy.logger.info('ReconnectionManager:index#executeReconnection --> Attempting to reconnect to meeting.');
@@ -385,16 +431,13 @@ export default class ReconnectionManager {
385
431
  * @param {boolean} wasSharing
386
432
  * @returns {Promise}
387
433
  */
388
- async rejoinMeeting(wasSharing = false) {
434
+ async rejoinMeeting(wasSharing: boolean = false) {
389
435
  try {
390
436
  LoggerProxy.logger.info('ReconnectionManager:index#rejoinMeeting --> attemping meeting rejoin');
391
- const previousCorrelationId = this.meeting.correlationId;
392
437
 
393
438
  await this.meeting.join({rejoin: true});
394
439
  LoggerProxy.logger.info('ReconnectionManager:index#rejoinMeeting --> meeting rejoined');
395
440
 
396
- RoapCollection.deleteSession(previousCorrelationId);
397
-
398
441
  if (wasSharing) {
399
442
  // Stop the share streams if user tried to rejoin
400
443
  Media.stopTracks(this.meeting.mediaProperties.shareTrack);
@@ -451,28 +494,22 @@ export default class ReconnectionManager {
451
494
  * @private
452
495
  * @memberof ReconnectionManager
453
496
  */
454
- reconnectMedia() {
497
+ async reconnectMedia() {
455
498
  LoggerProxy.logger.log('ReconnectionManager:index#reconnectMedia --> Begin reestablishment of media');
456
499
 
457
- return ReconnectionManager.setupPeerConnection(this.meeting)
458
- .then(() => Media.attachMedia(this.meeting.mediaProperties, {
459
- meetingId: this.meeting.id,
460
- remoteQualityLevel: this.meeting.mediaProperties.remoteQualityLevel,
461
- enableRtx: this.meeting.config.enableRtx,
462
- enableExtmap: this.meeting.config.enableExtmap
463
- }))
464
- .then((peerConnection) => this.meeting.setRemoteStream(peerConnection))
465
- .then(() => {
466
- LoggerProxy.logger.log('ReconnectionManager:index#reconnectMedia --> Sending ROAP media request');
467
-
468
- return this.meeting.roap
469
- .sendRoapMediaRequest({
470
- sdp: this.meeting.mediaProperties.peerConnection.sdp,
471
- roapSeq: this.meeting.roapSeq,
472
- meeting: this.meeting,
473
- reconnect: true
474
- });
475
- });
500
+ // we are not simply calling this.meeting.mediaProperties.webrtcMediaConnection.reconnect(),
501
+ // but instead manually closing and creating new media connection, because we need to do the TURN discovery again
502
+
503
+ await this.meeting.closePeerConnections();
504
+ this.meeting.mediaProperties.unsetPeerConnection();
505
+
506
+ const turnServerResult = await this.meeting.roap.doTurnDiscovery(this.meeting, true);
507
+
508
+ const mc = this.meeting.createMediaConnection(turnServerResult.turnServerInfo);
509
+
510
+ this.meeting.statsAnalyzer.updateMediaConnection(mc);
511
+
512
+ return mc.initiateOffer();
476
513
  }
477
514
 
478
515
  /**
@@ -481,7 +518,7 @@ export default class ReconnectionManager {
481
518
  * @private
482
519
  * @memberof ReconnectionManager
483
520
  */
484
- async reconnectMercuryWebSocket() {
521
+ private async reconnectMercuryWebSocket() {
485
522
  LoggerProxy.logger.info('ReconnectionManager:index#reconnectMercuryWebSocket --> Reconnecting websocket.');
486
523
  // First, attempt to disconnect if we think we are already connected.
487
524
  if (this.webex.internal.mercury.connected) {
@@ -508,25 +545,4 @@ export default class ReconnectionManager {
508
545
  throw (connectError);
509
546
  }
510
547
  }
511
-
512
- /**
513
- * @param {Meeting} meeting
514
- * @returns {undefined}
515
- * @private
516
- * @memberof ReconnectionManager
517
- */
518
- static async setupPeerConnection(meeting) {
519
- LoggerProxy.logger.log('ReconnectionManager:index#setupPeerConnection --> Begin resetting peer connection');
520
- // close pcs, unset to null and create a new one with out closing any streams
521
- PeerConnectionManager.close(meeting.mediaProperties.peerConnection);
522
- meeting.mediaProperties.unsetPeerConnection();
523
-
524
- const turnInfo = await meeting.roap.doTurnDiscovery(meeting, true);
525
-
526
- meeting.mediaProperties.reInitiatePeerconnection(turnInfo);
527
- PeerConnectionManager.setPeerConnectionEvents(meeting);
528
-
529
- // update the peerconnection in the stats manager when ever we reconnect
530
- meeting.statsAnalyzer.updatePeerconnection(meeting.mediaProperties.peerConnection);
531
- }
532
548
  }
@@ -0,0 +1,229 @@
1
+ // @ts-ignore
2
+ import {StatelessWebexPlugin} from '@webex/webex-core';
3
+
4
+ import {ROAP} from '../constants';
5
+ import LoggerProxy from '../common/logs/logger-proxy';
6
+
7
+ import RoapRequest from './request';
8
+ import TurnDiscovery from './turnDiscovery';
9
+ import Meeting from '../meeting';
10
+
11
+ /**
12
+ * Roap options
13
+ * @typedef {Object} RoapOptions
14
+ * @property {String} sdp
15
+ * @property {Meeting} meeting
16
+ * @property {Number} seq
17
+ * @property {Number} tieBreaker
18
+ * @property {Boolean} reconnect
19
+ */
20
+
21
+ /**
22
+ * @typedef {Object} SeqOptions
23
+ * @property {String} correlationId
24
+ * @property {String} mediaId
25
+ * @property {Number} seq
26
+ */
27
+
28
+ /**
29
+ * @class Roap
30
+ * @export
31
+ * @private
32
+ */
33
+ export default class Roap extends StatelessWebexPlugin {
34
+ attrs: any;
35
+ lastRoapOffer: any;
36
+ options: any;
37
+ roapHandler: any;
38
+ roapRequest: any;
39
+ turnDiscovery: any;
40
+
41
+ /**
42
+ *
43
+ * @param {Object} attrs
44
+ * @param {Object} options
45
+ */
46
+ constructor(attrs: any, options: any) {
47
+ super({}, options);
48
+ /**
49
+ * @instance
50
+ * @type {Object}
51
+ * @private
52
+ * @memberof Roap
53
+ */
54
+ this.attrs = attrs;
55
+ /**
56
+ * @instance
57
+ * @type {Object}
58
+ * @private
59
+ * @memberof Roap
60
+ */
61
+ this.options = options;
62
+ /**
63
+ * The Roap Request Server Proxy Object
64
+ * @instance
65
+ * @type {RoapRequest}
66
+ * @private
67
+ * @memberof Roap
68
+ */
69
+ // @ts-ignore
70
+ this.roapRequest = new RoapRequest({}, options);
71
+
72
+ this.turnDiscovery = new TurnDiscovery(this.roapRequest);
73
+ }
74
+
75
+ /**
76
+ *
77
+ * @param {SeqOptions} options
78
+ * @returns {null}
79
+ * @memberof Roap
80
+ */
81
+ public sendRoapOK(options: any) {
82
+ return Promise.resolve().then(() => {
83
+ // @ts-ignore
84
+ const meeting = this.webex.meetings.meetingCollection.getByKey('correlationId', options.correlationId);
85
+ const roapMessage = {
86
+ messageType: ROAP.ROAP_TYPES.OK,
87
+ version: ROAP.ROAP_VERSION,
88
+ seq: options.seq
89
+ };
90
+
91
+ LoggerProxy.logger.log(`Roap:index#sendRoapOK --> ROAP OK sending with seq ${options.seq}`);
92
+
93
+ return this.roapRequest
94
+ .sendRoap({
95
+ roapMessage,
96
+ locusSelfUrl: meeting.selfUrl,
97
+ mediaId: options.mediaId,
98
+ correlationId: options.correlationId,
99
+ audioMuted: meeting.isAudioMuted(),
100
+ videoMuted: meeting.isVideoMuted(),
101
+ meetingId: meeting.id,
102
+ preferTranscoding: !meeting.isMultistream,
103
+ })
104
+ .then(() => {
105
+ LoggerProxy.logger.log(`Roap:index#sendRoapOK --> ROAP OK sent with seq ${options.seq}`);
106
+ });
107
+ });
108
+ }
109
+
110
+ /**
111
+ * Sends a ROAP answer...
112
+ * @param {SeqOptions} options
113
+ * @param {Boolean} options.audioMuted
114
+ * @param {Boolean} options.videoMuted
115
+ * @returns {Promise}
116
+ * @memberof Roap
117
+ */
118
+ public sendRoapAnswer(options: any) {
119
+ // @ts-ignore
120
+ const meeting = this.webex.meetings.meetingCollection.getByKey('correlationId', options.correlationId);
121
+ const roapMessage = {
122
+ messageType: ROAP.ROAP_TYPES.ANSWER,
123
+ sdps: [options.sdp],
124
+ version: ROAP.ROAP_VERSION,
125
+ seq: options.seq
126
+ };
127
+
128
+ return this.roapRequest
129
+ .sendRoap({
130
+ roapMessage,
131
+ locusSelfUrl: meeting.selfUrl,
132
+ mediaId: options.mediaId,
133
+ correlationId: options.correlationId,
134
+ audioMuted: meeting.isAudioMuted(),
135
+ videoMuted: meeting.isVideoMuted(),
136
+ meetingId: meeting.id,
137
+ preferTranscoding: !meeting.isMultistream,
138
+ });
139
+ }
140
+
141
+ /**
142
+ * Sends a ROAP error...
143
+ * @param {Object} options
144
+ * @returns {Promise}
145
+ * @memberof Roap
146
+ */
147
+ sendRoapError(options) {
148
+ // @ts-ignore
149
+ const meeting = this.webex.meetings.meetingCollection.getByKey('correlationId', options.correlationId);
150
+ const roapMessage = {
151
+ messageType: ROAP.ROAP_TYPES.ERROR,
152
+ version: ROAP.ROAP_VERSION,
153
+ errorType: options.errorType,
154
+ seq: options.seq
155
+
156
+ };
157
+
158
+ return this.roapRequest.sendRoap({
159
+ roapMessage,
160
+ locusSelfUrl: meeting.selfUrl,
161
+ mediaId: options.mediaId,
162
+ correlationId: options.correlationId,
163
+ audioMuted: meeting.isAudioMuted(),
164
+ videoMuted: meeting.isVideoMuted(),
165
+ meetingId: meeting.id,
166
+ preferTranscoding: !meeting.isMultistream,
167
+ })
168
+ .then(() => {
169
+ LoggerProxy.logger.log(`Roap:index#sendRoapError --> ROAP ERROR sent with seq ${options.seq}`);
170
+ });
171
+ }
172
+
173
+ /**
174
+ * sends a roap media request
175
+ * @param {RoapOptions} options
176
+ * @returns {Promise}
177
+ * @memberof Roap
178
+ */
179
+ sendRoapMediaRequest(options: any) {
180
+ const {
181
+ meeting, seq, sdp, reconnect, tieBreaker
182
+ } = options;
183
+ const roapMessage = {
184
+ messageType: ROAP.ROAP_TYPES.OFFER,
185
+ sdps: [sdp],
186
+ version: ROAP.ROAP_VERSION,
187
+ seq,
188
+ tieBreaker
189
+ };
190
+
191
+ // When reconnecting, it's important that the first roap message being sent out has empty media id.
192
+ // Normally this is the roap offer, but when TURN discovery is enabled,
193
+ // then this is the TURN discovery request message
194
+ const sendEmptyMediaId = reconnect && !meeting.config.experimental.enableTurnDiscovery;
195
+
196
+ return this.roapRequest
197
+ .sendRoap({
198
+ roapMessage,
199
+ correlationId: meeting.correlationId,
200
+ locusSelfUrl: meeting.selfUrl,
201
+ mediaId: sendEmptyMediaId ? '' : meeting.mediaId,
202
+ audioMuted: meeting.isAudioMuted(),
203
+ videoMuted: meeting.isVideoMuted(),
204
+ meetingId: meeting.id,
205
+ preferTranscoding: !meeting.isMultistream,
206
+ })
207
+ .then(({locus, mediaConnections}) => {
208
+ if (mediaConnections) {
209
+ meeting.updateMediaConnections(mediaConnections);
210
+ }
211
+
212
+ return locus;
213
+ });
214
+ }
215
+
216
+ /**
217
+ * Performs a TURN server discovery procedure, which involves exchanging
218
+ * some roap messages with the server. This exchange has to be done before
219
+ * any other roap messages are sent
220
+ *
221
+ * @param {Meeting} meeting
222
+ * @param {Boolean} isReconnecting should be set to true if this is a new
223
+ * media connection just after a reconnection
224
+ * @returns {Promise}
225
+ */
226
+ doTurnDiscovery(meeting: Meeting, isReconnecting: boolean) {
227
+ return this.turnDiscovery.doTurnDiscovery(meeting, isReconnecting);
228
+ }
229
+ }
@@ -1,19 +1,16 @@
1
-
2
1
  /* global window */
2
+ // @ts-ignore
3
3
  import {StatelessWebexPlugin} from '@webex/webex-core';
4
4
 
5
5
  import LoggerProxy from '../common/logs/logger-proxy';
6
6
  import {
7
- PARTICIPANT,
8
- LOCI,
9
- CALL,
10
7
  MEDIA,
11
8
  HTTP_VERBS,
12
9
  REACHABILITY
13
10
  } from '../constants';
14
11
  import Metrics from '../metrics';
15
12
  import {eventType} from '../metrics/config';
16
- import ParameterError from '../common/errors/parameter';
13
+
17
14
  /**
18
15
  * @class RoapRequest
19
16
  */
@@ -45,74 +42,6 @@ export default class RoapRequest extends StatelessWebexPlugin {
45
42
  return localSdp;
46
43
  }
47
44
 
48
- joinMeetingWithRoap(options) {
49
- LoggerProxy.logger.info('Roap:request#joinMeetingWithRoap --> Join locus with roap');
50
- LoggerProxy.logger.info(`Roap:request#joinMeetingWithRoap --> Local SDP: ${options.roapMessage}`);
51
-
52
- return Promise.resolve().then(async () => {
53
- const deviceUrl = this.webex.internal.device.url;
54
- let url = '';
55
-
56
- const body = {
57
- deviceUrl,
58
- usingResource: options.resourceId || null,
59
- correlationId: options.correlationId,
60
- localMedias: [
61
- {
62
- localSdp: JSON.stringify(this.attachRechabilityData({
63
- roapMessage: options.roapMessage,
64
- audioMuted: false,
65
- videoMuted: false
66
- }))
67
- }
68
- ],
69
- clientMediaPreferences: {
70
- preferTranscoding: options.preferTranscoding ?? true
71
- }
72
- };
73
-
74
- if (options.locusUrl) {
75
- url = `${options.locusUrl}/${PARTICIPANT}`;
76
- }
77
- else if (options.sipUrl) {
78
- try {
79
- await this.webex.internal.services.waitForCatalog('postauth');
80
- url = `${this.webex.internal.services.get('locus')}/${LOCI}/${CALL}`;
81
- body.invitee = {
82
- address: options.sipTarget
83
- };
84
- }
85
- catch (e) {
86
- LoggerProxy.logger.error(`Roap:request#joinMeetingWithRoap --> ${e}`);
87
- throw (e);
88
- }
89
- }
90
- else {
91
- throw new ParameterError('Must provide a locusUrl or sipTarget');
92
- }
93
-
94
- return this.webex
95
- .request({
96
- method: HTTP_VERBS.POST,
97
- uri: url,
98
- body
99
- })
100
- .then((res) => {
101
- const {locus} = res.body;
102
-
103
- locus.roapSeq = options.roapMessage.seq;
104
- locus.id = locus.url.split('/').pop();
105
- LoggerProxy.logger.info(`Roap:request#joinMeetingWithRoap --> Joined locus [${locus.id}][${locus.fullState.lastActive}]`);
106
-
107
- return locus;
108
- })
109
- .catch((err) => {
110
- LoggerProxy.logger.error(`Roap:request#joinMeetingWithRoap --> failed with error: ${err}`);
111
- throw err;
112
- });
113
- });
114
- }
115
-
116
45
  /**
117
46
  * Sends a ROAP message
118
47
  * @param {Object} options
@@ -125,7 +54,16 @@ export default class RoapRequest extends StatelessWebexPlugin {
125
54
  * @param {String} options.meetingId
126
55
  * @returns {Promise} returns the response/failure of the request
127
56
  */
128
- sendRoap(options) {
57
+ sendRoap(options: {
58
+ roapMessage: any;
59
+ locusSelfUrl: string;
60
+ mediaId: string;
61
+ correlationId: string;
62
+ audioMuted: boolean;
63
+ videoMuted: boolean;
64
+ meetingId: string;
65
+ preferTranscoding?: boolean;
66
+ }) {
129
67
  const {
130
68
  roapMessage, locusSelfUrl, mediaId, correlationId, meetingId
131
69
  } = options;
@@ -135,12 +73,14 @@ export default class RoapRequest extends StatelessWebexPlugin {
135
73
  }
136
74
 
137
75
  const mediaUrl = `${locusSelfUrl}/${MEDIA}`;
76
+ // @ts-ignore
138
77
  const deviceUrl = this.webex.internal.device.url;
139
78
 
140
79
  LoggerProxy.logger.info(`Roap:request#sendRoap --> ${mediaUrl} \n ${roapMessage.messageType} \n seq:${roapMessage.seq}`);
141
80
 
142
81
  Metrics.postEvent({event: eventType.MEDIA_REQUEST, meetingId});
143
82
 
83
+ // @ts-ignore
144
84
  return this.webex
145
85
  .request({
146
86
  uri: mediaUrl,
@@ -148,6 +88,7 @@ export default class RoapRequest extends StatelessWebexPlugin {
148
88
  body: {
149
89
  device: {
150
90
  url: deviceUrl,
91
+ // @ts-ignore
151
92
  deviceType: this.config.meetings.deviceType
152
93
  },
153
94
  correlationId,