@webex/plugin-meetings 3.8.1 → 3.9.0-webinar5k.1

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 (296) hide show
  1. package/README.md +26 -13
  2. package/dist/breakouts/breakout.js +1 -1
  3. package/dist/breakouts/index.js +1 -1
  4. package/dist/constants.js +16 -3
  5. package/dist/constants.js.map +1 -1
  6. package/dist/controls-options-manager/enums.js +1 -0
  7. package/dist/controls-options-manager/enums.js.map +1 -1
  8. package/dist/controls-options-manager/types.js.map +1 -1
  9. package/dist/controls-options-manager/util.js +26 -0
  10. package/dist/controls-options-manager/util.js.map +1 -1
  11. package/dist/hashTree/constants.js +23 -0
  12. package/dist/hashTree/constants.js.map +1 -0
  13. package/dist/hashTree/hashTree.js +516 -0
  14. package/dist/hashTree/hashTree.js.map +1 -0
  15. package/dist/hashTree/hashTreeParser.js +521 -0
  16. package/dist/hashTree/hashTreeParser.js.map +1 -0
  17. package/dist/interpretation/index.js +1 -1
  18. package/dist/interpretation/siLanguage.js +1 -1
  19. package/dist/locus-info/controlsUtils.js +11 -3
  20. package/dist/locus-info/controlsUtils.js.map +1 -1
  21. package/dist/locus-info/index.js +331 -59
  22. package/dist/locus-info/index.js.map +1 -1
  23. package/dist/media/index.js +2 -2
  24. package/dist/media/index.js.map +1 -1
  25. package/dist/meeting/brbState.js +17 -14
  26. package/dist/meeting/brbState.js.map +1 -1
  27. package/dist/meeting/in-meeting-actions.js +5 -1
  28. package/dist/meeting/in-meeting-actions.js.map +1 -1
  29. package/dist/meeting/index.js +264 -125
  30. package/dist/meeting/index.js.map +1 -1
  31. package/dist/meeting/muteState.js +2 -5
  32. package/dist/meeting/muteState.js.map +1 -1
  33. package/dist/meeting/request.js +19 -0
  34. package/dist/meeting/request.js.map +1 -1
  35. package/dist/meeting/request.type.js.map +1 -1
  36. package/dist/meeting/util.js +8 -11
  37. package/dist/meeting/util.js.map +1 -1
  38. package/dist/meetings/index.js +6 -2
  39. package/dist/meetings/index.js.map +1 -1
  40. package/dist/member/types.js.map +1 -1
  41. package/dist/members/collection.js +13 -0
  42. package/dist/members/collection.js.map +1 -1
  43. package/dist/members/index.js +44 -23
  44. package/dist/members/index.js.map +1 -1
  45. package/dist/members/request.js +3 -3
  46. package/dist/members/request.js.map +1 -1
  47. package/dist/members/util.js +18 -6
  48. package/dist/members/util.js.map +1 -1
  49. package/dist/metrics/constants.js +1 -0
  50. package/dist/metrics/constants.js.map +1 -1
  51. package/dist/multistream/sendSlotManager.js +32 -2
  52. package/dist/multistream/sendSlotManager.js.map +1 -1
  53. package/dist/reachability/index.js +5 -10
  54. package/dist/reachability/index.js.map +1 -1
  55. package/dist/types/constants.d.ts +12 -0
  56. package/dist/types/controls-options-manager/enums.d.ts +2 -1
  57. package/dist/types/controls-options-manager/types.d.ts +4 -1
  58. package/dist/types/hashTree/constants.d.ts +8 -0
  59. package/dist/types/hashTree/hashTree.d.ts +128 -0
  60. package/dist/types/hashTree/hashTreeParser.d.ts +152 -0
  61. package/dist/types/locus-info/index.d.ts +93 -3
  62. package/dist/types/meeting/brbState.d.ts +0 -1
  63. package/dist/types/meeting/in-meeting-actions.d.ts +4 -0
  64. package/dist/types/meeting/index.d.ts +36 -3
  65. package/dist/types/meeting/request.d.ts +9 -1
  66. package/dist/types/meeting/request.type.d.ts +74 -0
  67. package/dist/types/meeting/util.d.ts +3 -3
  68. package/dist/types/member/types.d.ts +1 -0
  69. package/dist/types/members/collection.d.ts +6 -0
  70. package/dist/types/members/index.d.ts +15 -3
  71. package/dist/types/members/request.d.ts +1 -1
  72. package/dist/types/members/util.d.ts +5 -2
  73. package/dist/types/metrics/constants.d.ts +1 -0
  74. package/dist/types/multistream/sendSlotManager.d.ts +16 -0
  75. package/dist/types/reachability/index.d.ts +2 -2
  76. package/dist/webinar/index.js +1 -1
  77. package/package.json +26 -25
  78. package/src/constants.ts +16 -0
  79. package/src/controls-options-manager/enums.ts +1 -0
  80. package/src/controls-options-manager/types.ts +6 -1
  81. package/src/controls-options-manager/util.ts +31 -0
  82. package/src/hashTree/constants.ts +12 -0
  83. package/src/hashTree/hashTree.ts +460 -0
  84. package/src/hashTree/hashTreeParser.ts +556 -0
  85. package/src/locus-info/controlsUtils.ts +15 -0
  86. package/src/locus-info/index.ts +434 -58
  87. package/src/media/index.ts +2 -2
  88. package/src/meeting/brbState.ts +13 -9
  89. package/src/meeting/in-meeting-actions.ts +8 -0
  90. package/src/meeting/index.ts +193 -39
  91. package/src/meeting/muteState.ts +2 -6
  92. package/src/meeting/request.ts +16 -0
  93. package/src/meeting/request.type.ts +64 -0
  94. package/src/meeting/util.ts +17 -20
  95. package/src/meetings/index.ts +17 -3
  96. package/src/member/types.ts +1 -0
  97. package/src/members/collection.ts +11 -0
  98. package/src/members/index.ts +33 -7
  99. package/src/members/request.ts +2 -2
  100. package/src/members/util.ts +14 -3
  101. package/src/metrics/constants.ts +1 -0
  102. package/src/multistream/sendSlotManager.ts +34 -2
  103. package/src/reachability/index.ts +5 -13
  104. package/test/unit/spec/controls-options-manager/util.js +58 -0
  105. package/test/unit/spec/hashTree/hashTree.ts +394 -0
  106. package/test/unit/spec/hashTree/hashTreeParser.ts +156 -0
  107. package/test/unit/spec/locus-info/controlsUtils.js +52 -0
  108. package/test/unit/spec/locus-info/index.js +547 -54
  109. package/test/unit/spec/media/index.ts +107 -0
  110. package/test/unit/spec/meeting/brbState.ts +23 -4
  111. package/test/unit/spec/meeting/in-meeting-actions.ts +4 -0
  112. package/test/unit/spec/meeting/index.js +647 -46
  113. package/test/unit/spec/meeting/request.js +71 -0
  114. package/test/unit/spec/members/index.js +33 -10
  115. package/test/unit/spec/members/request.js +2 -2
  116. package/test/unit/spec/members/utils.js +27 -7
  117. package/test/unit/spec/multistream/sendSlotManager.ts +59 -0
  118. package/test/unit/spec/reachability/index.ts +2 -6
  119. package/dist/annotation/annotation.types.d.ts +0 -42
  120. package/dist/annotation/constants.d.ts +0 -31
  121. package/dist/annotation/index.d.ts +0 -117
  122. package/dist/breakouts/breakout.d.ts +0 -8
  123. package/dist/breakouts/collection.d.ts +0 -5
  124. package/dist/breakouts/edit-lock-error.d.ts +0 -15
  125. package/dist/breakouts/events.d.ts +0 -8
  126. package/dist/breakouts/index.d.ts +0 -5
  127. package/dist/breakouts/request.d.ts +0 -22
  128. package/dist/breakouts/utils.d.ts +0 -15
  129. package/dist/common/browser-detection.d.ts +0 -9
  130. package/dist/common/collection.d.ts +0 -48
  131. package/dist/common/config.d.ts +0 -2
  132. package/dist/common/errors/captcha-error.d.ts +0 -15
  133. package/dist/common/errors/intent-to-join.d.ts +0 -16
  134. package/dist/common/errors/join-meeting.d.ts +0 -17
  135. package/dist/common/errors/media.d.ts +0 -15
  136. package/dist/common/errors/no-meeting-info.d.ts +0 -14
  137. package/dist/common/errors/parameter.d.ts +0 -15
  138. package/dist/common/errors/password-error.d.ts +0 -15
  139. package/dist/common/errors/permission.d.ts +0 -14
  140. package/dist/common/errors/reclaim-host-role-error.d.ts +0 -60
  141. package/dist/common/errors/reclaim-host-role-error.js +0 -158
  142. package/dist/common/errors/reclaim-host-role-error.js.map +0 -1
  143. package/dist/common/errors/reclaim-host-role-errors.d.ts +0 -60
  144. package/dist/common/errors/reconnection-in-progress.d.ts +0 -9
  145. package/dist/common/errors/reconnection-in-progress.js +0 -35
  146. package/dist/common/errors/reconnection-in-progress.js.map +0 -1
  147. package/dist/common/errors/reconnection.d.ts +0 -15
  148. package/dist/common/errors/stats.d.ts +0 -15
  149. package/dist/common/errors/webex-errors.d.ts +0 -81
  150. package/dist/common/errors/webex-meetings-error.d.ts +0 -20
  151. package/dist/common/events/events-scope.d.ts +0 -17
  152. package/dist/common/events/events.d.ts +0 -12
  153. package/dist/common/events/trigger-proxy.d.ts +0 -2
  154. package/dist/common/events/util.d.ts +0 -2
  155. package/dist/common/logs/logger-config.d.ts +0 -2
  156. package/dist/common/logs/logger-proxy.d.ts +0 -2
  157. package/dist/common/logs/request.d.ts +0 -34
  158. package/dist/common/queue.d.ts +0 -32
  159. package/dist/config.d.ts +0 -73
  160. package/dist/constants.d.ts +0 -952
  161. package/dist/controls-options-manager/constants.d.ts +0 -4
  162. package/dist/controls-options-manager/enums.d.ts +0 -5
  163. package/dist/controls-options-manager/index.d.ts +0 -120
  164. package/dist/controls-options-manager/types.d.ts +0 -43
  165. package/dist/controls-options-manager/util.d.ts +0 -7
  166. package/dist/index.d.ts +0 -4
  167. package/dist/interceptors/index.d.ts +0 -2
  168. package/dist/interceptors/locusRetry.d.ts +0 -27
  169. package/dist/interpretation/collection.d.ts +0 -5
  170. package/dist/interpretation/index.d.ts +0 -5
  171. package/dist/interpretation/siLanguage.d.ts +0 -5
  172. package/dist/locus-info/controlsUtils.d.ts +0 -2
  173. package/dist/locus-info/embeddedAppsUtils.d.ts +0 -2
  174. package/dist/locus-info/fullState.d.ts +0 -2
  175. package/dist/locus-info/hostUtils.d.ts +0 -2
  176. package/dist/locus-info/index.d.ts +0 -269
  177. package/dist/locus-info/infoUtils.d.ts +0 -2
  178. package/dist/locus-info/mediaSharesUtils.d.ts +0 -2
  179. package/dist/locus-info/parser.d.ts +0 -212
  180. package/dist/locus-info/selfUtils.d.ts +0 -2
  181. package/dist/media/index.d.ts +0 -32
  182. package/dist/media/properties.d.ts +0 -108
  183. package/dist/media/util.d.ts +0 -2
  184. package/dist/mediaQualityMetrics/config.d.ts +0 -233
  185. package/dist/mediaQualityMetrics/config.js +0 -513
  186. package/dist/mediaQualityMetrics/config.js.map +0 -1
  187. package/dist/meeting/effectsState.d.ts +0 -42
  188. package/dist/meeting/effectsState.js +0 -260
  189. package/dist/meeting/effectsState.js.map +0 -1
  190. package/dist/meeting/in-meeting-actions.d.ts +0 -79
  191. package/dist/meeting/index.d.ts +0 -1622
  192. package/dist/meeting/locusMediaRequest.d.ts +0 -74
  193. package/dist/meeting/muteState.d.ts +0 -116
  194. package/dist/meeting/request.d.ts +0 -257
  195. package/dist/meeting/request.type.d.ts +0 -11
  196. package/dist/meeting/state.d.ts +0 -9
  197. package/dist/meeting/util.d.ts +0 -2
  198. package/dist/meeting/voicea-meeting.d.ts +0 -16
  199. package/dist/meeting-info/collection.d.ts +0 -20
  200. package/dist/meeting-info/index.d.ts +0 -57
  201. package/dist/meeting-info/meeting-info-v2.d.ts +0 -93
  202. package/dist/meeting-info/request.d.ts +0 -22
  203. package/dist/meeting-info/util.d.ts +0 -2
  204. package/dist/meeting-info/utilv2.d.ts +0 -2
  205. package/dist/meetings/collection.d.ts +0 -23
  206. package/dist/meetings/index.d.ts +0 -296
  207. package/dist/meetings/meetings.types.d.ts +0 -4
  208. package/dist/meetings/request.d.ts +0 -27
  209. package/dist/meetings/util.d.ts +0 -18
  210. package/dist/member/index.d.ts +0 -148
  211. package/dist/member/member.types.d.ts +0 -11
  212. package/dist/member/member.types.js +0 -18
  213. package/dist/member/member.types.js.map +0 -1
  214. package/dist/member/types.d.ts +0 -32
  215. package/dist/member/util.d.ts +0 -2
  216. package/dist/members/collection.d.ts +0 -24
  217. package/dist/members/index.d.ts +0 -308
  218. package/dist/members/request.d.ts +0 -58
  219. package/dist/members/types.d.ts +0 -25
  220. package/dist/members/util.d.ts +0 -2
  221. package/dist/metrics/config.d.ts +0 -169
  222. package/dist/metrics/config.js +0 -289
  223. package/dist/metrics/config.js.map +0 -1
  224. package/dist/metrics/constants.d.ts +0 -59
  225. package/dist/metrics/index.d.ts +0 -152
  226. package/dist/multistream/mediaRequestManager.d.ts +0 -119
  227. package/dist/multistream/receiveSlot.d.ts +0 -68
  228. package/dist/multistream/receiveSlotManager.d.ts +0 -56
  229. package/dist/multistream/remoteMedia.d.ts +0 -72
  230. package/dist/multistream/remoteMediaGroup.d.ts +0 -49
  231. package/dist/multistream/remoteMediaManager.d.ts +0 -300
  232. package/dist/multistream/sendSlotManager.d.ts +0 -69
  233. package/dist/networkQualityMonitor/index.d.ts +0 -70
  234. package/dist/networkQualityMonitor/index.js +0 -226
  235. package/dist/networkQualityMonitor/index.js.map +0 -1
  236. package/dist/peer-connection-manager/index.d.ts +0 -6
  237. package/dist/peer-connection-manager/index.js +0 -671
  238. package/dist/peer-connection-manager/index.js.map +0 -1
  239. package/dist/peer-connection-manager/util.d.ts +0 -6
  240. package/dist/peer-connection-manager/util.js +0 -110
  241. package/dist/peer-connection-manager/util.js.map +0 -1
  242. package/dist/personal-meeting-room/index.d.ts +0 -47
  243. package/dist/personal-meeting-room/request.d.ts +0 -14
  244. package/dist/personal-meeting-room/util.d.ts +0 -2
  245. package/dist/reachability/clusterReachability.d.ts +0 -109
  246. package/dist/reachability/index.d.ts +0 -139
  247. package/dist/reachability/request.d.ts +0 -35
  248. package/dist/reachability/util.d.ts +0 -8
  249. package/dist/reactions/constants.d.ts +0 -3
  250. package/dist/reactions/reactions.d.ts +0 -4
  251. package/dist/reactions/reactions.type.d.ts +0 -32
  252. package/dist/reconnection-manager/index.d.ts +0 -112
  253. package/dist/recording-controller/enums.d.ts +0 -7
  254. package/dist/recording-controller/index.d.ts +0 -193
  255. package/dist/recording-controller/util.d.ts +0 -13
  256. package/dist/roap/collection.d.ts +0 -10
  257. package/dist/roap/collection.js +0 -63
  258. package/dist/roap/collection.js.map +0 -1
  259. package/dist/roap/handler.d.ts +0 -47
  260. package/dist/roap/handler.js +0 -279
  261. package/dist/roap/handler.js.map +0 -1
  262. package/dist/roap/index.d.ts +0 -116
  263. package/dist/roap/request.d.ts +0 -35
  264. package/dist/roap/state.d.ts +0 -9
  265. package/dist/roap/state.js +0 -127
  266. package/dist/roap/state.js.map +0 -1
  267. package/dist/roap/turnDiscovery.d.ts +0 -81
  268. package/dist/roap/util.d.ts +0 -2
  269. package/dist/roap/util.js +0 -76
  270. package/dist/roap/util.js.map +0 -1
  271. package/dist/rtcMetrics/constants.d.ts +0 -4
  272. package/dist/rtcMetrics/constants.js +0 -11
  273. package/dist/rtcMetrics/constants.js.map +0 -1
  274. package/dist/rtcMetrics/index.d.ts +0 -61
  275. package/dist/rtcMetrics/index.js +0 -197
  276. package/dist/rtcMetrics/index.js.map +0 -1
  277. package/dist/statsAnalyzer/global.d.ts +0 -118
  278. package/dist/statsAnalyzer/global.js +0 -127
  279. package/dist/statsAnalyzer/global.js.map +0 -1
  280. package/dist/statsAnalyzer/index.d.ts +0 -193
  281. package/dist/statsAnalyzer/index.js +0 -1019
  282. package/dist/statsAnalyzer/index.js.map +0 -1
  283. package/dist/statsAnalyzer/mqaUtil.d.ts +0 -22
  284. package/dist/statsAnalyzer/mqaUtil.js +0 -181
  285. package/dist/statsAnalyzer/mqaUtil.js.map +0 -1
  286. package/dist/transcription/index.d.ts +0 -64
  287. package/dist/types/common/errors/reconnection-in-progress.d.ts +0 -9
  288. package/dist/types/mediaQualityMetrics/config.d.ts +0 -241
  289. package/dist/types/networkQualityMonitor/index.d.ts +0 -70
  290. package/dist/types/rtcMetrics/constants.d.ts +0 -4
  291. package/dist/types/rtcMetrics/index.d.ts +0 -71
  292. package/dist/types/statsAnalyzer/global.d.ts +0 -36
  293. package/dist/types/statsAnalyzer/index.d.ts +0 -217
  294. package/dist/types/statsAnalyzer/mqaUtil.d.ts +0 -48
  295. package/dist/webinar/collection.d.ts +0 -16
  296. package/dist/webinar/index.d.ts +0 -5
