@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
package/src/roap/index.js DELETED
@@ -1,380 +0,0 @@
1
- import {StatelessWebexPlugin} from '@webex/webex-core';
2
-
3
- import {ROAP} from '../constants';
4
- import LoggerProxy from '../common/logs/logger-proxy';
5
- import MeetingUtil from '../meeting/util';
6
-
7
- import RoapHandler from './handler';
8
- import RoapRequest from './request';
9
- import RoapCollection from './collection';
10
- import TurnDiscovery from './turnDiscovery';
11
-
12
- /**
13
- * Roap options
14
- * @typedef {Object} RoapOptions
15
- * @property {String} sdp
16
- * @property {Meeting} meeting
17
- * @property {Number} roapSeq
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
- /**
35
- *
36
- * @param {Object} attrs
37
- * @param {Object} options
38
- */
39
- constructor(attrs, options) {
40
- super({}, options);
41
- /**
42
- * @instance
43
- * @type {Object}
44
- * @private
45
- * @memberof Roap
46
- */
47
- this.attrs = attrs;
48
- /**
49
- * @instance
50
- * @type {Object}
51
- * @private
52
- * @memberof Roap
53
- */
54
- this.options = options;
55
- /**
56
- * The Roap Process State Handler
57
- * @instance
58
- * @type {RoapHandler}
59
- * @private
60
- * @memberof Roap
61
- */
62
- this.roapHandler = new RoapHandler(this.attrs, this.options, this.sendRoapOK.bind(this), this.sendRoapAnswer.bind(this), this.roapFinished.bind(this));
63
- /**
64
- * The Roap Request Server Proxy Object
65
- * @instance
66
- * @type {RoapRequest}
67
- * @private
68
- * @memberof Roap
69
- */
70
- this.roapRequest = new RoapRequest({}, options);
71
- /**
72
- * The last roap offer sent to server and acked
73
- * @instance
74
- * @type {Object}
75
- * @private
76
- * @memberof Roap
77
- */
78
- this.lastRoapOffer = {};
79
-
80
- this.turnDiscovery = new TurnDiscovery(this.roapRequest);
81
- }
82
-
83
- /**
84
- * Starts listening to mercury events for Roap messages
85
- * @param {object} data event object
86
- * @returns {Promise}
87
- * @private
88
- * @memberof Roap
89
- */
90
- roapEvent(data) {
91
- const msg = data.message;
92
- const {correlationId} = data;
93
-
94
- LoggerProxy.logger.log(`Roap:index#roapEvent --> Received Roap Message [${JSON.stringify(msg, null, 2)}]`);
95
-
96
- if (msg.messageType === ROAP.ROAP_TYPES.TURN_DISCOVERY_RESPONSE) {
97
- // turn discovery is not part of normal roap protocol and so we are not handling it
98
- // through the usual roap state machine
99
- this.turnDiscovery.handleTurnDiscoveryResponse(msg);
100
- }
101
- else {
102
- this.roapHandler.submit({
103
- type: ROAP.RECEIVE_ROAP_MSG,
104
- msg,
105
- correlationId
106
- });
107
- }
108
- }
109
-
110
- /**
111
- *
112
- * @param {String} correlationId correlation id of a meeting
113
- * @param {Number} seq ROAP sequence number
114
- * @returns {Promise}
115
- * @private
116
- * @memberof Roap
117
- */
118
- stop(correlationId, seq) {
119
- this.roapHandler.submit({
120
- type: ROAP.RECEIVE_CALL_LEAVE,
121
- seq,
122
- correlationId
123
- });
124
-
125
- return Promise.resolve();
126
- }
127
-
128
- /**
129
- *
130
- * @param {SeqOptions} options
131
- * @returns {null}
132
- * @private
133
- * @memberof Roap
134
- */
135
- sendRoapOK(options) {
136
- return Promise.resolve().then(() => {
137
- const meeting = this.webex.meetings.meetingCollection.getByKey('correlationId', options.correlationId);
138
- const roapMessage = {
139
- messageType: ROAP.ROAP_TYPES.OK,
140
- version: ROAP.ROAP_VERSION,
141
- seq: options.seq
142
- };
143
-
144
- LoggerProxy.logger.log(`Roap:index#sendRoapOK --> ROAP OK sending with seq ${options.seq}`);
145
-
146
- return this.roapRequest
147
- .sendRoap({
148
- roapMessage,
149
- locusSelfUrl: meeting.selfUrl,
150
- mediaId: options.mediaId,
151
- correlationId: options.correlationId,
152
- audioMuted: meeting.isAudioMuted(),
153
- videoMuted: meeting.isVideoMuted(),
154
- meetingId: meeting.id
155
- })
156
- .then(() => {
157
- this.roapHandler.submit({
158
- type: ROAP.SEND_ROAP_MSG,
159
- msg: roapMessage,
160
- correlationId: options.correlationId
161
- });
162
- LoggerProxy.logger.log(`Roap:index#sendRoapOK --> ROAP OK sent with seq ${options.seq}`);
163
- meeting.setRoapSeq(options.seq);
164
- });
165
- });
166
- }
167
-
168
- // eslint-disable-next-line no-warning-comments
169
- // TODO: try to merge sendRoapOk and roapAnswer
170
- /**
171
- * Sends a ROAP answer...
172
- * @param {SeqOptions} options
173
- * @param {Boolean} options.audioMuted
174
- * @param {Boolean} options.videoMuted
175
- * @returns {Promise}
176
- * @private
177
- * @memberof Roap
178
- */
179
- sendRoapAnswer(options) {
180
- const meeting = this.webex.meetings.meetingCollection.getByKey('correlationId', options.correlationId);
181
- const roapMessage = {
182
- messageType: ROAP.ROAP_TYPES.ANSWER,
183
- sdps: options.sdps,
184
- version: ROAP.ROAP_VERSION,
185
- seq: options.seq
186
- };
187
-
188
- this.roapHandler.submit({
189
- type: ROAP.SEND_ROAP_MSG,
190
- msg: roapMessage,
191
- correlationId: options.correlationId
192
- });
193
-
194
- return this.roapRequest
195
- .sendRoap({
196
- roapMessage,
197
- locusSelfUrl: meeting.selfUrl,
198
- mediaId: options.mediaId,
199
- correlationId: options.correlationId,
200
- audioMuted: options.audioMuted,
201
- videoMuted: options.videoMuted,
202
- meetingId: meeting.id
203
- })
204
- .then(() => {
205
- meeting.setRoapSeq(options.seq);
206
-
207
- this.roapHandler.submit({
208
- type: ROAP.SEND_ROAP_MSG_SUCCESS,
209
- seq: roapMessage.seq,
210
- correlationId: meeting.correlationId
211
- });
212
- });
213
- }
214
-
215
- /**
216
- * Sends a ROAP error...
217
- * @param {Object} session
218
- * @param {Object} locus
219
- * @param {String} errorType
220
- * @returns {Promise}
221
- * @private
222
- * @memberof Roap
223
- */
224
- sendRoapError(session, locus, errorType) {
225
- const msg = {
226
- messageType: ROAP.ROAP_TYPES.ERROR,
227
- version: ROAP.ROAP_VERSION,
228
- errorType,
229
- seq: session.OFFER.seq
230
- };
231
-
232
- return this.roapRequest.sendRoap(msg, locus);
233
- }
234
-
235
- /**
236
- * sends a roap media request
237
- * @param {RoapOptions} options
238
- * @returns {Promise}
239
- * @private
240
- * @memberof Roap
241
- */
242
- sendRoapMediaRequest(options) {
243
- const {meeting, reconnect} = options;
244
- const roapMessage = {
245
- messageType: ROAP.ROAP_TYPES.OFFER,
246
- sdps: [options.sdp],
247
- // sdps: [options.sdp],
248
- version: ROAP.ROAP_VERSION,
249
- seq: typeof options.roapSeq !== 'number' && Number.isNaN(parseFloat(options.roapSeq)) ? 0 : options.roapSeq + 1,
250
- tieBreaker: 4294967294 // Math.floor(Math.random() * (2 ** 32) - 1) // TODO: Handle the roap conflict scenario
251
- };
252
-
253
- this.roapHandler.submit({
254
- type: ROAP.SEND_ROAP_MSG,
255
- msg: roapMessage,
256
- correlationId: meeting.correlationId
257
- });
258
-
259
- // When reconnecting, it's important that the first roap message being sent out has empty media id.
260
- // Normally this is the roap offer, but when TURN discovery is enabled,
261
- // then this is the TURN discovery request message
262
- const sendEmptyMediaId = reconnect && !meeting.config.experimental.enableTurnDiscovery;
263
-
264
- return this.roapRequest
265
- .sendRoap({
266
- roapMessage,
267
- correlationId: meeting.correlationId,
268
- locusSelfUrl: meeting.selfUrl,
269
- mediaId: sendEmptyMediaId ? '' : meeting.mediaId,
270
- audioMuted: meeting.isAudioMuted(),
271
- videoMuted: meeting.isVideoMuted(),
272
- meetingId: meeting.id
273
- })
274
- .then(({locus, mediaConnections}) => {
275
- this.roapHandler.submit({
276
- type: ROAP.SEND_ROAP_MSG_SUCCESS,
277
- seq: roapMessage.seq,
278
- correlationId: meeting.correlationId
279
- });
280
- meeting.setRoapSeq(roapMessage.seq);
281
-
282
- if (mediaConnections) {
283
- meeting.updateMediaConnections(mediaConnections);
284
- }
285
-
286
- // eslint-disable-next-line no-warning-comments
287
- // TODO: we need to attach peerconenction to locus not sure if we need to pass everything here
288
- return locus;
289
- // eslint-disable-next-line no-warning-comments
290
- // TODO: check where to update the sequence number
291
- });
292
- }
293
-
294
- /**
295
- * sends a roap media request
296
- * @param {RoapOptions} options
297
- * @returns {Promise}
298
- * @private
299
- * @memberof Roap
300
- */
301
- sendRoapCallRequest = (options) => {
302
- const {meeting} = options;
303
- const roapMessage = {
304
- messageType: ROAP.ROAP_TYPES.OFFER,
305
- sdps: [options.sdp],
306
- version: ROAP.ROAP_VERSION,
307
- seq: typeof options.roapSeq !== 'number' && Number.isNaN(parseFloat(options.roapSeq)) ? 0 : options.roapSeq + 1,
308
- tieBreaker: 4294967294 // Math.floor(Math.random() * (2 ** 32) - 1) // TODO: Handle the roap conflict scenario
309
- };
310
-
311
- this.roapHandler.submit({
312
- type: ROAP.SEND_ROAP_MSG,
313
- msg: roapMessage,
314
- correlationId: meeting.correlationId
315
- });
316
-
317
- const roapBody = {
318
- localMedias: [
319
- {
320
- localSdp: JSON.stringify(this.roapRequest.attachRechabilityData({
321
- roapMessage,
322
- // eslint-disable-next-line no-warning-comments
323
- // TODO: check whats the need for video and audiomute
324
- audioMuted: !!meeting.isAudioMuted(),
325
- videoMuted: !!meeting.isVideoMuted()
326
- }))
327
- // mediaId: meeting.mediaId
328
- }
329
- ]
330
- };
331
-
332
- return MeetingUtil.joinMeetingOptions(meeting, {roapMessage: roapBody})
333
- .then((locus) => {
334
- this.roapHandler.submit({
335
- type: ROAP.SEND_ROAP_MSG_SUCCESS,
336
- seq: roapMessage.seq,
337
- correlationId: meeting.correlationId
338
- });
339
- meeting.setRoapSeq(roapMessage.seq);
340
-
341
- // eslint-disable-next-line no-warning-comments
342
- // TODO: we need to attach peerconenction to locus not sure if we need to pass everything here
343
- return locus;
344
- // eslint-disable-next-line no-warning-comments
345
- // TODO: check where to update the sequence number
346
- });
347
- };
348
-
349
- /**
350
- * Called when the roap sequence is finished (completed successfully or failed)
351
- * @param {String} correlationId id of the meeting affected
352
- * @param {String} sequenceId the id of the finished sequence
353
- * @returns {undefined}
354
- * @private
355
- * @memberof Roap
356
- */
357
- roapFinished(correlationId, sequenceId) {
358
- RoapCollection.onSessionSequenceFinish(correlationId, sequenceId);
359
- const meeting = this.webex.meetings.meetingCollection.getByKey('correlationId', correlationId);
360
-
361
- meeting.mediaNegotiatedEvent();
362
- if (!RoapCollection.isBusy(correlationId)) {
363
- meeting.processNextQueuedMediaUpdate();
364
- }
365
- }
366
-
367
- /**
368
- * Performs a TURN server discovery procedure, which involves exchanging
369
- * some roap messages with the server. This exchange has to be done before
370
- * any other roap messages are sent
371
- *
372
- * @param {Meeting} meeting
373
- * @param {Boolean} isReconnecting should be set to true if this is a new
374
- * media connection just after a reconnection
375
- * @returns {Promise}
376
- */
377
- doTurnDiscovery(meeting, isReconnecting) {
378
- return this.turnDiscovery.doTurnDiscovery(meeting, isReconnecting);
379
- }
380
- }
package/src/roap/state.js DELETED
@@ -1,149 +0,0 @@
1
- import StateMachine from 'javascript-state-machine';
2
-
3
- import LoggerProxy from '../common/logs/logger-proxy';
4
- import {ROAP, _OFFER_, _ANSWER_, _REQUESTED_} from '../constants';
5
-
6
- const shouldStep = (roap, meeting) => {
7
- const {messageType} = roap.msg;
8
-
9
- if (meeting) {
10
- if (messageType === _OFFER_ && roap.remote && meeting.shareStatus === _REQUESTED_) {
11
- // The peer-connection is waiting for answer but got an offer Reset. Try to
12
- // send the offer later after you accept the answer
13
- return false;
14
- }
15
- // Assuming the mercury event has come first before the response for the event
16
- // we have to wait for the response and trigger the ROAP request later on
17
- if (!meeting.mediaProperties.peerConnection && messageType === _ANSWER_) {
18
- return false;
19
- }
20
- }
21
- LoggerProxy.logger.log('Roap:state#shouldStep --> RoapStateMachine: PeerConnectionState, ', meeting.mediaProperties.peerConnection.signalingState);
22
- LoggerProxy.logger.log('Roap:state#shouldStep --> RoapStateMachine: success save proceeding with transition, ', roap.msg);
23
-
24
- return true;
25
- };
26
-
27
- const handleTransition = (value, signal, meeting) => {
28
- LoggerProxy.logger.log(`Roap:state#handleTransition --> current ${value} to ${signal}`);
29
-
30
- switch (value) {
31
- case ROAP.ROAP_STATE.INIT:
32
- if (signal === ROAP.ROAP_SIGNAL.RX_OFFER) {
33
- return ROAP.ROAP_STATE.WAIT_TX_ANSWER;
34
- }
35
- if (signal === ROAP.ROAP_SIGNAL.TX_OFFER) {
36
- return ROAP.ROAP_STATE.WAIT_RX_ANSWER;
37
- }
38
-
39
- return value;
40
-
41
- case ROAP.ROAP_STATE.WAIT_RX_OFFER:
42
- return value;
43
-
44
- case ROAP.ROAP_STATE.WAIT_RX_ANSWER:
45
- if (signal === ROAP.ROAP_SIGNAL.RX_ANSWER) {
46
- // There is a race condition where the /call response comes after mercury event from the server
47
- // As mercury sends roap event if it didnt get back a response. We can send the roap ok after that
48
- if (meeting.mediaId) {
49
- return ROAP.ROAP_STATE.WAIT_TX_OK;
50
- }
51
- LoggerProxy.logger.error('Roap:state#handleTransition --> Race Condition no mediaId, continuing.');
52
-
53
- return value;
54
- }
55
-
56
- if (signal === ROAP.ROAP_SIGNAL.RX_OFFER) {
57
- return ROAP.ROAP_STATE.GLARE;
58
- }
59
-
60
- return value;
61
-
62
- case ROAP.ROAP_STATE.WAIT_TX_OFFER:
63
- return value;
64
-
65
- case ROAP.ROAP_STATE.WAIT_TX_ANSWER:
66
- if (signal === ROAP.ROAP_SIGNAL.TX_ANSWER) {
67
- return ROAP.ROAP_STATE.WAIT_RX_OK;
68
- }
69
-
70
- return value;
71
-
72
- case ROAP.ROAP_STATE.WAIT_TX_OK:
73
- if (signal === ROAP.ROAP_SIGNAL.TX_OK) {
74
- return ROAP.ROAP_STATE.INIT;
75
- }
76
-
77
- return value;
78
-
79
- case ROAP.ROAP_STATE.WAIT_RX_OK:
80
- if (signal === ROAP.ROAP_SIGNAL.RX_OK) {
81
- return ROAP.ROAP_STATE.INIT;
82
- }
83
-
84
- return value;
85
-
86
- case ROAP.ROAP_STATE.ERROR:
87
- // eslint-disable-next-line no-warning-comments
88
- // TODO: resolve error state. Add a signal constant and handle the cleanup
89
- return ROAP.ROAP_STATE.INIT;
90
-
91
- case ROAP.ROAP_STATE.GLARE:
92
- return ROAP.ROAP_STATE.WAIT_RX_ANSWER;
93
- default:
94
- return value;
95
- }
96
- };
97
-
98
- const RoapStateMachine = {
99
- /**
100
- * @param {Roap} roapRef
101
- * initializes the state machine
102
- * @returns {StateMachine} an instance of a state machine
103
- */
104
- createState() {
105
- const RoapState = StateMachine.factory({
106
- init: ROAP.ROAP_STATE.INIT,
107
- transitions: [
108
- {
109
- name: ROAP.ROAP_TRANSITIONS.STEP,
110
- from: '*',
111
- /**
112
- * Method to handle the transitions between states
113
- * @param {String} signal
114
- * @param {Meeting} meeting instance of a Meeting
115
- * @param {Object} roap
116
- * @returns {String} new state value
117
- */
118
- to(signal, meeting, roap) {
119
- const value = this.state;
120
-
121
- if (!shouldStep(roap, meeting)) {
122
- return value;
123
- }
124
-
125
- return handleTransition(value, signal, meeting);
126
- }
127
- }
128
- ],
129
- methods: {
130
- /**
131
- * Event that fires after we've transitioned to a new state
132
- * @param {Object} transition
133
- * @returns {null}
134
- */
135
- onAfterStep(transition) {
136
- LoggerProxy.logger.log(
137
- `Roap:state#onAfterStep --> RoapStateMachine->onAfterStep#fired! State changed from '${transition.from}' to '${
138
- transition.to
139
- }' with transition '${transition.transition}''.`
140
- );
141
- }
142
- }
143
- });
144
-
145
- return new RoapState();
146
- }
147
- };
148
-
149
- export default RoapStateMachine;
package/src/roap/util.js DELETED
@@ -1,93 +0,0 @@
1
-
2
- import PeerConnectionManager from '../peer-connection-manager';
3
- import {
4
- _ANSWER_,
5
- _ERROR_,
6
- _CONFLICT_,
7
- ROAP,
8
- SDP
9
- } from '../constants';
10
- import LoggerProxy from '../common/logs/logger-proxy';
11
- import ParameterError from '../common/errors/parameter';
12
-
13
- const RoapUtil = {};
14
- const ROAP_ANSWER = _ANSWER_.toLowerCase();
15
-
16
- RoapUtil.shouldHandleMedia = (meeting) => {
17
- const offer =
18
- meeting.mediaProperties.peerConnection &&
19
- meeting.mediaProperties.peerConnection.signalingState === SDP.HAVE_LOCAL_OFFER;
20
-
21
- if (offer) {
22
- return false;
23
- }
24
-
25
- return true;
26
- };
27
-
28
- RoapUtil.handleError = (pc) =>
29
- PeerConnectionManager.rollBackLocalDescription({peerConnection: pc})
30
- .then(() => Promise.resolve(true))
31
- .catch((err) => {
32
- LoggerProxy.logger.error(`Roap:util#handleError --> ${err}`);
33
-
34
- return Promise.reject(err);
35
- });
36
-
37
- RoapUtil.findError = (messageType, errorType, type) =>
38
- (type === ROAP.RECEIVE_ROAP_MSG || type === ROAP.SEND_ROAP_MSG) && messageType === _ERROR_ && errorType === _CONFLICT_;
39
-
40
- RoapUtil.ensureMeeting = (meeting, type) => {
41
- if (type === ROAP.RECEIVE_ROAP_MSG || type === ROAP.SEND_ROAP_MSG || type === ROAP.SEND_ROAP_MSG_SUCCESS) {
42
- if (!meeting) {
43
- return false;
44
- }
45
- }
46
-
47
- return true;
48
- };
49
-
50
- RoapUtil.updatePeerConnection = (meeting, session) => PeerConnectionManager.updatePeerConnection({
51
- offerSdp: session.OFFER.sdps,
52
- peerConnection: meeting.mediaProperties.peerConnection
53
- },
54
- {
55
- meetingId: meeting.id,
56
- remoteQualityLevel: meeting.mediaProperties.remoteQualityLevel
57
- })
58
- .then((res) => {
59
- meeting.roap.lastRoapOffer = session.OFFER.sdps;
60
-
61
- return res;
62
- });
63
-
64
-
65
- RoapUtil.setRemoteDescription = (meeting, session) => {
66
- LoggerProxy.logger.info(`Roap:util#setRemoteDescription --> Transmit WAIT_TX_OK, correlationId: ${meeting.correlationId}`);
67
- if (!(meeting && (meeting.mediaProperties.peerConnection))) {
68
- LoggerProxy.logger.error(`Roap:util#setRemoteDescription --> DANGER no media or screen peer connection, correlationId: ${meeting.correlationId}`);
69
-
70
- return Promise.reject(new ParameterError('Must provide a media or screen peer connection'));
71
- }
72
-
73
- return PeerConnectionManager.setRemoteSessionDetails(
74
- meeting.mediaProperties.peerConnection,
75
- ROAP_ANSWER,
76
- session.ANSWER.sdps[0],
77
- meeting.id
78
- ).then(() => {
79
- LoggerProxy.logger.info(`Roap:util#setRemoteDescription --> Success for correlationId: ${meeting.correlationId}`);
80
-
81
- return {
82
- seq: session.ANSWER.seq,
83
- mediaId: meeting.mediaId,
84
- correlationId: meeting.correlationId
85
- };
86
- })
87
- .catch((err) => {
88
- LoggerProxy.logger.error(`Roap:util#setRemoteDescription --> ${err}`);
89
- throw err;
90
- });
91
- };
92
-
93
- export default RoapUtil;