@@ -1 +0,0 @@
1
- {"version":3,"names":["_window","_interopRequireDefault","require","_sdpTransform","_metrics","_loggerProxy","_config","_constants","_constants2","_config2","_media","_parameter","_webexErrors","_browserDetection","_util","_createForOfIteratorHelper","o","allowArrayLike","it","_Symbol","_Symbol$iterator","_Array$isArray","_unsupportedIterableToArray","length","i","F","s","n","done","value","e","_e","f","TypeError","normalCompletion","didErr","err","call","step","next","_e2","return","minLen","_arrayLikeToArray","Object","prototype","toString","slice","constructor","name","_Array$from","test","arr","len","arr2","Array","_BrowserDetection","BrowserDetection","isBrowser","pc","insertBandwidthLimit","sdpLines","index","limit","periodicKeyFrame","search","AUDIO","StaticConfig","meetings","bandwidth","audio","video","SDP","PERIODIC_KEYFRAME","splice","concat","B_LINE","setRemoteVideoConstraints","sdp","level","arguments","undefined","QUALITY_LEVELS","HIGH","maxFs","REMOTE_VIDEO_CONSTRAINTS","MAX_FS","ParameterError","modifiedSdp","PeerConnectionUtils","adjustH264Profile","setStartBitrateOnRemoteSdp","startBitrate","replace","checkH264Support","videoPresent","match","h264Present","isSdpInvalid","parsedSdp","sdpTransform","parse","_iterator","media","_step","_mediaLine$candidates","mediaLine","candidates","LoggerProxy","logger","error","BAD_MEDIA_PORTS","includes","port","icePwd","iceUfrag","limitBandwidth","offerSdp","split","CARRIAGE_RETURN","M_LINE","join","setContentSlides","screenPc","A_CONTENT_SLIDES","iceCandidate","peerConnection","_ref","remoteQualityLevel","_promise","default","resolve","reject","now","_now","doneGatheringIceCandidate","miliseconds","_parseInt2","Math","abs","localDescription","convertCLineToIpv4","invalidSdpPresent","InvalidSdpError","log","iceGatheringState","COMPLETE","onIceGatheringStateChange","GATHERING","onicecandidate","evt","candidate","_evt$candidate","_evt$candidate2","_evt$candidate3","_evt$candidate4","type","protocol","address","onicecandidateerror","event","replaceTrack","track","senders","getSenders","forEach","sender","kind","addStream","stream","tracksPresent","find","getTracks","addTrack","setRemoteSessionDetails","typeStr","remoteSdp","meetingId","signalingState","Metrics","postEvent","eventType","REMOTE_SDP_RECEIVED","data","canProceed","errors","generateErrorPayload","MEDIA_ENGINE","HAVE_LOCAL_OFFER","STABLE","OFFER","enableExtmap","setRemoteDescription","window","RTCSessionDescription","then","catch","metricName","BEHAVIORAL_METRICS","PEERCONNECTION_FAILURE","correlation_id","reason","message","stack","metadata","sendBehavioralMetric","MediaError","createOffer","_ref2","enableRtx","description","setLocalDescription","LOCAL_SDP_GENERATED","INVALID_ICE_CANDIDATE","code","close","rollBackLocalDescription","ROLLBACK","updatePeerConnection","params","_ref3","createAnswer","peerconnection","_ref4","HAVE_REMOTE_OFFER","sdpConstraints","answer","connectionState","PEER_CONNECTION_STATE","CLOSED","setPeerConnectionEvents","meeting","mediaProperties","connectionFailed","reconnectionManager","iceState","reconnect","networkDisconnect","ICE_END","uploadLogs","file","function","CONNECTION_FAILURE","correlationId","locus_id","locusId","oniceconnectionstatechange","info","iceConnectionState","ICE_STATE","CHECKING","ICE_START","COMPLETED","CONNECTED","CONNECTION_SUCCESS","setNetworkStatus","NETWORK_STATUS","iceReconnected","DISCONNECTED","waitForIceReconnect","FAILED","onconnectionstatechange","CONNECTION_STATE","NEW","CONNECTING","_default","exports"],"sources":["index.ts"],"sourcesContent":["// We need to figure out how to pass a webex logger instance to these util files\n\n/* globals RTCSessionDescription */\n\nimport window from 'global/window';\nimport sdpTransform from 'sdp-transform'; // https://github.com/clux/sdp-transform\n\nimport Metrics from '../metrics';\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport StaticConfig from '../common/config';\nimport {\n COMPLETE,\n GATHERING,\n AUDIO,\n SDP,\n ICE_STATE,\n CONNECTION_STATE,\n NETWORK_STATUS,\n PEER_CONNECTION_STATE,\n OFFER,\n QUALITY_LEVELS,\n REMOTE_VIDEO_CONSTRAINTS,\n} from '../constants';\nimport BEHAVIORAL_METRICS from '../metrics/constants';\nimport {error, eventType} from '../metrics/config';\nimport MediaError from '../common/errors/media';\nimport ParameterError from '../common/errors/parameter';\nimport {InvalidSdpError} from '../common/errors/webex-errors';\nimport BrowserDetection from '../common/browser-detection';\n\nimport PeerConnectionUtils from './util';\n\nconst {isBrowser} = BrowserDetection();\n\n/**\n * @export\n * @public\n */\nconst pc: any = {};\n\n/**\n * munges the bandwidth limit into the sdp\n * @param {String} sdpLines\n * @param {Number} index\n * @returns {String}\n */\nconst insertBandwidthLimit = (sdpLines: any, index: number) => {\n // eslint-disable-next-line no-warning-comments\n // TODO convert to sdp parser\n let limit;\n let periodicKeyFrame = '';\n\n if (sdpLines[index].search(AUDIO) !== -1) {\n limit = StaticConfig.meetings.bandwidth.audio;\n } else {\n limit = StaticConfig.meetings.bandwidth.video;\n periodicKeyFrame = SDP.PERIODIC_KEYFRAME;\n sdpLines.splice(index + 2, 0, periodicKeyFrame);\n }\n sdpLines.splice(index + 1, 0, `${SDP.B_LINE}:${limit}`);\n\n return sdpLines;\n};\n\n/**\n * needed for calliope max-fs\n * @param {String} sdp\n * @param {String} [level=QUALITY_LEVELS.HIGH] quality level for max-fs\n * @returns {String}\n */\nconst setRemoteVideoConstraints = (sdp: string, level: string = QUALITY_LEVELS.HIGH) => {\n const maxFs = REMOTE_VIDEO_CONSTRAINTS.MAX_FS[level];\n\n if (!maxFs) {\n throw new ParameterError(\n `setRemoteVideoConstraints: unable to set max framesize, value for level \"${level}\" is not defined`\n );\n }\n\n const modifiedSdp = PeerConnectionUtils.adjustH264Profile(sdp, maxFs);\n\n return modifiedSdp;\n};\n\nconst setStartBitrateOnRemoteSdp = (sdp) => {\n if (StaticConfig.meetings.bandwidth.startBitrate) {\n sdp = sdp.replace(\n /(\\na=fmtp:(\\d+).*profile-level-id=.*)/gi,\n `$1;x-google-start-bitrate=${StaticConfig.meetings.bandwidth.startBitrate}`\n );\n }\n\n return sdp;\n};\n\n/**\n * checks that sdp has h264 codec in it\n * @param {String} sdp\n * @returns {boolean}\n */\nconst checkH264Support = (sdp: string) => {\n // eslint-disable-next-line no-warning-comments\n // TODO convert to sdp parser to read rtp.codec\n const videoPresent = sdp.match(/\\nm=video.*/g);\n const h264Present = sdp.match(/\\na=rtpmap:\\d+\\sH264.*/g);\n\n if (videoPresent) {\n return !!h264Present;\n }\n\n return true;\n};\n\n/**\n * validates the sdp, checks port, candidates, and ice info\n * @param {String} sdp\n * @returns {String}\n */\nconst isSdpInvalid = (sdp: string) => {\n const parsedSdp = sdpTransform.parse(sdp);\n\n for (const mediaLine of parsedSdp.media) {\n if (!mediaLine.candidates || mediaLine.candidates?.length === 0) {\n LoggerProxy.logger.error(\n 'PeerConnectionManager:index#isSdpInvalid --> iceCandidate: Ice candidate never completed'\n );\n\n return 'iceCandidate: Ice gathering never completed';\n }\n\n if (SDP.BAD_MEDIA_PORTS.includes(mediaLine.port)) {\n LoggerProxy.logger.error(\n 'PeerConnectionManager:index#isSdpInvalid --> iceCandidate: Found invalid port number for the ice candidate'\n );\n\n return 'iceCandidate: Found invalid port number for the ice candidate';\n }\n if (!mediaLine.icePwd || !mediaLine.iceUfrag) {\n LoggerProxy.logger.error(\n 'PeerConnectionManager:index#isSdpInvalid --> iceCandidate: ice ufrag and password not found'\n );\n\n return 'iceCandidate: ice ufrag and password not found';\n }\n }\n\n return '';\n};\n\n/**\n * munges the bandwidth into the sdp\n * @param {String} sdp\n * @returns {String}\n */\nconst limitBandwidth = (sdp: string) => {\n // TODO convert to sdp parser\n let offerSdp = sdp;\n let sdpLines = offerSdp.split(SDP.CARRIAGE_RETURN);\n\n for (let i = 0; i < sdpLines.length; i += 1) {\n if (sdpLines[i].search(SDP.M_LINE) !== -1) {\n sdpLines = insertBandwidthLimit(sdpLines, i);\n }\n }\n offerSdp = sdpLines.join(SDP.CARRIAGE_RETURN);\n\n return offerSdp;\n};\n\n/**\n * makes sure the screen pc sdp has content:slides for server\n * @param {RTCPeerConnection} screenPc\n * @returns {RTCPeerConnection}\n */\npc.setContentSlides = (screenPc: any) => {\n if (screenPc && screenPc.sdp) {\n screenPc.sdp += `${SDP.A_CONTENT_SLIDES}${SDP.CARRIAGE_RETURN}`;\n }\n\n return screenPc;\n};\n\n/**\n * handles ice trickling and establishes ICE connection onto peer connection object\n * @param {Object} peerConnection\n * @param {Object} options\n * @param {String} options.remoteQualityLevel\n * @returns {Promise.RTCPeerConnection}\n */\npc.iceCandidate = (\n peerConnection: any,\n {\n remoteQualityLevel,\n }: {\n remoteQualityLevel: string;\n }\n) =>\n new Promise<void>((resolve, reject) => {\n const now = Date.now();\n const doneGatheringIceCandidate = () => {\n // @ts-ignore\n const miliseconds = parseInt(Math.abs(Date.now() - now), 4);\n\n peerConnection.sdp = limitBandwidth(peerConnection.localDescription.sdp);\n peerConnection.sdp = PeerConnectionUtils.convertCLineToIpv4(peerConnection.sdp);\n peerConnection.sdp = setRemoteVideoConstraints(peerConnection.sdp, remoteQualityLevel);\n\n const invalidSdpPresent = isSdpInvalid(peerConnection.sdp);\n\n if (invalidSdpPresent) {\n LoggerProxy.logger.error(\n 'PeerConnectionManager:index#iceCandidate --> SDP not valid after waiting.'\n );\n reject(new InvalidSdpError(invalidSdpPresent));\n }\n LoggerProxy.logger.log(\n `PeerConnectionManager:index#iceCandidate --> Time to gather ice candidate ${miliseconds} miliseconds`\n );\n\n resolve();\n };\n\n // If ice has already been gathered\n if (peerConnection.iceGatheringState === COMPLETE) {\n doneGatheringIceCandidate();\n }\n\n peerConnection.onIceGatheringStateChange = () => {\n if (peerConnection.iceGatheringState === COMPLETE) {\n // @ts-ignore\n doneGatheringIceCandidate(peerConnection);\n }\n if (peerConnection.iceGatheringState === GATHERING) {\n LoggerProxy.logger.log(\n 'PeerConnectionManager:index#onIceGatheringStateChange --> Ice state changed to gathering'\n );\n }\n };\n\n peerConnection.onicecandidate = (evt) => {\n if (evt.candidate === null) {\n // @ts-ignore\n doneGatheringIceCandidate(peerConnection);\n } else {\n LoggerProxy.logger.log(\n `PeerConnectionManager:index#onicecandidate --> Candidate ${evt.candidate?.type} ${evt.candidate?.protocol} ${evt.candidate?.address}:${evt.candidate?.port}`\n );\n }\n };\n\n peerConnection.onicecandidateerror = (event) => {\n // we can often get ICE candidate errors (for example when failing to communicate with a TURN server)\n // they don't mean that the whole ICE connection will fail, so it's OK to ignore them\n LoggerProxy.logger.error(\n 'PeerConnectionManager:index#onicecandidateerror --> ignoring ice error:',\n event\n );\n };\n });\n\n/**\n * swapping tracks\n * @param {Object} peerConnection\n * @param {Object} track\n * @returns {undefined}\n */\npc.replaceTrack = (peerConnection: any, track: any) => {\n try {\n const senders = peerConnection.getSenders();\n\n if (senders.length > 0) {\n senders.forEach((sender) => {\n if (sender.track && sender.track.kind === track.kind) {\n sender.replaceTrack(track);\n }\n });\n }\n } catch (err) {\n LoggerProxy.logger.error(\n `PeerConnectionManager:index#replaceTrack --> Error replacing track, ${err}`\n );\n }\n};\n\n/**\n * adding streams to peerConnection\n * @param {Object} peerConnection\n * @param {Object} stream\n * @returns {undefined}\n */\npc.addStream = (peerConnection: any, stream: any) => {\n try {\n if (stream && !isBrowser('edge')) {\n const tracksPresent =\n peerConnection.getSenders &&\n peerConnection.getSenders().find((sender) => sender.track != null);\n\n if (tracksPresent) {\n stream.getTracks().forEach((track) => {\n pc.replaceTrack(peerConnection, track);\n });\n\n return;\n }\n stream.getTracks().forEach((track) => {\n peerConnection.addTrack(track, stream);\n });\n // // TODO : may come back disable addTracks for chrome they are moving back to addStream\n // // https://bugs.chromium.org/p/chromium/issues/detail?id=764414\n // // https://bugs.chromium.org/p/chromium/issues/detail?id=738918#c7\n // peerConnection.addStream(stream);\n } else if (isBrowser('edge')) {\n peerConnection.addStream(stream);\n }\n } catch (err) {\n LoggerProxy.logger.error(\n `PeerConnectionManager:index#addStream --> Error adding stream, error: ${error}`\n );\n }\n};\n\n/**\n * setting the remote description\n * @param {Object} peerConnection\n * @param {String} typeStr\n * @param {String} remoteSdp\n * @param {String} meetingId\n * @returns {undefined}\n */\npc.setRemoteSessionDetails = (\n peerConnection: any,\n typeStr: string,\n remoteSdp: string,\n meetingId: string\n) => {\n LoggerProxy.logger.log(\n `PeerConnectionManager:index#setRemoteSessionDetails --> Setting the remote description type: ${typeStr}State: ${peerConnection.signalingState}`\n );\n let sdp = remoteSdp;\n\n // making sure that the remoteDescription is only set when there is a answer for offer\n // or there is a offer from the server\n\n if (!sdp) {\n Metrics.postEvent({\n event: eventType.REMOTE_SDP_RECEIVED,\n meetingId,\n data: {\n canProceed: false,\n errors: [\n Metrics.generateErrorPayload(2001, true, error.name.MEDIA_ENGINE, 'missing remoteSdp'),\n ],\n },\n });\n }\n if (\n peerConnection.signalingState === SDP.HAVE_LOCAL_OFFER ||\n (peerConnection.signalingState === SDP.STABLE && typeStr === SDP.OFFER)\n ) {\n sdp = setStartBitrateOnRemoteSdp(sdp);\n\n if (!peerConnection.enableExtmap) {\n sdp = sdp.replace(/\\na=extmap.*/g, '');\n }\n\n // remove any xtls candidates\n sdp = sdp.replace(/^a=candidate:.*xTLS.*\\r\\n/gim, '');\n\n return (\n peerConnection\n .setRemoteDescription(\n new window.RTCSessionDescription({\n type: typeStr,\n sdp,\n })\n )\n .then(() => {\n if (peerConnection.signalingState === SDP.STABLE) {\n Metrics.postEvent({\n event: eventType.REMOTE_SDP_RECEIVED,\n meetingId,\n });\n }\n })\n // eslint-disable-next-line @typescript-eslint/no-shadow\n .catch((error) => {\n LoggerProxy.logger.error(\n `Peer-connection-manager:index#setRemoteDescription --> ${error} missing remotesdp`\n );\n\n const metricName = BEHAVIORAL_METRICS.PEERCONNECTION_FAILURE;\n const data = {\n correlation_id: meetingId,\n reason: error.message,\n stack: error.stack,\n };\n const metadata = {\n type: error.name,\n };\n\n Metrics.sendBehavioralMetric(metricName, data, metadata);\n\n return Metrics.postEvent({\n event: eventType.REMOTE_SDP_RECEIVED,\n meetingId,\n data: {\n canProceed: false,\n errors: [\n Metrics.generateErrorPayload(\n 2001,\n true,\n error.name.MEDIA_ENGINE,\n 'missing remoteSdp'\n ),\n ],\n },\n });\n })\n );\n }\n\n return Promise.reject(new MediaError('PeerConnection in wrong state'));\n};\n\n/**\n * Create offer with a valid parameter\n * @param {Object} peerConnection\n * @param {Object} meetingProperties\n * @param {string} meetingProperties.meetingId\n * @param {string} meetingProperties.remoteQualityLevel LOW|MEDIUM|HIGH\n * @param {string} meetingProperties.enableRtx\n * @param {string} meetingProperties.enableExtmap\n * @returns {RTCPeerConnection}\n */\npc.createOffer = (\n peerConnection: any,\n {\n meetingId,\n remoteQualityLevel,\n enableRtx,\n enableExtmap,\n }: {\n meetingId: string;\n remoteQualityLevel: string;\n enableRtx: string;\n enableExtmap: string;\n }\n) => {\n LoggerProxy.logger.log('PeerConnectionManager:index#createOffer --> creating a new offer');\n\n // saving the extMap State to use in setRemoteDescription\n\n peerConnection.enableExtmap = enableExtmap;\n\n return (\n peerConnection\n .createOffer()\n .then((description) => {\n // bug https://bugs.chromium.org/p/chromium/issues/detail?id=1020642\n // chrome currently generates RTX line irrespective of whether the server side supports it\n // we are removing apt as well because its associated with rtx line\n\n if (!enableRtx) {\n description.sdp = description.sdp.replace(/\\r\\na=rtpmap:\\d+ rtx\\/\\d+/g, '');\n description.sdp = description.sdp.replace(/\\r\\na=fmtp:\\d+ apt=\\d+/g, '');\n }\n\n return peerConnection.setLocalDescription(description);\n })\n .then(() => pc.iceCandidate(peerConnection, {remoteQualityLevel}))\n .then(() => {\n if (!checkH264Support(peerConnection.sdp)) {\n throw new MediaError(\n 'openH264 is downloading please Wait. Upload logs if not working on second try'\n );\n }\n\n if (!enableExtmap) {\n peerConnection.sdp = peerConnection.sdp.replace(/\\na=extmap.*/g, '');\n }\n\n pc.setContentSlides(peerConnection);\n\n Metrics.postEvent({\n event: eventType.LOCAL_SDP_GENERATED,\n meetingId,\n });\n\n return peerConnection;\n })\n // eslint-disable-next-line @typescript-eslint/no-shadow\n .catch((error) => {\n LoggerProxy.logger.error(`Peer-connection-manager:index#createOffer --> ${error}`);\n if (error instanceof InvalidSdpError) {\n Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.INVALID_ICE_CANDIDATE, {\n correlation_id: meetingId,\n code: error.code,\n reason: error.message,\n });\n } else {\n const metricName = BEHAVIORAL_METRICS.PEERCONNECTION_FAILURE;\n const data = {\n correlation_id: meetingId,\n reason: error.message,\n stack: error.stack,\n };\n const metadata = {\n type: error.name,\n };\n\n Metrics.sendBehavioralMetric(metricName, data, metadata);\n }\n\n Metrics.postEvent({\n event: eventType.LOCAL_SDP_GENERATED,\n meetingId,\n data: {\n canProceed: false,\n errors: [\n // @ts-ignore\n Metrics.generateErrorPayload(2001, true, error.name.MEDIA_ENGINE),\n ],\n },\n });\n pc.close(peerConnection);\n throw error;\n })\n );\n};\n\n/**\n * rollBack local description in peerconnection\n * @param {Object} peerConnection\n * @returns {Promise.RTCPeerConnection}\n */\npc.rollBackLocalDescription = (peerConnection: any) =>\n peerConnection\n // @ts-ignore\n .setLocalDescription(new RTCSessionDescription({type: SDP.ROLLBACK}))\n .then(() => peerConnection)\n .catch((err) => {\n LoggerProxy.logger.error(`Peer-connection-manager:index#setLocalDescription --> ${err} `);\n\n // @ts-ignore\n return Promise.error(err);\n });\n\n/**\n * @param {Object} params {\n * @param {Boolean} params.offerToReceiveAudio\n * @param {Boolean} params.offerToReceiveVideo\n * @param {string} params.offerSdp\n * @param {MediaStream} params.stream\n * @param {Object} meetingProperties\n * @param {string} meetingProperties.meetingId\n * @param {string} meetingProperties.remoteQualityLevel LOW|MEDIUM|HIGH\n * @returns {Promise.<Array>} [MediaSDP, ScreenSDP]\n */\npc.updatePeerConnection = (\n params: {\n offerToReceiveAudio: boolean;\n offerToReceiveVideo: boolean;\n offerSdp: string;\n stream: MediaStream;\n peerConnection: any;\n },\n {\n meetingId,\n remoteQualityLevel,\n }: {\n meetingId: string;\n remoteQualityLevel: string;\n }\n) => {\n LoggerProxy.logger.log(\n `PeerConnectionManager:index#updatePeerConnection --> updating the peerConnection with params: ${params}`\n );\n\n const {peerConnection, offerSdp} = params;\n\n return pc\n .createAnswer(\n {\n peerConnection,\n offerSdp: offerSdp[0],\n },\n {meetingId, remoteQualityLevel}\n )\n .then((peerconnection) => {\n // The content slides should also be set when we are sending inactive\n pc.setContentSlides(peerconnection);\n\n return Promise.resolve([peerconnection.sdp]);\n });\n};\n\n/**\n * @param {Object} params\n * @param {Object} params.peerConnection\n * @param {Object} params.sdpConstraints\n * @param {Object} meetingProperties\n * @param {string} meetingProperties.meetingId\n * @param {string} meetingProperties.remoteQualityLevel LOW|MEDIUM|HIGH\n * @returns {RTCPeerConnection} peerConnection\n */\npc.createAnswer = (\n params: {\n peerConnection: any;\n sdpConstraints: object;\n offerSdp: any;\n },\n {\n meetingId,\n remoteQualityLevel,\n }: {\n meetingId: string;\n remoteQualityLevel: string;\n }\n) => {\n const {peerConnection} = params;\n\n // TODO: Some times to many mercury event comes at the same time\n // Need to maintain state of peerconnection\n if (peerConnection.signalingState === SDP.HAVE_REMOTE_OFFER) {\n return Promise.resolve(peerConnection);\n }\n\n return (\n pc\n .setRemoteSessionDetails(peerConnection, OFFER, params.offerSdp, meetingId)\n .then(() => peerConnection.createAnswer(params.sdpConstraints))\n .then((answer) => peerConnection.setLocalDescription(answer))\n .then(() => pc.iceCandidate(peerConnection, {remoteQualityLevel}))\n .then(() => {\n peerConnection.sdp = limitBandwidth(peerConnection.localDescription.sdp);\n peerConnection.sdp = PeerConnectionUtils.convertCLineToIpv4(peerConnection.sdp);\n peerConnection.sdp = setRemoteVideoConstraints(peerConnection.sdp, remoteQualityLevel);\n\n if (!checkH264Support(peerConnection.sdp)) {\n throw new MediaError(\n 'openH264 is downloading please Wait. Upload logs if not working on second try'\n );\n }\n\n return peerConnection;\n })\n // eslint-disable-next-line @typescript-eslint/no-shadow\n .catch((error) => {\n if (error instanceof InvalidSdpError) {\n Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.INVALID_ICE_CANDIDATE, {\n correlation_id: meetingId,\n });\n } else {\n const metricName = BEHAVIORAL_METRICS.PEERCONNECTION_FAILURE;\n const data = {\n correlation_id: meetingId,\n reason: error.message,\n stack: error.stack,\n };\n const metadata = {\n type: error.name,\n };\n\n Metrics.sendBehavioralMetric(metricName, data, metadata);\n }\n\n LoggerProxy.logger.error(\n `PeerConnectionManager:index#setRemoteSessionDetails --> Error creating remote session, error: ${error}`\n );\n })\n );\n};\n\n/**\n * shut down the peer connection\n * @param {Object} peerConnection\n * @returns {undefined}\n */\npc.close = (peerConnection: any) => {\n // peerConnection.close() fails on firefox on network changes and gives a Dom exception\n // To avoid this we have added a try catch block.\n // Please refer to https://bugzilla.mozilla.org/show_bug.cgi?id=1274407 for more information\n LoggerProxy.logger.log(\n 'PeerConnectionManager:index#close --> pc: close() -> attempting to close the peer connection'\n );\n\n if (peerConnection && peerConnection.connectionState === PEER_CONNECTION_STATE.CLOSED) {\n LoggerProxy.logger.log(\n 'PeerConnectionManager:index#close --> pc: close() -> connection already closed'\n );\n\n return Promise.resolve();\n }\n LoggerProxy.logger.log(\n 'PeerConnectionManager:index#close --> pc: close() -> closing the mediaPeerConnection'\n );\n\n return Promise.resolve().then(() => {\n if (peerConnection && peerConnection.close) {\n peerConnection.close();\n }\n });\n};\n\npc.setPeerConnectionEvents = (meeting) => {\n // In case ICE fail\n const {peerConnection} = meeting.mediaProperties;\n\n const connectionFailed = () => {\n if (meeting.reconnectionManager.iceState.resolve) {\n // DISCONNECTED state triggers first then it goes to FAILED STATE\n // sometimes the failed state can happen before 10 seconds (Which is the timer for the reconnect for ice disconnect)\n meeting.reconnectionManager.iceState.resolve();\n }\n\n meeting.reconnect({networkDisconnect: true});\n Metrics.postEvent({\n event: eventType.ICE_END,\n meeting,\n data: {\n canProceed: false,\n errors: [\n // @ts-ignore\n Metrics.generateErrorPayload(2004, false, error.name.MEDIA_ENGINE),\n ],\n },\n });\n\n meeting.uploadLogs({\n file: 'peer-connection-manager/index',\n function: 'connectionFailed',\n });\n\n Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.CONNECTION_FAILURE, {\n correlation_id: meeting.correlationId,\n locus_id: meeting.locusId,\n });\n };\n\n peerConnection.oniceconnectionstatechange = () => {\n LoggerProxy.logger.info(\n 'PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE CHANGE.'\n );\n switch (peerConnection.iceConnectionState) {\n case ICE_STATE.CHECKING:\n LoggerProxy.logger.info(\n 'PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE CHECKING.'\n );\n Metrics.postEvent({event: eventType.ICE_START, meeting});\n break;\n case ICE_STATE.COMPLETED:\n LoggerProxy.logger.info(\n 'PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE COMPLETED.'\n );\n break;\n case ICE_STATE.CONNECTED:\n // Ice connection state goes to connected when both client and server sends STUN packets and\n // Established connected between them. Firefox does not trigger COMPLETED and only trigger CONNECTED\n Metrics.postEvent({event: eventType.ICE_END, meeting});\n Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.CONNECTION_SUCCESS, {\n correlation_id: meeting.correlationId,\n locus_id: meeting.locusId,\n });\n meeting.setNetworkStatus(NETWORK_STATUS.CONNECTED);\n meeting.reconnectionManager.iceReconnected();\n LoggerProxy.logger.info(\n 'PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE CONNECTED.'\n );\n break;\n case ICE_STATE.CLOSED:\n LoggerProxy.logger.info(\n 'PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE CLOSED.'\n );\n break;\n case ICE_STATE.DISCONNECTED:\n meeting.setNetworkStatus(NETWORK_STATUS.DISCONNECTED);\n meeting.reconnectionManager.waitForIceReconnect().catch(() => {\n LoggerProxy.logger.info(\n 'PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE DISCONNECTED. Automatic Reconnection Timed Out.'\n );\n\n connectionFailed();\n });\n LoggerProxy.logger.info(\n 'PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE DISCONNECTED.'\n );\n break;\n case ICE_STATE.FAILED:\n LoggerProxy.logger.info(\n 'PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE FAILED.'\n );\n // notify of ice failure\n // Ice failure is the only indicator currently for identifying the actual connection drop\n // Firefox takes sometime 10-15 seconds to go to failed state\n connectionFailed();\n break;\n default:\n break;\n }\n };\n\n peerConnection.onconnectionstatechange = () => {\n LoggerProxy.logger.info(\n 'PeerConnectionManager:index#setPeerConnectionEvents --> CONNECTION STATE CHANGE.'\n );\n switch (peerConnection.connectionState) {\n case CONNECTION_STATE.NEW:\n LoggerProxy.logger.info(\n 'PeerConnectionManager:index#setPeerConnectionEvents --> CONNECTION STATE NEW.'\n );\n break;\n case CONNECTION_STATE.CONNECTING:\n LoggerProxy.logger.info(\n 'PeerConnectionManager:index#setPeerConnectionEvents --> CONNECTION STATE CONNECTING.'\n );\n break;\n case CONNECTION_STATE.CONNECTED:\n LoggerProxy.logger.info(\n 'PeerConnectionManager:index#setPeerConnectionEvents --> CONNECTION STATE CONNECTED.'\n );\n break;\n case CONNECTION_STATE.CLOSED:\n LoggerProxy.logger.info(\n 'PeerConnectionManager:index#setPeerConnectionEvents --> CONNECTION STATE CLOSED.'\n );\n break;\n case CONNECTION_STATE.DISCONNECTED:\n LoggerProxy.logger.info(\n 'PeerConnectionManager:index#setPeerConnectionEvents --> CONNECTION STATE DISCONNECTED.'\n );\n break;\n case CONNECTION_STATE.FAILED:\n LoggerProxy.logger.info(\n 'PeerConnectionManager:index#setPeerConnectionEvents --> CONNECTION STATE FAILED.'\n );\n // Special case happens only on chrome where there is no ICE FAILED event\n // only CONNECTION FAILED event gets triggered\n\n connectionFailed();\n break;\n default:\n break;\n }\n };\n};\n\nexport default pc;\n"],"mappings":";;;;;;;;;;;;;;;AAIA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,QAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,YAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,OAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AAaA,IAAAM,WAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,UAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,YAAA,GAAAV,OAAA;AACA,IAAAW,iBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AAEA,IAAAY,KAAA,GAAAb,sBAAA,CAAAC,OAAA;AAAyC,SAAAa,2BAAAC,CAAA,EAAAC,cAAA,QAAAC,EAAA,UAAAC,OAAA,oBAAAH,CAAA,CAAAI,gBAAA,KAAAJ,CAAA,qBAAAE,EAAA,QAAAG,cAAA,CAAAL,CAAA,MAAAE,EAAA,GAAAI,2BAAA,CAAAN,CAAA,MAAAC,cAAA,IAAAD,CAAA,WAAAA,CAAA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CACvF;QACD;MACF,KAAKe,2BAAgB,CAACT,SAAS;QAC7BjJ,oBAAW,CAACC,MAAM,CAAC0I,IAAI,CACrB,qFAAqF,CACtF;QACD;MACF,KAAKe,2BAAgB,CAACjC,MAAM;QAC1BzH,oBAAW,CAACC,MAAM,CAAC0I,IAAI,CACrB,kFAAkF,CACnF;QACD;MACF,KAAKe,2BAAgB,CAACJ,YAAY;QAChCtJ,oBAAW,CAACC,MAAM,CAAC0I,IAAI,CACrB,wFAAwF,CACzF;QACD;MACF,KAAKe,2BAAgB,CAACF,MAAM;QAC1BxJ,oBAAW,CAACC,MAAM,CAAC0I,IAAI,CACrB,kFAAkF,CACnF;QACD;QACA;;QAEAd,gBAAgB,EAAE;QAClB;MACF;QACE;IAAM;EAEZ,CAAC;AACH,CAAC;AAAC,IAAAgC,QAAA,GAEa9M,EAAE;AAAA+M,OAAA,CAAAxI,OAAA,GAAAuI,QAAA"}
@@ -1,6 +0,0 @@
1
- interface IPeerConnectionUtils {
2
- convertCLineToIpv4: (sdp: string) => string;
3
- adjustH264Profile: (sdp: string, maxFsValue: number) => string;
4
- }
5
- declare const PeerConnectionUtils: IPeerConnectionUtils;
6
- export default PeerConnectionUtils;
@@ -1,110 +0,0 @@
1
- "use strict";
2
-
3
- var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
- var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
5
- _Object$defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
- var _parseInt2 = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/parse-int"));
10
- var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
11
- var _tsSdp = require("@webex/ts-sdp");
12
- var PeerConnectionUtils = {};
13
-
14
- // max-fs values for all H264 profile levels
15
- var maxFsForProfileLevel = {
16
- 10: 99,
17
- 11: 396,
18
- 12: 396,
19
- 13: 396,
20
- 20: 396,
21
- 21: 792,
22
- 22: 1620,
23
- 30: 1620,
24
- 31: 3600,
25
- 32: 5120,
26
- 40: 8192,
27
- 41: 8192,
28
- 42: 8704,
29
- 50: 22080,
30
- 51: 36864,
31
- 52: 36864,
32
- 60: 139264,
33
- 61: 139264,
34
- 62: 139264
35
- };
36
- var framesPerSecond = 30;
37
-
38
- /**
39
- * Convert C line to IPv4
40
- * @param {string} sdp
41
- * @returns {string}
42
- */
43
- PeerConnectionUtils.convertCLineToIpv4 = function (sdp) {
44
- var replaceSdp = sdp;
45
-
46
- // TODO: remove this once linus supports Ipv6 c line.currently linus rejects SDP with c line having ipv6 candidates we are
47
- // mocking ipv6 to ipv4 candidates
48
- // https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-299232
49
- replaceSdp = replaceSdp.replace(/c=IN IP6 .*/gi, 'c=IN IP4 0.0.0.0');
50
- return replaceSdp;
51
- };
52
-
53
- /**
54
- * estimate profile levels for max-fs & max-mbps values
55
- * @param {string} sdp
56
- * @param {number} maxFsValue
57
- * @returns {string}
58
- */
59
- PeerConnectionUtils.adjustH264Profile = function (sdp, maxFsValue) {
60
- // converting with ts-sdp parser, no munging
61
- var parsedSdp = (0, _tsSdp.parse)(sdp);
62
- parsedSdp.avMedia.forEach(function (media) {
63
- if (media.type === 'video') {
64
- media.codecs.forEach(function (codec) {
65
- var _codec$name;
66
- if (((_codec$name = codec.name) === null || _codec$name === void 0 ? void 0 : _codec$name.toUpperCase()) === 'H264') {
67
- // there should really be just 1 fmtp line, but just in case, we process all of them
68
- codec.fmtParams = codec.fmtParams.map(function (fmtp) {
69
- var parsedRegex = fmtp.match(/(.*)profile-level-id=(\w{4})(\w{2})(.*)/);
70
- if (parsedRegex && parsedRegex.length === 5) {
71
- var stuffBeforeProfileLevelId = parsedRegex[1];
72
- var profile = parsedRegex[2].toLowerCase();
73
- var levelId = (0, _parseInt2.default)(parsedRegex[3], 16);
74
- var stuffAfterProfileLevelId = parsedRegex[4];
75
- if (!maxFsForProfileLevel[levelId]) {
76
- throw new Error("found unsupported h264 profile level id value in the SDP: ".concat(levelId));
77
- }
78
- if (maxFsForProfileLevel[levelId] === maxFsValue) {
79
- // profile level already matches our desired max-fs value, so we don't need to do anything
80
- return fmtp;
81
- }
82
- if (maxFsForProfileLevel[levelId] < maxFsValue) {
83
- // profile level has too low max-fs, so we need to override it (this is upgrading)
84
- return "".concat(fmtp, ";max-fs=").concat(maxFsValue, ";max-mbps=").concat(maxFsValue * framesPerSecond);
85
- }
86
-
87
- // profile level has too high max-fs value, so we need to use a lower level
88
-
89
- // find highest level that has the matching maxFs
90
- var newLevelId = (0, _keys.default)(maxFsForProfileLevel).reverse().find(function (key) {
91
- return maxFsForProfileLevel[key] === maxFsValue;
92
- });
93
- if (newLevelId) {
94
- // Object.keys returns keys as strings, so we need to parse it to an int again and then convert to hex
95
- var newLevelIdHex = (0, _parseInt2.default)(newLevelId, 10).toString(16);
96
- return "".concat(stuffBeforeProfileLevelId, "profile-level-id=").concat(profile).concat(newLevelIdHex, ";max-mbps=").concat(maxFsValue * framesPerSecond).concat(stuffAfterProfileLevelId);
97
- }
98
- throw new Error("unsupported maxFsValue: ".concat(maxFsValue));
99
- }
100
- return fmtp;
101
- });
102
- }
103
- });
104
- }
105
- });
106
- return parsedSdp.toString();
107
- };
108
- var _default = PeerConnectionUtils;
109
- exports.default = _default;
110
- //# sourceMappingURL=util.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_tsSdp","require","PeerConnectionUtils","maxFsForProfileLevel","framesPerSecond","convertCLineToIpv4","sdp","replaceSdp","replace","adjustH264Profile","maxFsValue","parsedSdp","parse","avMedia","forEach","media","type","codecs","codec","_codec$name","name","toUpperCase","fmtParams","map","fmtp","parsedRegex","match","length","stuffBeforeProfileLevelId","profile","toLowerCase","levelId","_parseInt2","default","stuffAfterProfileLevelId","Error","concat","newLevelId","_keys","reverse","find","key","newLevelIdHex","toString","_default","exports"],"sources":["util.ts"],"sourcesContent":["import {parse} from '@webex/ts-sdp';\n\ninterface IPeerConnectionUtils {\n convertCLineToIpv4: (sdp: string) => string;\n adjustH264Profile: (sdp: string, maxFsValue: number) => string;\n}\n\nconst PeerConnectionUtils = {} as IPeerConnectionUtils;\n\n// max-fs values for all H264 profile levels\nconst maxFsForProfileLevel = {\n 10: 99,\n 11: 396,\n 12: 396,\n 13: 396,\n 20: 396,\n 21: 792,\n 22: 1620,\n 30: 1620,\n 31: 3600,\n 32: 5120,\n 40: 8192,\n 41: 8192,\n 42: 8704,\n 50: 22080,\n 51: 36864,\n 52: 36864,\n 60: 139264,\n 61: 139264,\n 62: 139264,\n};\n\nconst framesPerSecond = 30;\n\n/**\n * Convert C line to IPv4\n * @param {string} sdp\n * @returns {string}\n */\nPeerConnectionUtils.convertCLineToIpv4 = (sdp: string) => {\n let replaceSdp = sdp;\n\n // TODO: remove this once linus supports Ipv6 c line.currently linus rejects SDP with c line having ipv6 candidates we are\n // mocking ipv6 to ipv4 candidates\n // https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-299232\n replaceSdp = replaceSdp.replace(/c=IN IP6 .*/gi, 'c=IN IP4 0.0.0.0');\n\n return replaceSdp;\n};\n\n/**\n * estimate profile levels for max-fs & max-mbps values\n * @param {string} sdp\n * @param {number} maxFsValue\n * @returns {string}\n */\nPeerConnectionUtils.adjustH264Profile = (sdp: string, maxFsValue: number) => {\n // converting with ts-sdp parser, no munging\n const parsedSdp = parse(sdp);\n\n parsedSdp.avMedia.forEach((media) => {\n if (media.type === 'video') {\n media.codecs.forEach((codec) => {\n if (codec.name?.toUpperCase() === 'H264') {\n // there should really be just 1 fmtp line, but just in case, we process all of them\n codec.fmtParams = codec.fmtParams.map((fmtp) => {\n const parsedRegex = fmtp.match(/(.*)profile-level-id=(\\w{4})(\\w{2})(.*)/);\n\n if (parsedRegex && parsedRegex.length === 5) {\n const stuffBeforeProfileLevelId = parsedRegex[1];\n const profile = parsedRegex[2].toLowerCase();\n const levelId = parseInt(parsedRegex[3], 16);\n const stuffAfterProfileLevelId = parsedRegex[4];\n\n if (!maxFsForProfileLevel[levelId]) {\n throw new Error(\n `found unsupported h264 profile level id value in the SDP: ${levelId}`\n );\n }\n\n if (maxFsForProfileLevel[levelId] === maxFsValue) {\n // profile level already matches our desired max-fs value, so we don't need to do anything\n return fmtp;\n }\n if (maxFsForProfileLevel[levelId] < maxFsValue) {\n // profile level has too low max-fs, so we need to override it (this is upgrading)\n return `${fmtp};max-fs=${maxFsValue};max-mbps=${maxFsValue * framesPerSecond}`;\n }\n\n // profile level has too high max-fs value, so we need to use a lower level\n\n // find highest level that has the matching maxFs\n const newLevelId = Object.keys(maxFsForProfileLevel)\n .reverse()\n .find((key) => maxFsForProfileLevel[key] === maxFsValue);\n\n if (newLevelId) {\n // Object.keys returns keys as strings, so we need to parse it to an int again and then convert to hex\n const newLevelIdHex = parseInt(newLevelId, 10).toString(16);\n\n return `${stuffBeforeProfileLevelId}profile-level-id=${profile}${newLevelIdHex};max-mbps=${\n maxFsValue * framesPerSecond\n }${stuffAfterProfileLevelId}`;\n }\n\n throw new Error(`unsupported maxFsValue: ${maxFsValue}`);\n }\n\n return fmtp;\n });\n }\n });\n }\n });\n\n return parsedSdp.toString();\n};\n\nexport default PeerConnectionUtils;\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAOA,IAAMC,mBAAmB,GAAG,CAAC,CAAyB;;AAEtD;AACA,IAAMC,oBAAoB,GAAG;EAC3B,EAAE,EAAE,EAAE;EACN,EAAE,EAAE,GAAG;EACP,EAAE,EAAE,GAAG;EACP,EAAE,EAAE,GAAG;EACP,EAAE,EAAE,GAAG;EACP,EAAE,EAAE,GAAG;EACP,EAAE,EAAE,IAAI;EACR,EAAE,EAAE,IAAI;EACR,EAAE,EAAE,IAAI;EACR,EAAE,EAAE,IAAI;EACR,EAAE,EAAE,IAAI;EACR,EAAE,EAAE,IAAI;EACR,EAAE,EAAE,IAAI;EACR,EAAE,EAAE,KAAK;EACT,EAAE,EAAE,KAAK;EACT,EAAE,EAA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AAA,GAEa1C,mBAAmB;AAAA2C,OAAA,CAAAZ,OAAA,GAAAW,QAAA"}
@@ -1,47 +0,0 @@
1
- import { StatelessWebexPlugin } from '@webex/webex-core';
2
- /**
3
- * @class PersonalMeetingRoom
4
- */
5
- export default class PersonalMeetingRoom extends StatelessWebexPlugin {
6
- link: any;
7
- meetingInfo: any;
8
- name: any;
9
- personalMeetingRoomRequest: any;
10
- pmr: any;
11
- sipUri: any;
12
- userId: any;
13
- meetingLink: any;
14
- number: any;
15
- namespace: string;
16
- /**
17
- *
18
- * @param {Object} attrs
19
- * @param {Object} options
20
- */
21
- constructor(attrs: any, options: any);
22
- /**
23
- * claims a pmr and updates the cached PMR values
24
- * @param {String} link
25
- * @param {String} pin
26
- * @param {Boolean} [preferred] defaults to true to set this claimed PMR as the preferred
27
- * @returns {Promise}
28
- * @public
29
- * @memberof PersonalMeetingRoom
30
- */
31
- claim(link: string, pin: string, preferred?: boolean): any;
32
- /**
33
- * @param {Object} body the response body from meeting info request
34
- * @returns {undefined}
35
- * @private
36
- * @memberof PersonalMeetingRoom
37
- */
38
- private set;
39
- /**
40
- * TODO: implement TTL for syncing and caching so to not request again and again
41
- * @param {Object} options
42
- * @returns {Promise}
43
- * @public
44
- * @memberof PersonalMeetingRoom
45
- */
46
- get(): any;
47
- }
@@ -1,14 +0,0 @@
1
- import { StatelessWebexPlugin } from '@webex/webex-core';
2
- /**
3
- * @class MeetingInfoRequest
4
- */
5
- export default class PersonalMeetingRoomRequest extends StatelessWebexPlugin {
6
- namespace: string;
7
- /**
8
- *
9
- * @param {Object} options with format of {userId, passcode, meetingAddress, preferred}
10
- * @returns {Promise} returns a promise that resolves/rejects the result of the request
11
- * @memberof PersonalMeetingRoomRequest
12
- */
13
- claimPmr(options: any): any;
14
- }
@@ -1,2 +0,0 @@
1
- declare const PersonalMeetingRoomUtil: any;
2
- export default PersonalMeetingRoomUtil;
@@ -1,109 +0,0 @@
1
- import { ClusterNode } from './request';
2
- export type TransportResult = {
3
- result: 'reachable' | 'unreachable' | 'untested';
4
- latencyInMilliseconds?: number;
5
- clientMediaIPs?: string[];
6
- };
7
- export type ClusterReachabilityResult = {
8
- udp: TransportResult;
9
- tcp: TransportResult;
10
- xtls: TransportResult;
11
- };
12
- /**
13
- * A class that handles reachability checks for a single cluster.
14
- */
15
- export declare class ClusterReachability {
16
- private numUdpUrls;
17
- private numTcpUrls;
18
- private result;
19
- private pc?;
20
- private defer;
21
- private startTimestamp;
22
- readonly isVideoMesh: boolean;
23
- readonly name: any;
24
- /**
25
- * Constructor for ClusterReachability
26
- * @param {string} name cluster name
27
- * @param {ClusterNode} clusterInfo information about the media cluster
28
- */
29
- constructor(name: string, clusterInfo: ClusterNode);
30
- /**
31
- * Gets total elapsed time, can be called only after start() is called
32
- * @returns {Number} Milliseconds
33
- */
34
- private getElapsedTime;
35
- /**
36
- * Generate peerConnection config settings
37
- * @param {ClusterNode} cluster
38
- * @returns {RTCConfiguration} peerConnectionConfig
39
- */
40
- private buildPeerConnectionConfig;
41
- /**
42
- * Creates an RTCPeerConnection
43
- * @param {ClusterNode} clusterInfo information about the media cluster
44
- * @returns {RTCPeerConnection} peerConnection
45
- */
46
- private createPeerConnection;
47
- /**
48
- * @returns {ClusterReachabilityResult} reachability result for this cluster
49
- */
50
- getResult(): ClusterReachabilityResult;
51
- /**
52
- * Closes the peerConnection
53
- *
54
- * @returns {void}
55
- */
56
- private closePeerConnection;
57
- /**
58
- * Resolves the defer, indicating that reachability checks for this cluster are completed
59
- *
60
- * @returns {void}
61
- */
62
- private finishReachabilityCheck;
63
- /**
64
- * Adds public IP (client media IPs)
65
- * @param {string} protocol
66
- * @param {string} publicIP
67
- * @returns {void}
68
- */
69
- private addPublicIP;
70
- /**
71
- * Registers a listener for the iceGatheringStateChange event
72
- *
73
- * @returns {void}
74
- */
75
- private registerIceGatheringStateChangeListener;
76
- /**
77
- * Checks if we have the results for all the protocols (UDP and TCP)
78
- *
79
- * @returns {boolean} true if we have all results, false otherwise
80
- */
81
- private haveWeGotAllResults;
82
- /**
83
- * Stores the latency in the result for the given protocol and marks it as reachable
84
- *
85
- * @param {string} protocol
86
- * @param {number} latency
87
- * @returns {void}
88
- */
89
- private storeLatencyResult;
90
- /**
91
- * Registers a listener for the icecandidate event
92
- *
93
- * @returns {void}
94
- */
95
- private registerIceCandidateListener;
96
- /**
97
- * Starts the process of doing UDP and TCP reachability checks on the media cluster.
98
- * XTLS reachability checking is not supported.
99
- *
100
- * @returns {Promise}
101
- */
102
- start(): Promise<ClusterReachabilityResult>;
103
- /**
104
- * Starts the process of gathering ICE candidates
105
- *
106
- * @returns {Promise} promise that's resolved once reachability checks for this cluster are completed or timeout is reached
107
- */
108
- private gatherIceCandidates;
109
- }
@@ -1,139 +0,0 @@
1
- /*!
2
- * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
- */
4
- /**
5
- * @class Reachability
6
- * @export
7
- */
8
- export default class Reachability {
9
- webex: object;
10
- reachabilityRequest: any;
11
- clusterLatencyResults: any;
12
- /**
13
- * Creates an instance of Reachability.
14
- * @param {object} webex
15
- * @memberof Reachability
16
- */
17
- constructor(webex: object);
18
- /**
19
- * fetches reachability data
20
- * @returns {Object} reachability data
21
- * @public
22
- * @async
23
- * @memberof Reachability
24
- */
25
- gatherReachability(): Promise<unknown>;
26
- /**
27
- * fetches reachability data and checks for cluster reachability
28
- * @returns {boolean}
29
- * @public
30
- * @memberof Reachability
31
- */
32
- isAnyClusterReachable(): boolean;
33
- /**
34
- * Generate peerConnection config settings
35
- * @param {object} cluster
36
- * @returns {object} peerConnectionConfig
37
- * @private
38
- * @memberof Reachability
39
- */
40
- private buildPeerConnectionConfig;
41
- /**
42
- * Creates an RTCPeerConnection
43
- * @param {object} cluster
44
- * @returns {RTCPeerConnection} peerConnection
45
- * @private
46
- * @memberof Reachability
47
- */
48
- private createPeerConnection;
49
- /**
50
- * Gets total elapsed time
51
- * @param {RTCPeerConnection} peerConnection
52
- * @returns {Number} Milliseconds
53
- * @private
54
- * @memberof Reachability
55
- */
56
- private getElapsedTime;
57
- /**
58
- * creates offer and generates localSDP
59
- * @param {object} clusterList cluster List
60
- * @returns {Promise} Reachability latency results
61
- * @private
62
- * @memberof Reachability
63
- */
64
- private getLocalSDPForClusters;
65
- /**
66
- * Get list of all unreachable clusters
67
- * @returns {array} Unreachable clusters
68
- * @private
69
- * @memberof Reachability
70
- */
71
- private getUnreachablClusters;
72
- /**
73
- * Attach an event handler for the icegatheringstatechange
74
- * event and measure latency.
75
- * @param {RTCPeerConnection} peerConnection
76
- * @returns {undefined}
77
- * @private
78
- * @memberof Reachability
79
- */
80
- private handleIceGatheringStateChange;
81
- /**
82
- * Attach an event handler for the icecandidate
83
- * event and measure latency.
84
- * @param {RTCPeerConnection} peerConnection
85
- * @returns {undefined}
86
- * @private
87
- * @memberof Reachability
88
- */
89
- private handleOnIceCandidate;
90
- /**
91
- * An event handler on an RTCPeerConnection when the state of the ICE
92
- * candidate gathering process changes. Used to measure connection
93
- * speed.
94
- * @private
95
- * @param {RTCPeerConnection} peerConnection
96
- * @param {number} timeout
97
- * @returns {Promise}
98
- */
99
- private iceGatheringState;
100
- /**
101
- * Make a log of unreachable clusters.
102
- * @returns {undefined}
103
- * @private
104
- * @memberof Reachability
105
- */
106
- private logUnreachableClusters;
107
- /**
108
- * Calculates time to establish connection
109
- * @param {array} iceResults iceResults
110
- * @returns {object} reachabilityMap
111
- * @private
112
- * @memberof Reachability
113
- */
114
- private parseIceResultsToReachabilityResults;
115
- /**
116
- * fetches reachability data
117
- * @param {object} clusterList
118
- * @returns {Promise<localSDPData>} reachability check results
119
- * @private
120
- * @memberof Reachability
121
- */
122
- private performReachabilityCheck;
123
- /**
124
- * Records latency and closes the peerConnection
125
- * @param {RTCPeerConnection} peerConnection
126
- * @param {number} elapsed Latency in milliseconds
127
- * @returns {undefined}
128
- * @private
129
- * @memberof Reachability
130
- */
131
- private setLatencyAndClose;
132
- /**
133
- * utility function
134
- * @returns {undefined}
135
- * @private
136
- * @memberof Reachability
137
- */
138
- private setup;
139
- }
@@ -1,35 +0,0 @@
1
- export interface ClusterNode {
2
- isVideoMesh: boolean;
3
- udp: Array<string>;
4
- tcp: Array<string>;
5
- xtls: Array<string>;
6
- }
7
- export type ClusterList = {
8
- [key: string]: ClusterNode;
9
- };
10
- /**
11
- * @class ReachabilityRequest
12
- */
13
- declare class ReachabilityRequest {
14
- webex: any;
15
- /**
16
- * Creates an instance of ReachabilityRequest.
17
- * @param {object} webex
18
- * @memberof ReachabilityRequest
19
- */
20
- constructor(webex: object);
21
- /**
22
- * gets the cluster information
23
- *
24
- * @param {boolean} includeVideoMesh whether to include the video mesh clusters in the result or not
25
- * @returns {Promise}
26
- */
27
- getClusters: () => Promise<ClusterList>;
28
- /**
29
- * gets remote SDP For Clusters
30
- * @param {Object} localSDPList localSDPs for the cluster
31
- * @returns {Object}
32
- */
33
- remoteSDPForClusters: (localSDPList: object) => any;
34
- }
35
- export default ReachabilityRequest;
@@ -1,8 +0,0 @@
1
- /**
2
- * Converts a stun url to a turn url
3
- *
4
- * @param {string} stunUrl url of a stun server
5
- * @param {'tcp'|'udp'} protocol what protocol to use for the turn server
6
- * @returns {string} url of a turn server
7
- */
8
- export declare function convertStunUrlToTurn(stunUrl: string, protocol: 'udp' | 'tcp'): string;
@@ -1,3 +0,0 @@
1
- export declare const REACTION_RELAY_TYPES: {
2
- readonly REACTION: "react";
3
- };
@@ -1,4 +0,0 @@
1
- import { Reaction, ReactionType, SkinTone, SkinToneType } from './reactions.type';
2
- declare const Reactions: Record<ReactionType, Reaction>;
3
- declare const SkinTones: Record<SkinToneType, SkinTone>;
4
- export { Reactions, SkinTones };