@webex/plugin-meetings 3.12.0-next.19 → 3.12.0-next.191

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 (312) hide show
  1. package/.sdd/manifest.json +1312 -0
  2. package/.sdd/templates/.source.json +30 -0
  3. package/.sdd/templates/component-repo/module-docs/module-spec-quality.md +111 -0
  4. package/.sdd/templates/component-repo/module-docs/module-spec.template.md +321 -0
  5. package/.sdd/templates/component-repo/reference-docs/adr/_adr-example.md +59 -0
  6. package/.sdd/templates/component-repo/reference-docs/patterns/_pattern-example.md +49 -0
  7. package/.sdd/templates/component-repo/reference-docs/rules/_rule-example.md +42 -0
  8. package/.sdd/templates/component-repo/standing-docs/AGENTS.template.md +120 -0
  9. package/.sdd/templates/component-repo/standing-docs/ARCHITECTURE.template.md +206 -0
  10. package/.sdd/templates/component-repo/standing-docs/CONTRACTS.template.md +90 -0
  11. package/.sdd/templates/component-repo/standing-docs/DATA_MODEL.template.md +68 -0
  12. package/.sdd/templates/component-repo/standing-docs/GETTING_STARTED.template.md +111 -0
  13. package/.sdd/templates/component-repo/standing-docs/GLOSSARY.template.md +57 -0
  14. package/.sdd/templates/component-repo/standing-docs/REVIEW_CHECKLIST.template.md +69 -0
  15. package/.sdd/templates/component-repo/standing-docs/RULES.template.md +96 -0
  16. package/.sdd/templates/component-repo/standing-docs/SECURITY.template.md +84 -0
  17. package/.sdd/templates/component-repo/standing-docs/SERVICE_STATE.template.md +82 -0
  18. package/.sdd/templates/component-repo/standing-docs/SPEC_INDEX.template.md +94 -0
  19. package/.sdd/templates/component-repo/standing-docs/TEST_INDEX.template.md +64 -0
  20. package/.sdd/templates/component-repo/template-map.json +112 -0
  21. package/AGENTS.md +135 -0
  22. package/ai-docs/ARCHITECTURE.md +208 -0
  23. package/ai-docs/CONTRACTS.md +267 -0
  24. package/ai-docs/DATA_MODEL.md +64 -0
  25. package/ai-docs/GETTING_STARTED.md +73 -0
  26. package/ai-docs/GLOSSARY.md +56 -0
  27. package/ai-docs/REVIEW_CHECKLIST.md +45 -0
  28. package/ai-docs/RULES.md +79 -0
  29. package/ai-docs/SECURITY.md +74 -0
  30. package/ai-docs/SERVICE_STATE.md +59 -0
  31. package/ai-docs/SPEC_INDEX.md +85 -0
  32. package/ai-docs/TEST_INDEX.md +45 -0
  33. package/ai-docs/adr/0001-migrate-existing-docs-into-sdd.md +61 -0
  34. package/ai-docs/patterns/defensive-error-propagation.md +55 -0
  35. package/ai-docs/patterns/event-scope-emission.md +46 -0
  36. package/ai-docs/patterns/source-to-test-path-mirroring.md +45 -0
  37. package/ai-docs/patterns/stateless-plugin-request-classes.md +53 -0
  38. package/ai-docs/patterns/typed-constants-and-enum-values.md +47 -0
  39. package/assets/README.md +28 -0
  40. package/assets/e2ee-0.0.1.js +2 -0
  41. package/assets/e2ee-0.0.1.wasm +0 -0
  42. package/dist/aiEnableRequest/index.js +15 -2
  43. package/dist/aiEnableRequest/index.js.map +1 -1
  44. package/dist/annotation/index.js +55 -19
  45. package/dist/annotation/index.js.map +1 -1
  46. package/dist/assets/e2ee-0.0.1.js +2 -0
  47. package/dist/assets/e2ee-0.0.1.wasm +0 -0
  48. package/dist/breakouts/breakout.js +8 -3
  49. package/dist/breakouts/breakout.js.map +1 -1
  50. package/dist/breakouts/events.js +29 -14
  51. package/dist/breakouts/events.js.map +1 -1
  52. package/dist/breakouts/index.js +128 -7
  53. package/dist/breakouts/index.js.map +1 -1
  54. package/dist/common/errors/webex-errors.js +54 -5
  55. package/dist/common/errors/webex-errors.js.map +1 -1
  56. package/dist/config.js +3 -2
  57. package/dist/config.js.map +1 -1
  58. package/dist/constants.js +39 -11
  59. package/dist/constants.js.map +1 -1
  60. package/dist/controls-options-manager/index.js +46 -10
  61. package/dist/controls-options-manager/index.js.map +1 -1
  62. package/dist/hashTree/constants.js +4 -1
  63. package/dist/hashTree/constants.js.map +1 -1
  64. package/dist/hashTree/hashTreeParser.js +1096 -391
  65. package/dist/hashTree/hashTreeParser.js.map +1 -1
  66. package/dist/hashTree/utils.js +20 -0
  67. package/dist/hashTree/utils.js.map +1 -1
  68. package/dist/index.js +8 -0
  69. package/dist/index.js.map +1 -1
  70. package/dist/interceptors/dataChannelAuthToken.js +58 -16
  71. package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
  72. package/dist/interceptors/locusRetry.js +24 -9
  73. package/dist/interceptors/locusRetry.js.map +1 -1
  74. package/dist/interpretation/index.js +55 -12
  75. package/dist/interpretation/index.js.map +1 -1
  76. package/dist/interpretation/interpretation.types.js +7 -0
  77. package/dist/interpretation/interpretation.types.js.map +1 -0
  78. package/dist/interpretation/siLanguage.js +1 -1
  79. package/dist/locus-info/controlsUtils.js +4 -1
  80. package/dist/locus-info/controlsUtils.js.map +1 -1
  81. package/dist/locus-info/index.js +615 -176
  82. package/dist/locus-info/index.js.map +1 -1
  83. package/dist/locus-info/infoUtils.js +36 -5
  84. package/dist/locus-info/infoUtils.js.map +1 -1
  85. package/dist/locus-info/types.js +20 -0
  86. package/dist/locus-info/types.js.map +1 -1
  87. package/dist/media/MediaConnectionAwaiter.js +229 -166
  88. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  89. package/dist/media/index.js +8 -2
  90. package/dist/media/index.js.map +1 -1
  91. package/dist/media/properties.js +4 -5
  92. package/dist/media/properties.js.map +1 -1
  93. package/dist/meeting/in-meeting-actions.js +5 -1
  94. package/dist/meeting/in-meeting-actions.js.map +1 -1
  95. package/dist/meeting/index.js +1850 -961
  96. package/dist/meeting/index.js.map +1 -1
  97. package/dist/meeting/locusMediaRequest.js +229 -82
  98. package/dist/meeting/locusMediaRequest.js.map +1 -1
  99. package/dist/meeting/muteState.js +10 -1
  100. package/dist/meeting/muteState.js.map +1 -1
  101. package/dist/meeting/request.js +5 -2
  102. package/dist/meeting/request.js.map +1 -1
  103. package/dist/meeting/util.js +42 -4
  104. package/dist/meeting/util.js.map +1 -1
  105. package/dist/meeting/voicea-meeting.js +2 -1
  106. package/dist/meeting/voicea-meeting.js.map +1 -1
  107. package/dist/meeting-info/meeting-info-v2.js +12 -5
  108. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  109. package/dist/meetings/index.js +304 -129
  110. package/dist/meetings/index.js.map +1 -1
  111. package/dist/meetings/meetings.types.js +6 -1
  112. package/dist/meetings/meetings.types.js.map +1 -1
  113. package/dist/meetings/request.js +39 -0
  114. package/dist/meetings/request.js.map +1 -1
  115. package/dist/meetings/util.js +116 -18
  116. package/dist/meetings/util.js.map +1 -1
  117. package/dist/member/index.js +10 -0
  118. package/dist/member/index.js.map +1 -1
  119. package/dist/member/types.js.map +1 -1
  120. package/dist/member/util.js +30 -0
  121. package/dist/member/util.js.map +1 -1
  122. package/dist/members/index.js +101 -43
  123. package/dist/members/index.js.map +1 -1
  124. package/dist/members/util.js +8 -1
  125. package/dist/members/util.js.map +1 -1
  126. package/dist/metrics/constants.js +7 -1
  127. package/dist/metrics/constants.js.map +1 -1
  128. package/dist/multistream/codec/constants.js +63 -0
  129. package/dist/multistream/codec/constants.js.map +1 -0
  130. package/dist/multistream/mediaRequestManager.js +62 -15
  131. package/dist/multistream/mediaRequestManager.js.map +1 -1
  132. package/dist/multistream/receiveSlot.js +9 -0
  133. package/dist/multistream/receiveSlot.js.map +1 -1
  134. package/dist/multistream/remoteMediaManager.js +32 -4
  135. package/dist/multistream/remoteMediaManager.js.map +1 -1
  136. package/dist/multistream/sendSlotManager.js +11 -1
  137. package/dist/multistream/sendSlotManager.js.map +1 -1
  138. package/dist/reachability/clusterReachability.js.map +1 -1
  139. package/dist/reachability/index.js +121 -83
  140. package/dist/reachability/index.js.map +1 -1
  141. package/dist/reachability/reachability.types.js +2 -0
  142. package/dist/reachability/reachability.types.js.map +1 -1
  143. package/dist/reachability/util.js +45 -0
  144. package/dist/reachability/util.js.map +1 -1
  145. package/dist/reactions/reactions.type.js.map +1 -1
  146. package/dist/recording-controller/index.js +1 -3
  147. package/dist/recording-controller/index.js.map +1 -1
  148. package/dist/roap/turnDiscovery.js +8 -1
  149. package/dist/roap/turnDiscovery.js.map +1 -1
  150. package/dist/types/annotation/index.d.ts +19 -0
  151. package/dist/types/common/errors/webex-errors.d.ts +36 -2
  152. package/dist/types/config.d.ts +3 -2
  153. package/dist/types/constants.d.ts +15 -2
  154. package/dist/types/controls-options-manager/index.d.ts +16 -0
  155. package/dist/types/hashTree/constants.d.ts +1 -0
  156. package/dist/types/hashTree/hashTreeParser.d.ts +201 -22
  157. package/dist/types/hashTree/utils.d.ts +7 -0
  158. package/dist/types/index.d.ts +4 -0
  159. package/dist/types/interceptors/locusRetry.d.ts +4 -4
  160. package/dist/types/interpretation/interpretation.types.d.ts +10 -0
  161. package/dist/types/locus-info/index.d.ts +106 -8
  162. package/dist/types/locus-info/infoUtils.d.ts +8 -0
  163. package/dist/types/locus-info/types.d.ts +22 -1
  164. package/dist/types/media/MediaConnectionAwaiter.d.ts +66 -49
  165. package/dist/types/media/properties.d.ts +6 -2
  166. package/dist/types/meeting/in-meeting-actions.d.ts +4 -0
  167. package/dist/types/meeting/index.d.ts +217 -16
  168. package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
  169. package/dist/types/meeting/request.d.ts +1 -0
  170. package/dist/types/meeting/util.d.ts +12 -1
  171. package/dist/types/meeting-info/meeting-info-v2.d.ts +1 -0
  172. package/dist/types/meetings/index.d.ts +40 -19
  173. package/dist/types/meetings/meetings.types.d.ts +15 -0
  174. package/dist/types/meetings/request.d.ts +14 -0
  175. package/dist/types/member/index.d.ts +1 -0
  176. package/dist/types/member/types.d.ts +1 -0
  177. package/dist/types/member/util.d.ts +9 -0
  178. package/dist/types/members/index.d.ts +15 -2
  179. package/dist/types/members/util.d.ts +1 -5
  180. package/dist/types/metrics/constants.d.ts +6 -0
  181. package/dist/types/multistream/codec/constants.d.ts +7 -0
  182. package/dist/types/multistream/mediaRequestManager.d.ts +22 -5
  183. package/dist/types/multistream/remoteMediaManager.d.ts +18 -0
  184. package/dist/types/multistream/sendSlotManager.d.ts +5 -1
  185. package/dist/types/reachability/clusterReachability.d.ts +3 -3
  186. package/dist/types/reachability/index.d.ts +10 -3
  187. package/dist/types/reachability/reachability.types.d.ts +7 -0
  188. package/dist/types/reachability/util.d.ts +17 -0
  189. package/dist/types/reactions/reactions.type.d.ts +3 -0
  190. package/dist/webinar/index.js +441 -252
  191. package/dist/webinar/index.js.map +1 -1
  192. package/package.json +26 -24
  193. package/src/aiEnableRequest/ai-docs/ai-enable-request-spec.md +223 -0
  194. package/src/aiEnableRequest/index.ts +16 -0
  195. package/src/annotation/ai-docs/annotation-spec.md +236 -0
  196. package/src/annotation/index.ts +61 -29
  197. package/src/breakouts/ai-docs/breakouts-spec.md +324 -0
  198. package/src/breakouts/breakout.ts +3 -1
  199. package/src/breakouts/events.ts +33 -11
  200. package/src/breakouts/index.ts +145 -3
  201. package/src/common/errors/webex-errors.ts +56 -3
  202. package/src/config.ts +7 -3
  203. package/src/constants.ts +23 -4
  204. package/src/controls-options-manager/ai-docs/controls-options-manager-spec.md +243 -0
  205. package/src/controls-options-manager/index.ts +62 -10
  206. package/src/hashTree/ai-docs/hash-tree-spec.md +267 -0
  207. package/src/hashTree/constants.ts +7 -0
  208. package/src/hashTree/hashTreeParser.ts +861 -193
  209. package/src/hashTree/utils.ts +19 -0
  210. package/src/index.ts +7 -0
  211. package/src/interceptors/ai-docs/interceptors-spec.md +247 -0
  212. package/src/interceptors/dataChannelAuthToken.ts +59 -12
  213. package/src/interceptors/locusRetry.ts +26 -5
  214. package/src/interpretation/ai-docs/interpretation-spec.md +256 -0
  215. package/src/interpretation/index.ts +65 -10
  216. package/src/interpretation/interpretation.types.ts +11 -0
  217. package/src/locus-info/ai-docs/locus-info-spec.md +293 -0
  218. package/src/locus-info/controlsUtils.ts +3 -1
  219. package/src/locus-info/index.ts +566 -164
  220. package/src/locus-info/infoUtils.ts +41 -6
  221. package/src/locus-info/types.ts +26 -1
  222. package/src/media/MediaConnectionAwaiter.ts +229 -196
  223. package/src/media/ai-docs/media-spec.md +267 -0
  224. package/src/media/index.ts +10 -1
  225. package/src/media/properties.ts +8 -3
  226. package/src/meeting/ai-docs/meeting-spec.md +404 -0
  227. package/src/meeting/in-meeting-actions.ts +8 -0
  228. package/src/meeting/index.ts +1093 -251
  229. package/src/meeting/locusMediaRequest.ts +106 -6
  230. package/src/meeting/muteState.ts +10 -1
  231. package/src/meeting/request.ts +11 -0
  232. package/src/meeting/util.ts +53 -9
  233. package/src/meeting/voicea-meeting.ts +1 -1
  234. package/src/meeting-info/ai-docs/meeting-info-spec.md +261 -0
  235. package/src/meeting-info/meeting-info-v2.ts +11 -4
  236. package/src/meetings/ai-docs/meetings-spec.md +296 -0
  237. package/src/meetings/index.ts +202 -81
  238. package/src/meetings/meetings.types.ts +19 -0
  239. package/src/meetings/request.ts +43 -0
  240. package/src/meetings/util.ts +117 -4
  241. package/src/member/ai-docs/member-spec.md +196 -0
  242. package/src/member/index.ts +10 -0
  243. package/src/member/types.ts +1 -0
  244. package/src/member/util.ts +29 -0
  245. package/src/members/ai-docs/members-spec.md +256 -0
  246. package/src/members/index.ts +70 -7
  247. package/src/members/util.ts +12 -4
  248. package/src/metrics/ai-docs/metrics-spec.md +185 -0
  249. package/src/metrics/constants.ts +6 -0
  250. package/src/multistream/ai-docs/multistream-spec.md +295 -0
  251. package/src/multistream/codec/constants.ts +58 -0
  252. package/src/multistream/mediaRequestManager.ts +119 -28
  253. package/src/multistream/receiveSlot.ts +18 -0
  254. package/src/multistream/remoteMediaManager.ts +23 -1
  255. package/src/multistream/sendSlotManager.ts +15 -1
  256. package/src/personal-meeting-room/ai-docs/personal-meeting-room-spec.md +234 -0
  257. package/src/reachability/ai-docs/reachability-spec.md +261 -0
  258. package/src/reachability/clusterReachability.ts +3 -2
  259. package/src/reachability/index.ts +47 -16
  260. package/src/reachability/reachability.types.ts +11 -0
  261. package/src/reachability/util.ts +36 -0
  262. package/src/reactions/ai-docs/reactions-spec.md +198 -0
  263. package/src/reactions/reactions.type.ts +3 -0
  264. package/src/reconnection-manager/ai-docs/reconnection-manager-spec.md +272 -0
  265. package/src/recording-controller/ai-docs/recording-controller-spec.md +223 -0
  266. package/src/recording-controller/index.ts +1 -2
  267. package/src/roap/ai-docs/roap-spec.md +241 -0
  268. package/src/roap/turnDiscovery.ts +9 -1
  269. package/src/webinar/ai-docs/webinar-spec.md +243 -0
  270. package/src/webinar/index.ts +247 -89
  271. package/test/unit/spec/aiEnableRequest/index.ts +86 -0
  272. package/test/unit/spec/annotation/index.ts +214 -182
  273. package/test/unit/spec/breakouts/breakout.ts +9 -3
  274. package/test/unit/spec/breakouts/events.ts +120 -2
  275. package/test/unit/spec/breakouts/index.ts +336 -15
  276. package/test/unit/spec/common/errors/webex-errors.ts +78 -0
  277. package/test/unit/spec/controls-options-manager/index.js +139 -32
  278. package/test/unit/spec/hashTree/hashTreeParser.ts +2360 -239
  279. package/test/unit/spec/hashTree/utils.ts +37 -0
  280. package/test/unit/spec/interceptors/dataChannelAuthToken.ts +179 -1
  281. package/test/unit/spec/interceptors/locusRetry.ts +234 -5
  282. package/test/unit/spec/interpretation/index.ts +119 -4
  283. package/test/unit/spec/locus-info/controlsUtils.js +172 -57
  284. package/test/unit/spec/locus-info/index.js +1014 -58
  285. package/test/unit/spec/locus-info/infoUtils.js +184 -1
  286. package/test/unit/spec/media/MediaConnectionAwaiter.ts +479 -17
  287. package/test/unit/spec/media/index.ts +92 -0
  288. package/test/unit/spec/media/properties.ts +26 -26
  289. package/test/unit/spec/meeting/in-meeting-actions.ts +4 -0
  290. package/test/unit/spec/meeting/index.js +3601 -536
  291. package/test/unit/spec/meeting/locusMediaRequest.ts +406 -4
  292. package/test/unit/spec/meeting/muteState.js +81 -0
  293. package/test/unit/spec/meeting/request.js +12 -0
  294. package/test/unit/spec/meeting/utils.js +205 -19
  295. package/test/unit/spec/meeting/voicea-meeting.ts +85 -1
  296. package/test/unit/spec/meeting-info/meetinginfov2.js +88 -11
  297. package/test/unit/spec/meetings/index.js +549 -49
  298. package/test/unit/spec/meetings/request.js +141 -0
  299. package/test/unit/spec/meetings/utils.js +402 -51
  300. package/test/unit/spec/member/index.js +7 -0
  301. package/test/unit/spec/member/util.js +89 -0
  302. package/test/unit/spec/members/index.js +216 -0
  303. package/test/unit/spec/members/request.js +37 -1
  304. package/test/unit/spec/members/utils.js +63 -0
  305. package/test/unit/spec/multistream/mediaRequestManager.ts +501 -37
  306. package/test/unit/spec/multistream/remoteMediaManager.ts +46 -0
  307. package/test/unit/spec/multistream/sendSlotManager.ts +30 -2
  308. package/test/unit/spec/reachability/index.ts +128 -46
  309. package/test/unit/spec/reachability/util.ts +31 -0
  310. package/test/unit/spec/recording-controller/index.js +9 -8
  311. package/test/unit/spec/roap/turnDiscovery.ts +20 -0
  312. package/test/unit/spec/webinar/index.ts +935 -466
@@ -22,7 +22,6 @@ import {
22
22
  MediaConnectionEventNames,
23
23
  MediaContent,
24
24
  MediaType,
25
- MediaCodecMimeType,
26
25
  RemoteTrackType,
27
26
  RoapMessage,
28
27
  StatsAnalyzer,
@@ -31,10 +30,11 @@ import {
31
30
  NetworkQualityMonitor,
32
31
  StatsMonitor,
33
32
  StatsMonitorEventNames,
34
- InboundAudioIssueSubTypes,
33
+ MediaCodecMimeType,
35
34
  } from '@webex/internal-media-core';
36
35
 
37
- import {DataChannelTokenType} from '@webex/internal-plugin-llm';
36
+ import {DataChannelTokenType, type RegisterAndConnectTiming} from '@webex/internal-plugin-llm';
37
+ import type LLMChannel from '@webex/internal-plugin-llm';
38
38
 
39
39
  import {
40
40
  LocalStream,
@@ -51,6 +51,7 @@ import {
51
51
  EVENT_TRIGGERS as VOICEAEVENTS,
52
52
  TURN_ON_CAPTION_STATUS,
53
53
  type MeetingTranscriptPayload,
54
+ type VoiceaChannel,
54
55
  } from '@webex/internal-plugin-voicea';
55
56
 
56
57
  import {
@@ -58,6 +59,7 @@ import {
58
59
  isBrowserMediaError,
59
60
  isBrowserMediaErrorName,
60
61
  } from '@webex/internal-plugin-metrics/src/call-diagnostic/call-diagnostic-metrics.util';
62
+ import type {MetricEventMeetingJoinPhase} from '@webex/internal-plugin-metrics/src/metrics.types';
61
63
  import {CapabilityState, WebCapabilities} from '@webex/web-capabilities';
62
64
  import {processNewCaptions} from './voicea-meeting';
63
65
 
@@ -67,6 +69,7 @@ import {
67
69
  NoMediaEstablishedYetError,
68
70
  UserNotJoinedError,
69
71
  AddMediaFailed,
72
+ MediaConnectionTimedOutError,
70
73
  SdpResponseTimeoutError,
71
74
  } from '../common/errors/webex-errors';
72
75
 
@@ -77,6 +80,7 @@ import Roap, {type TurnDiscoveryResult, type TurnDiscoverySkipReason} from '../r
77
80
  import {type TurnServerInfo} from '../roap/types';
78
81
  import Media, {type BundlePolicy} from '../media';
79
82
  import MediaProperties from '../media/properties';
83
+ import {type FailureResult as MediaConnectionAwaiterFailureResult} from '../media/MediaConnectionAwaiter';
80
84
  import MeetingStateMachine from './state';
81
85
  import {createMuteState} from './muteState';
82
86
  import LocusInfo, {LocusLLMEvent} from '../locus-info';
@@ -154,6 +158,7 @@ import {
154
158
  Configuration as RemoteMediaManagerConfiguration,
155
159
  RemoteMediaManager,
156
160
  Event as RemoteMediaManagerEvent,
161
+ getRemoteMediaManagerConfigForLogging,
157
162
  } from '../multistream/remoteMediaManager';
158
163
  import {
159
164
  Reaction,
@@ -183,13 +188,14 @@ import {ReachabilityMetrics} from '../reachability/reachability.types';
183
188
  import {SetStageOptions, SetStageVideoLayout, UnsetStageVideoLayout} from './request.type';
184
189
  import {Invitee} from './type';
185
190
  import {DataSet, HashTreeMessage, Metadata} from '../hashTree/hashTreeParser';
186
- import {LocusDTO} from '../locus-info/types';
191
+ import {LocusDTO, LocusErrorCodes} from '../locus-info/types';
187
192
  import AIEnableRequest from '../aiEnableRequest';
188
193
 
189
194
  // default callback so we don't call an undefined function, but in practice it should never be used
190
195
  const DEFAULT_ICE_PHASE_CALLBACK = () => 'JOIN_MEETING_FINAL';
191
196
 
192
197
  const LLM_HEALTHCHECK_TIMER_MS = 3 * 60 * 1000;
198
+ const JOIN_WITH_MEDIA_RETRY_MAX_COUNT = 2;
193
199
 
194
200
  const logRequest = (request: any, {logText = ''}) => {
195
201
  LoggerProxy.logger.info(`${logText} - sending request`);
@@ -273,6 +279,7 @@ export type CallStateForMetrics = {
273
279
  userNameInput?: string;
274
280
  emailInput?: string;
275
281
  pstnCorrelationId?: string;
282
+ meetingJoinPhase?: MetricEventMeetingJoinPhase;
276
283
  };
277
284
 
278
285
  export const MEDIA_UPDATE_TYPE = {
@@ -612,7 +619,7 @@ export default class Meeting extends StatelessWebexPlugin {
612
619
  webinar: any;
613
620
  conversationUrl: string;
614
621
  callStateForMetrics: CallStateForMetrics;
615
- destination: string;
622
+ destination: string | LocusDTO;
616
623
  destinationType: DESTINATION_TYPE;
617
624
  deviceUrl: string;
618
625
  hostId: string;
@@ -651,6 +658,8 @@ export default class Meeting extends StatelessWebexPlugin {
651
658
  floorGrantPending: boolean;
652
659
  hasJoinedOnce: boolean;
653
660
  hasWebsocketConnected: boolean;
661
+ private mercuryOnlineHandler?: () => void;
662
+ private mercuryOfflineHandler?: () => void;
654
663
  inMeetingActions: InMeetingActions;
655
664
  isLocalShareLive: boolean;
656
665
  isRoapInProgress: boolean;
@@ -662,6 +671,7 @@ export default class Meeting extends StatelessWebexPlugin {
662
671
  joinedWith?: any;
663
672
  selfId?: string;
664
673
  roles: any[];
674
+ canNotViewTheParticipantList?: boolean;
665
675
  // ... there is more ... see SelfUtils.parse()
666
676
  // end of the group
667
677
  locusMediaRequest?: LocusMediaRequest;
@@ -732,13 +742,36 @@ export default class Meeting extends StatelessWebexPlugin {
732
742
  turnDiscoverySkippedReason: TurnDiscoverySkipReason;
733
743
  turnServerUsed: boolean;
734
744
  areVoiceaEventsSetup = false;
745
+ /**
746
+ * Returns the initial transcription object shape.
747
+ * Used by constructor and reset paths to ensure consistent initialization.
748
+ * @private
749
+ * @returns {Transcription}
750
+ */
751
+ private getInitialTranscription(): Transcription {
752
+ return {
753
+ captions: [],
754
+ isListening: false,
755
+ commandText: '',
756
+ languageOptions: {currentSpokenLanguage: 'en'},
757
+ showCaptionBox: false,
758
+ transcribingRequestStatus: 'INACTIVE',
759
+ isCaptioning: false,
760
+ interimCaptions: {} as Map<string, CaptionData>,
761
+ speakerProxy: {} as Map<string, any>,
762
+ } as Transcription;
763
+ }
764
+
735
765
  isMoveToInProgress = false;
736
766
  registrationIdStatus: string;
737
767
  brbState: BrbState;
768
+ private emittedBreakoutJoinResponseMoveIds: Set<string> = new Set();
769
+ private promisesWaitingForPropUpdate: Record<string, Defer> = {};
738
770
 
739
771
  voiceaListenerCallbacks: object = {
740
772
  [VOICEAEVENTS.VOICEA_ANNOUNCEMENT]: (payload: Transcription['languageOptions']) => {
741
773
  this.transcription.languageOptions = payload;
774
+ const eventPayload = {...payload};
742
775
 
743
776
  LoggerProxy.logger.debug(
744
777
  `${EventsUtil.getScopeLog({
@@ -748,11 +781,11 @@ export default class Meeting extends StatelessWebexPlugin {
748
781
  );
749
782
 
750
783
  if (this.getCurUserType() !== 'host') {
751
- delete payload.spokenLanguages;
784
+ delete eventPayload.spokenLanguages;
752
785
  }
753
786
 
754
787
  // @ts-ignore
755
- this.trigger(EVENT_TRIGGERS.MEETING_STARTED_RECEIVING_TRANSCRIPTION, payload);
788
+ this.trigger(EVENT_TRIGGERS.MEETING_STARTED_RECEIVING_TRANSCRIPTION, eventPayload);
756
789
  },
757
790
  [VOICEAEVENTS.CAPTIONS_TURNED_ON]: () => {
758
791
  this.transcription.status = TURN_ON_CAPTION_STATUS.ENABLED;
@@ -784,13 +817,20 @@ export default class Meeting extends StatelessWebexPlugin {
784
817
  private addMediaData: {
785
818
  retriedWithTurnServer: boolean;
786
819
  icePhaseCallback: () => string;
820
+ iceTransportPolicy?: RTCIceTransportPolicy;
787
821
  };
788
822
 
789
823
  private sendSlotManager: SendSlotManager = new SendSlotManager(LoggerProxy);
790
824
  private deferSDPAnswer?: Defer; // used for waiting for a response
791
825
  private sdpResponseTimer?: ReturnType<typeof setTimeout>;
792
826
  private hasMediaConnectionConnectedAtLeastOnce: boolean;
793
- private joinWithMediaRetryInfo?: {isRetry: boolean; prevJoinResponse?: any};
827
+ private joinWithMediaRetryInfo: {
828
+ retryCount: number;
829
+ prevJoinResponse?: any;
830
+ firstError?: Error;
831
+ prevError?: Error;
832
+ };
833
+
794
834
  private connectionStateHandler?: ConnectionStateHandler;
795
835
  private iceCandidateErrors: Map<string, number>;
796
836
  private iceCandidatesCount: number;
@@ -800,6 +840,22 @@ export default class Meeting extends StatelessWebexPlugin {
800
840
  private mediaServerIp: string;
801
841
  private llmHealthCheckTimer?: ReturnType<typeof setTimeout>;
802
842
 
843
+ /**
844
+ * The LLM channel owned by this meeting for datachannel communication.
845
+ * Created in updateLLMConnection, cleaned up in cleanupLLMConneciton.
846
+ */
847
+ private llmChannel?: LLMChannel;
848
+
849
+ /**
850
+ * The Voicea channel for transcription/captions, bound to this meeting's LLM channel.
851
+ */
852
+ voiceaChannel?: VoiceaChannel;
853
+
854
+ /**
855
+ * Pending datachannel token saved from join response, used when creating the LLM channel.
856
+ */
857
+ private _pendingDatachannelToken?: string;
858
+
803
859
  /**
804
860
  * @param {Object} attrs
805
861
  * @param {Object} options
@@ -935,7 +991,7 @@ export default class Meeting extends StatelessWebexPlugin {
935
991
  this.simultaneousInterpretation = new SimultaneousInterpretation({}, {parent: this.webex});
936
992
 
937
993
  // @ts-ignore
938
- this.aiEnableRequest = new AIEnableRequest({}, {parent: this.webex});
994
+ this.aiEnableRequest = new AIEnableRequest({locusUrl: this.locusUrl}, {parent: this.webex});
939
995
 
940
996
  /**
941
997
  * @instance
@@ -953,6 +1009,16 @@ export default class Meeting extends StatelessWebexPlugin {
953
1009
  */
954
1010
  // @ts-ignore
955
1011
  this.webinar = new Webinar({meetingId: this.id}, {parent: this.webex});
1012
+ /**
1013
+ * VoiceaChannel for transcription/captions. Created without llmChannel;
1014
+ * switchLLMChannel() is called in updateLLMConnection() when LLM connects.
1015
+ * @instance
1016
+ * @type {VoiceaChannel}
1017
+ * @public
1018
+ * @memberof Meeting
1019
+ */
1020
+ // @ts-ignore - Fix type
1021
+ this.voiceaChannel = this.webex.internal.voicea.createChannel();
956
1022
  /**
957
1023
  * helper class for managing receive slots (for multistream media connections)
958
1024
  */
@@ -966,6 +1032,7 @@ export default class Meeting extends StatelessWebexPlugin {
966
1032
  },
967
1033
  (csi: CSI) => (this.members.findMemberByCsi(csi) as any)?.id
968
1034
  );
1035
+
969
1036
  /**
970
1037
  * Object containing helper classes for managing media requests for audio/video/screenshare (for multistream media connections)
971
1038
  * All multistream media requests sent out for this meeting have to go through them.
@@ -985,6 +1052,7 @@ export default class Meeting extends StatelessWebexPlugin {
985
1052
  mediaRequests
986
1053
  );
987
1054
  },
1055
+ this.getIngressPayloadTypeCallback.bind(this),
988
1056
  {
989
1057
  // @ts-ignore - config coming from registerPlugin
990
1058
  degradationPreferences: this.config.degradationPreferences,
@@ -1006,6 +1074,7 @@ export default class Meeting extends StatelessWebexPlugin {
1006
1074
  mediaRequests
1007
1075
  );
1008
1076
  },
1077
+ this.getIngressPayloadTypeCallback.bind(this),
1009
1078
  {
1010
1079
  // @ts-ignore - config coming from registerPlugin
1011
1080
  degradationPreferences: this.config.degradationPreferences,
@@ -1027,6 +1096,7 @@ export default class Meeting extends StatelessWebexPlugin {
1027
1096
  mediaRequests
1028
1097
  );
1029
1098
  },
1099
+ this.getIngressPayloadTypeCallback.bind(this),
1030
1100
  {
1031
1101
  // @ts-ignore - config coming from registerPlugin
1032
1102
  degradationPreferences: this.config.degradationPreferences,
@@ -1048,11 +1118,14 @@ export default class Meeting extends StatelessWebexPlugin {
1048
1118
  mediaRequests
1049
1119
  );
1050
1120
  },
1121
+ this.getIngressPayloadTypeCallback.bind(this),
1051
1122
  {
1052
1123
  // @ts-ignore - config coming from registerPlugin
1053
1124
  degradationPreferences: this.config.degradationPreferences,
1054
1125
  kind: 'video',
1055
1126
  trimRequestsToNumOfSources: false,
1127
+ // @ts-ignore - config coming from registerPlugin
1128
+ enableAv1: this.config.enableAv1SlidesSupport,
1056
1129
  }
1057
1130
  ),
1058
1131
  };
@@ -1372,7 +1445,48 @@ export default class Meeting extends StatelessWebexPlugin {
1372
1445
  * @memberof Meeting
1373
1446
  */
1374
1447
  // @ts-ignore - Fix type
1375
- this.locusInfo = new LocusInfo(this.updateMeetingObject.bind(this), this.webex, this.id);
1448
+ this.locusInfo = new LocusInfo(
1449
+ {
1450
+ updateMeeting: this.updateMeetingObject.bind(this),
1451
+ syncLatencyTracker: {
1452
+ // Compute/store latency timestamps live on CallDiagnosticLatencies, while
1453
+ // submitting the client.locus.sync.complete CA event is owned by the metrics
1454
+ // facade. Wire each method to the layer that owns that responsibility.
1455
+ saveLatency: (...args) =>
1456
+ // @ts-ignore
1457
+ this.webex.internal.newMetrics.callDiagnosticLatencies.saveLatency(...args),
1458
+ saveTimestamp: (saveTimestampOptions: {
1459
+ key: string;
1460
+ value?: number;
1461
+ options: {meetingId: string; dataSetName: string; trackingId?: string};
1462
+ }) => {
1463
+ // @ts-ignore
1464
+ this.webex.internal.newMetrics.callDiagnosticLatencies.saveTimestamp(
1465
+ saveTimestampOptions
1466
+ );
1467
+
1468
+ // The /sync response is one of the two milestones (the other is the LLM message) that
1469
+ // complete client.locus.sync.complete. Try to complete now: the metric is emitted only
1470
+ // once both the LLM message and the /sync response have arrived (either can come first).
1471
+ if (
1472
+ saveTimestampOptions.key === 'internal.client.locus.sync.response' &&
1473
+ saveTimestampOptions.options?.trackingId
1474
+ ) {
1475
+ this.tryCompleteLocusSyncLatency(
1476
+ saveTimestampOptions.options.meetingId,
1477
+ saveTimestampOptions.options.trackingId
1478
+ );
1479
+ }
1480
+ },
1481
+ clearLocusSyncLatency: (...args) =>
1482
+ // @ts-ignore
1483
+ this.webex.internal.newMetrics.callDiagnosticLatencies.clearLocusSyncLatency(...args),
1484
+ },
1485
+ },
1486
+ // @ts-ignore
1487
+ this.webex,
1488
+ this.id
1489
+ );
1376
1490
 
1377
1491
  // We had to add listeners first before setting up the locus instance
1378
1492
  /**
@@ -1428,17 +1542,7 @@ export default class Meeting extends StatelessWebexPlugin {
1428
1542
  * @private
1429
1543
  * @memberof Meeting
1430
1544
  */
1431
- this.transcription = {
1432
- captions: [],
1433
- isListening: false,
1434
- commandText: '',
1435
- languageOptions: {currentSpokenLanguage: 'en'},
1436
- showCaptionBox: false,
1437
- transcribingRequestStatus: 'INACTIVE',
1438
- isCaptioning: false,
1439
- interimCaptions: {} as Map<string, CaptionData>,
1440
- speakerProxy: {} as Map<string, any>,
1441
- } as Transcription;
1545
+ this.transcription = this.getInitialTranscription();
1442
1546
 
1443
1547
  /**
1444
1548
  * Password status. If it's PASSWORD_STATUS.REQUIRED then verifyPassword() needs to be called
@@ -1557,6 +1661,8 @@ export default class Meeting extends StatelessWebexPlugin {
1557
1661
  this.controlsOptionsManager = new ControlsOptionsManager(this.meetingRequest, {
1558
1662
  locusUrl: this.locusInfo?.url,
1559
1663
  displayHints: [],
1664
+ getControls: () => this.locusInfo?.controls,
1665
+ isWebinar: () => this.locusInfo?.info?.isWebinar,
1560
1666
  });
1561
1667
 
1562
1668
  this.setUpLocusInfoListeners();
@@ -1655,11 +1761,11 @@ export default class Meeting extends StatelessWebexPlugin {
1655
1761
  /**
1656
1762
  * Information needed for a retry of a call to joinWithMedia
1657
1763
  * @instance
1658
- * @type {{isRetry: boolean; prevJoinResponse?: any}}
1764
+ * @type {{retryCount: number; prevJoinResponse?: any}}
1659
1765
  * @private
1660
1766
  * @memberof Meeting
1661
1767
  */
1662
- this.joinWithMediaRetryInfo = {isRetry: false, prevJoinResponse: undefined};
1768
+ this.joinWithMediaRetryInfo = {retryCount: 0, prevJoinResponse: undefined};
1663
1769
 
1664
1770
  /**
1665
1771
  * Connection state handler
@@ -1713,6 +1819,37 @@ export default class Meeting extends StatelessWebexPlugin {
1713
1819
  this.mediaServerIp = undefined;
1714
1820
  }
1715
1821
 
1822
+ /**
1823
+ * Get the ingress payload type for a given media type and codec mime type
1824
+ * @param {MediaType} mediaType - The media type
1825
+ * @param {MediaCodecMimeType} codecMimeType - The codec mime type
1826
+ * @returns {number | undefined} - The ingress payload type
1827
+ * @private
1828
+ * @memberof Meeting
1829
+ */
1830
+ private getIngressPayloadTypeCallback(
1831
+ mediaType: MediaType,
1832
+ codecMimeType: MediaCodecMimeType
1833
+ ): number | undefined {
1834
+ if (this.isMultistream) {
1835
+ try {
1836
+ return this.mediaProperties.webrtcMediaConnection.getIngressPayloadType(
1837
+ mediaType,
1838
+ codecMimeType
1839
+ );
1840
+ } catch (error) {
1841
+ LoggerProxy.logger.info(
1842
+ `Meeting:index#mediaRequestManager --> failed to get ingress payload type for mediaType=${mediaType}, codecMimeType=${codecMimeType}`,
1843
+ error
1844
+ );
1845
+
1846
+ return undefined;
1847
+ }
1848
+ }
1849
+
1850
+ return undefined;
1851
+ }
1852
+
1716
1853
  /**
1717
1854
  * Temporary func to return webex object,
1718
1855
  * in order to access internal plugin metrics
@@ -1993,7 +2130,7 @@ export default class Meeting extends StatelessWebexPlugin {
1993
2130
  this.config.installedOrgID,
1994
2131
  this.locusId,
1995
2132
  extraParams,
1996
- {meetingId: this.id, sendCAevents},
2133
+ {meetingId: this.id, sendCAevents, correlationId: this.correlationId},
1997
2134
  registrationId,
1998
2135
  null,
1999
2136
  classificationId
@@ -2325,6 +2462,89 @@ export default class Meeting extends StatelessWebexPlugin {
2325
2462
  });
2326
2463
  }
2327
2464
 
2465
+ /**
2466
+ * Handles the LLM state-update message that resulted from a Locus /sync. Records the LLM arrival
2467
+ * time (the milestone that gates client.locus.sync.complete - the metric is emitted only for LLM
2468
+ * flows) and then tries to complete the metric.
2469
+ * @param {string} meetingId meeting id
2470
+ * @param {string} trackingId sync tracking id echoed back on the LLM message
2471
+ * @returns {void}
2472
+ * @private
2473
+ * @memberof Meeting
2474
+ */
2475
+ private onLocusSyncLlmMessage(meetingId: string, trackingId: string) {
2476
+ // @ts-ignore
2477
+ this.webex.internal.newMetrics.callDiagnosticLatencies.recordLocusSyncMessageReceived(
2478
+ meetingId,
2479
+ trackingId
2480
+ );
2481
+
2482
+ this.tryCompleteLocusSyncLatency(meetingId, trackingId);
2483
+ }
2484
+
2485
+ /**
2486
+ * Attempts to complete the Locus sync latency metric and emit client.locus.sync.complete. The
2487
+ * metric is emitted only once BOTH the /sync response and the resulting LLM message have arrived
2488
+ * (in either order); until then the record is kept so the missing milestone can still land. Both
2489
+ * trigger points (the LLM message handler and the /sync response timestamp) call this, so the
2490
+ * metric fires as soon as the second milestone is in.
2491
+ * @param {string} meetingId meeting id
2492
+ * @param {string} trackingId sync tracking id used to match the pending record
2493
+ * @returns {void}
2494
+ * @private
2495
+ * @memberof Meeting
2496
+ */
2497
+ private tryCompleteLocusSyncLatency(meetingId: string, trackingId: string) {
2498
+ const completed =
2499
+ // @ts-ignore
2500
+ this.webex.internal.newMetrics.callDiagnosticLatencies.completeLocusSyncLatency(
2501
+ meetingId,
2502
+ trackingId
2503
+ );
2504
+
2505
+ if (completed) {
2506
+ this.emitLocusSyncCompleteMetric(meetingId, completed);
2507
+ }
2508
+ }
2509
+
2510
+ /**
2511
+ * Submits the client.locus.sync.complete Call Analyzer event for a completed Locus sync latency
2512
+ * measurement.
2513
+ * @param {string} meetingId meeting id
2514
+ * @param {object} completed completed sync latency payload from the metrics plugin
2515
+ * @returns {void}
2516
+ * @private
2517
+ * @memberof Meeting
2518
+ */
2519
+ private emitLocusSyncCompleteMetric(
2520
+ meetingId: string,
2521
+ completed: {dataSet: string; syncLatency: object}
2522
+ ) {
2523
+ // @ts-ignore
2524
+ const llmWebsocketUrl = this.webex.internal.llm?.getWebSocketUrl?.() || undefined;
2525
+
2526
+ // Per the LLM sync-latency spec, the event carries the LLM websocket url identifier,
2527
+ // the llmInfo.dataSet (main, atd-active or atd-unmuted) and the syncLatency block.
2528
+ const clientEvent = {
2529
+ name: 'client.locus.sync.complete',
2530
+ payload: {
2531
+ identifiers: {
2532
+ llmWebsocketUrl,
2533
+ },
2534
+ llmInfo: {
2535
+ dataSet: completed.dataSet,
2536
+ },
2537
+ syncLatency: completed.syncLatency,
2538
+ },
2539
+ options: {
2540
+ meetingId,
2541
+ },
2542
+ };
2543
+
2544
+ // @ts-ignore
2545
+ this.webex.internal.newMetrics.submitClientEvent(clientEvent);
2546
+ }
2547
+
2328
2548
  /**
2329
2549
  * Proxy function for all the listener set ups
2330
2550
  * @returns {undefined}
@@ -2484,29 +2704,28 @@ export default class Meeting extends StatelessWebexPlugin {
2484
2704
  * @memberof Meeting
2485
2705
  */
2486
2706
  private setUpVoiceaListeners() {
2487
- // @ts-ignore
2488
- this.webex.internal.voicea.listenToEvents();
2707
+ if (!this.voiceaChannel) {
2708
+ LoggerProxy.logger.warn('Meeting:index#setUpVoiceaListeners --> voiceaChannel not available');
2489
2709
 
2490
- // @ts-ignore
2491
- this.webex.internal.voicea.on(
2710
+ return;
2711
+ }
2712
+
2713
+ this.voiceaChannel.on(
2492
2714
  VOICEAEVENTS.VOICEA_ANNOUNCEMENT,
2493
2715
  this.voiceaListenerCallbacks[VOICEAEVENTS.VOICEA_ANNOUNCEMENT]
2494
2716
  );
2495
2717
 
2496
- // @ts-ignore
2497
- this.webex.internal.voicea.on(
2718
+ this.voiceaChannel.on(
2498
2719
  VOICEAEVENTS.CAPTIONS_TURNED_ON,
2499
2720
  this.voiceaListenerCallbacks[VOICEAEVENTS.CAPTIONS_TURNED_ON]
2500
2721
  );
2501
2722
 
2502
- // @ts-ignore
2503
- this.webex.internal.voicea.on(
2723
+ this.voiceaChannel.on(
2504
2724
  VOICEAEVENTS.EVA_COMMAND,
2505
2725
  this.voiceaListenerCallbacks[VOICEAEVENTS.EVA_COMMAND]
2506
2726
  );
2507
2727
 
2508
- // @ts-ignore
2509
- this.webex.internal.voicea.on(
2728
+ this.voiceaChannel.on(
2510
2729
  VOICEAEVENTS.NEW_CAPTION,
2511
2730
  this.voiceaListenerCallbacks[VOICEAEVENTS.NEW_CAPTION]
2512
2731
  );
@@ -2789,7 +3008,7 @@ export default class Meeting extends StatelessWebexPlugin {
2789
3008
  private setupLocusControlsListener() {
2790
3009
  this.locusInfo.on(
2791
3010
  LOCUSINFO.EVENTS.CONTROLS_RECORDING_UPDATED,
2792
- ({state, modifiedBy, lastModified}) => {
3011
+ ({state, modifiedBy, lastModified, modifiedByServiceAppName, modifiedByServiceAppId}) => {
2793
3012
  let event;
2794
3013
 
2795
3014
  switch (state) {
@@ -2815,6 +3034,8 @@ export default class Meeting extends StatelessWebexPlugin {
2815
3034
  state: state === RECORDING_STATE.RESUMED ? RECORDING_STATE.RECORDING : state,
2816
3035
  modifiedBy,
2817
3036
  lastModified,
3037
+ modifiedByServiceAppName,
3038
+ modifiedByServiceAppId,
2818
3039
  };
2819
3040
  Trigger.trigger(
2820
3041
  this,
@@ -2849,18 +3070,22 @@ export default class Meeting extends StatelessWebexPlugin {
2849
3070
  // user need to be joined to start the llm and receive transcription
2850
3071
  if (this.isJoined()) {
2851
3072
  // @ts-ignore - config coming from registerPlugin
2852
- if (transcribing && !this.transcription) {
2853
- this.startTranscription();
2854
- } else if (!transcribing && this.transcription) {
2855
- Trigger.trigger(
2856
- this,
2857
- {
2858
- file: 'meeting/index',
2859
- function: 'setupLocusControlsListener',
2860
- },
2861
- EVENT_TRIGGERS.MEETING_STOPPED_RECEIVING_TRANSCRIPTION,
2862
- {caption, transcribing}
2863
- );
3073
+ if (transcribing && !this.areVoiceaEventsSetup) {
3074
+ if (this.voiceaChannel?.isLLMConnected()) {
3075
+ this.startTranscription();
3076
+ }
3077
+ } else if (!transcribing) {
3078
+ if (this.areVoiceaEventsSetup) {
3079
+ Trigger.trigger(
3080
+ this,
3081
+ {
3082
+ file: 'meeting/index',
3083
+ function: 'setupLocusControlsListener',
3084
+ },
3085
+ EVENT_TRIGGERS.MEETING_STOPPED_RECEIVING_TRANSCRIPTION,
3086
+ {caption, transcribing}
3087
+ );
3088
+ }
2864
3089
  }
2865
3090
  }
2866
3091
  }
@@ -2873,8 +3098,7 @@ export default class Meeting extends StatelessWebexPlugin {
2873
3098
  if (this.transcription?.languageOptions) {
2874
3099
  this.transcription.languageOptions.currentSpokenLanguage = spokenLanguage;
2875
3100
  }
2876
- // @ts-ignore
2877
- this.webex.internal.voicea.onSpokenLanguageUpdate(spokenLanguage, this.id);
3101
+ this.voiceaChannel?.onSpokenLanguageUpdate(spokenLanguage, this.id);
2878
3102
 
2879
3103
  Trigger.trigger(
2880
3104
  this,
@@ -2903,8 +3127,7 @@ export default class Meeting extends StatelessWebexPlugin {
2903
3127
 
2904
3128
  this.locusInfo.on(LOCUSINFO.EVENTS.CONTROLS_MEETING_HESIOD_LLM_ID_UPDATED, ({hesiodLlmId}) => {
2905
3129
  if (hesiodLlmId) {
2906
- // @ts-ignore
2907
- this.webex.internal.voicea.onCaptionServiceIdUpdate(hesiodLlmId);
3130
+ this.voiceaChannel?.onCaptionServiceIdUpdate(hesiodLlmId);
2908
3131
  }
2909
3132
  });
2910
3133
 
@@ -3213,7 +3436,7 @@ export default class Meeting extends StatelessWebexPlugin {
3213
3436
  }
3214
3437
 
3215
3438
  LoggerProxy.logger.info(
3216
- `Meeting:index#setUpLocusInfoMediaInactiveListener --> this.shareStatus=${this.shareStatus} newShareStatus=${newShareStatus}`
3439
+ `Meeting:index#setUpLocusMediaSharesListener --> this.shareStatus=${this.shareStatus} newShareStatus=${newShareStatus}`
3217
3440
  );
3218
3441
 
3219
3442
  if (newShareStatus !== this.shareStatus) {
@@ -3459,13 +3682,12 @@ export default class Meeting extends StatelessWebexPlugin {
3459
3682
  this.breakouts.locusUrlUpdate(url);
3460
3683
  this.simultaneousInterpretation.locusUrlUpdate(url);
3461
3684
  this.annotation.locusUrlUpdate(url);
3685
+ this.aiEnableRequest.locusUrlUpdate(url);
3462
3686
  this.locusUrl = url;
3463
3687
  this.locusId = this.locusUrl?.split('/').pop();
3464
3688
  this.recordingController.setLocusUrl(this.locusUrl);
3465
3689
  this.controlsOptionsManager.setLocusUrl(this.locusUrl, !!isMainLocus);
3466
3690
  this.webinar.locusUrlUpdate(url);
3467
- // @ts-ignore
3468
- this.webex.internal.llm.setRefreshHandler(() => this.refreshDataChannelToken());
3469
3691
 
3470
3692
  Trigger.trigger(
3471
3693
  this,
@@ -3734,7 +3956,7 @@ export default class Meeting extends StatelessWebexPlugin {
3734
3956
  });
3735
3957
  this.updateLLMConnection();
3736
3958
  });
3737
- this.locusInfo.on(LOCUSINFO.EVENTS.SELF_ADMITTED_GUEST, (payload) => {
3959
+ this.locusInfo.on(LOCUSINFO.EVENTS.SELF_ADMITTED_GUEST, async (payload) => {
3738
3960
  this.stopKeepAlive();
3739
3961
 
3740
3962
  if (payload) {
@@ -3761,14 +3983,15 @@ export default class Meeting extends StatelessWebexPlugin {
3761
3983
  }
3762
3984
  this.rtcMetrics?.sendNextMetrics();
3763
3985
 
3764
- this.ensureDefaultDatachannelTokenAfterAdmit().catch((error) => {
3986
+ try {
3987
+ await this.ensureDefaultDatachannelTokenAfterAdmit();
3988
+ } catch (error) {
3765
3989
  LoggerProxy.logger.warn(
3766
3990
  `Meeting:index#setUpLocusInfoSelfListener --> failed post-admit token prefetch flow: ${
3767
3991
  error?.message || String(error)
3768
3992
  }`
3769
3993
  );
3770
- });
3771
-
3994
+ }
3772
3995
  this.updateLLMConnection();
3773
3996
  });
3774
3997
 
@@ -3813,6 +4036,9 @@ export default class Meeting extends StatelessWebexPlugin {
3813
4036
  });
3814
4037
 
3815
4038
  this.locusInfo.on(LOCUSINFO.EVENTS.SELF_CANNOT_VIEW_PARTICIPANT_LIST_CHANGE, (payload) => {
4039
+ // canViewTheParticipantList meeting action depends on this value, so we need to update meeting actions
4040
+ this.updateMeetingActions();
4041
+
3816
4042
  Trigger.trigger(
3817
4043
  this,
3818
4044
  {
@@ -4007,7 +4233,14 @@ export default class Meeting extends StatelessWebexPlugin {
4007
4233
  // is not changed by any delta event
4008
4234
  if (object && Object.keys(object).length) {
4009
4235
  Object.keys(object).forEach((key) => {
4236
+ const previousValue = this[key];
4237
+
4010
4238
  this[key] = object[key];
4239
+
4240
+ if (this.promisesWaitingForPropUpdate[key] && previousValue !== object[key]) {
4241
+ this.promisesWaitingForPropUpdate[key].resolve();
4242
+ delete this.promisesWaitingForPropUpdate[key];
4243
+ }
4011
4244
  });
4012
4245
  }
4013
4246
  }
@@ -4145,7 +4378,12 @@ export default class Meeting extends StatelessWebexPlugin {
4145
4378
  }
4146
4379
 
4147
4380
  /**
4148
- * Transfer the moderator role to another eligible member
4381
+ * Transfer the moderator role to another eligible member.
4382
+ *
4383
+ * If the target member is currently joined in the current session, the request is
4384
+ * sent against the current locus. Otherwise, we search the breakout sessions and,
4385
+ * when the member is found in one, we send the request against that breakout
4386
+ * session's locus url instead.
4149
4387
  * @param {String} memberId
4150
4388
  * @param {Boolean} moderator
4151
4389
  * @returns {Promise} see #members.transferHostToMember
@@ -4153,7 +4391,21 @@ export default class Meeting extends StatelessWebexPlugin {
4153
4391
  * @memberof Meeting
4154
4392
  */
4155
4393
  public transfer(memberId: string, moderator = true) {
4156
- return this.members.transferHostToMember(memberId, moderator);
4394
+ const targetMember = this.members.membersCollection.get(memberId);
4395
+
4396
+ if (targetMember?.isInMeeting) {
4397
+ return this.members.transferHostToMember(memberId, moderator);
4398
+ }
4399
+
4400
+ const breakout = this.breakouts?.breakouts?.models?.find((bo: any) => {
4401
+ const breakoutMember = bo.members?.membersCollection?.get(memberId);
4402
+
4403
+ return breakoutMember?.isInMeeting;
4404
+ });
4405
+
4406
+ const breakoutLocusUrl = breakout?.breakoutRosterLocus?.url;
4407
+
4408
+ return this.members.transferHostToMember(memberId, moderator, breakoutLocusUrl);
4157
4409
  }
4158
4410
 
4159
4411
  /**
@@ -4611,6 +4863,13 @@ export default class Meeting extends StatelessWebexPlugin {
4611
4863
  ),
4612
4864
  isAttendeeRequestAiAssistantDeclinedAll:
4613
4865
  MeetingUtil.attendeeRequestAiAssistantDeclinedAll(this.userDisplayHints),
4866
+ isAnonymizeDisplayNamesEnabled: MeetingUtil.isAnonymizeDisplayNamesEnabled(
4867
+ this.userDisplayHints
4868
+ ),
4869
+ canViewTheParticipantList: MeetingUtil.canViewTheParticipantList(
4870
+ this.userDisplayHints,
4871
+ this.canNotViewTheParticipantList ?? false
4872
+ ),
4614
4873
  }) || changed;
4615
4874
  }
4616
4875
  if (changed) {
@@ -4659,6 +4918,34 @@ export default class Meeting extends StatelessWebexPlugin {
4659
4918
  this.sipUri = sipUri;
4660
4919
  }
4661
4920
 
4921
+ /**
4922
+ * After initial locus setup, refreshes destination with synced locus data and optionally
4923
+ * performs deferred meeting info fetch when initial locus was incomplete.
4924
+ * @param {LocusDTO} locus
4925
+ * @returns {void}
4926
+ */
4927
+ public async finalizeMeetingAfterInitialLocusSetup(locus: LocusDTO): Promise<void> {
4928
+ if (locus && this?.destinationType === DESTINATION_TYPE.LOCUS_ID) {
4929
+ // destination is initialized from the initial locus snapshot in constructor,
4930
+ // so refresh it after locus sync to avoid stale partial hash-tree data.
4931
+ this.destination = locus;
4932
+ }
4933
+ if (
4934
+ (!this.meetingInfo || isEmpty(this.meetingInfo)) &&
4935
+ (this.destination as LocusDTO)?.info &&
4936
+ !this.fetchMeetingInfoTimeoutId &&
4937
+ !MeetingsUtil.isOneOnOneCall(locus)
4938
+ ) {
4939
+ try {
4940
+ await this.fetchMeetingInfo({});
4941
+ } catch (error: any) {
4942
+ LoggerProxy.logger.info(
4943
+ `Meeting:index#finalizeMeetingAfterInitialLocusSetup --> deferred fetchMeetingInfo failed: ${error.message}`
4944
+ );
4945
+ }
4946
+ }
4947
+ }
4948
+
4662
4949
  /**
4663
4950
  * Set the locus info the class instance. Should be called with the parsed locus
4664
4951
  * we got in the join response.
@@ -5130,8 +5417,7 @@ export default class Meeting extends StatelessWebexPlugin {
5130
5417
  public setMercuryListener() {
5131
5418
  // Client will have a socket manager and handle reconnecting to mercury, when we reconnect to mercury
5132
5419
  // if the meeting has active peer connections, it should try to reconnect.
5133
- // @ts-ignore
5134
- this.webex.internal.mercury.on(ONLINE, () => {
5420
+ this.mercuryOnlineHandler = () => {
5135
5421
  LoggerProxy.logger.info('Meeting:index#setMercuryListener --> Web socket online');
5136
5422
 
5137
5423
  // Only send restore event when it was disconnected before and for connected later
@@ -5141,15 +5427,47 @@ export default class Meeting extends StatelessWebexPlugin {
5141
5427
  });
5142
5428
  }
5143
5429
  this.hasWebsocketConnected = true;
5144
- });
5430
+ };
5145
5431
 
5146
- // @ts-ignore
5147
- this.webex.internal.mercury.on(OFFLINE, () => {
5432
+ this.mercuryOfflineHandler = () => {
5148
5433
  LoggerProxy.logger.error('Meeting:index#setMercuryListener --> Web socket offline');
5149
5434
  Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.MERCURY_CONNECTION_FAILURE, {
5150
5435
  correlation_id: this.correlationId,
5151
5436
  });
5152
- });
5437
+ };
5438
+
5439
+ // @ts-ignore
5440
+ this.webex.internal.mercury.on(ONLINE, this.mercuryOnlineHandler);
5441
+ // @ts-ignore
5442
+ this.webex.internal.mercury.on(OFFLINE, this.mercuryOfflineHandler);
5443
+ }
5444
+
5445
+ /**
5446
+ * Removes this meeting's Mercury ONLINE/OFFLINE event listeners registered
5447
+ * by setMercuryListener(). Must be called before Locus /leave to avoid
5448
+ * unnecessary syncs/metrics triggered by events received while leaving
5449
+ * (per Locus team recommendation).
5450
+ *
5451
+ * Mercury is a process-wide singleton shared with other plugins, so we
5452
+ * pass the bound handler refs to .off() to avoid clearing every listener
5453
+ * for ONLINE/OFFLINE on the shared emitter.
5454
+ *
5455
+ * Idempotent: subsequent calls are no-ops because the handler refs are
5456
+ * cleared after detaching.
5457
+ * @private
5458
+ * @returns {void}
5459
+ */
5460
+ private stopListeningForMercuryEvents() {
5461
+ if (this.mercuryOnlineHandler) {
5462
+ // @ts-ignore
5463
+ this.webex.internal.mercury.off(ONLINE, this.mercuryOnlineHandler);
5464
+ this.mercuryOnlineHandler = undefined;
5465
+ }
5466
+ if (this.mercuryOfflineHandler) {
5467
+ // @ts-ignore
5468
+ this.webex.internal.mercury.off(OFFLINE, this.mercuryOfflineHandler);
5469
+ this.mercuryOfflineHandler = undefined;
5470
+ }
5153
5471
  }
5154
5472
 
5155
5473
  /**
@@ -5173,9 +5491,14 @@ export default class Meeting extends StatelessWebexPlugin {
5173
5491
  );
5174
5492
 
5175
5493
  this.receiveSlotManager.reset();
5494
+
5495
+ // Unpublish/reset send slots while the connection is still open, so each slot's
5496
+ // internal "stop sending" negotiation (and its stream-listener detachment) completes
5497
+ // cleanly instead of racing the connection close below.
5498
+ this.sendSlotManager.reset();
5499
+
5176
5500
  this.mediaProperties.webrtcMediaConnection.close();
5177
5501
  this.mediaProperties.unsetPeerConnection();
5178
- this.sendSlotManager.reset();
5179
5502
  this.setNetworkStatus(undefined);
5180
5503
  }
5181
5504
 
@@ -5460,7 +5783,7 @@ export default class Meeting extends StatelessWebexPlugin {
5460
5783
  } = {}
5461
5784
  ) {
5462
5785
  const {mediaOptions, joinOptions = {}} = options;
5463
- const {isRetry, prevJoinResponse} = this.joinWithMediaRetryInfo;
5786
+ const {retryCount, prevJoinResponse, prevError} = this.joinWithMediaRetryInfo;
5464
5787
 
5465
5788
  if (!mediaOptions?.allowMediaInLobby) {
5466
5789
  return Promise.reject(
@@ -5471,9 +5794,6 @@ export default class Meeting extends StatelessWebexPlugin {
5471
5794
 
5472
5795
  LoggerProxy.logger.info('Meeting:index#joinWithMedia called');
5473
5796
 
5474
- let joined = false;
5475
- let joinResponse = prevJoinResponse;
5476
-
5477
5797
  /* Before we do anything, check if RTCPeerConnection is available. Normally this is checked
5478
5798
  by addMediaInternal() itself when creating the media connection, but since joinWithMedia()
5479
5799
  is a convenience method that does both join() and addMedia(), we want to fail fast here
@@ -5486,12 +5806,28 @@ export default class Meeting extends StatelessWebexPlugin {
5486
5806
  );
5487
5807
  }
5488
5808
 
5809
+ /* While we're trying to join, we may fail and be doing a retry. In that case,
5810
+ we sometimes get dropped by Locus as a result of the 1st failed attempt.
5811
+ That notification from Locus needs to be ignored, otherwise it causes the meeting to be
5812
+ cleaned up and prevents the retry from running correctly.
5813
+ */
5814
+ this.locusInfo.suspendDestroyMeeting(true);
5815
+
5816
+ let joined = false;
5817
+ let joinResponse = prevJoinResponse;
5818
+
5819
+ const shouldJoin =
5820
+ !joinResponse || // first try, when the join response is empty
5821
+ (prevError && prevError instanceof UserNotJoinedError) || // last try failed with UserNotJoinedError
5822
+ this.isErrorMeaningLocusDroppedUs(prevError) ||
5823
+ MeetingUtil.isUserInLeftState(this.locusInfo); // locus dropped the connection before we can re-try addMedia
5824
+
5489
5825
  try {
5490
5826
  let turnServerInfo;
5491
5827
  let turnDiscoverySkippedReason;
5492
5828
  let forceTurnDiscovery = false;
5493
5829
 
5494
- if (!joinResponse) {
5830
+ if (shouldJoin) {
5495
5831
  // This is the 1st attempt or a retry after join request failed -> we need to do a join with TURN discovery
5496
5832
 
5497
5833
  const turnDiscoveryRequest = await this.roap.generateTurnDiscoveryRequestMessage(
@@ -5530,16 +5866,24 @@ export default class Meeting extends StatelessWebexPlugin {
5530
5866
  joined = true;
5531
5867
  }
5532
5868
 
5869
+ const shouldRetryMediaWithOnlyTurnTLS = await this.shouldRetryMediaWithOnlyTurnTLS(prevError);
5870
+
5533
5871
  const mediaResponse = await this.addMediaInternal(
5534
5872
  () => {
5535
- return this.joinWithMediaRetryInfo.isRetry ? 'JOIN_MEETING_FINAL' : 'JOIN_MEETING_RETRY';
5873
+ // callback is not called when UserNotJoinedError is thrown
5874
+ return this.joinWithMediaRetryInfo.retryCount >= 1
5875
+ ? 'JOIN_MEETING_FINAL'
5876
+ : 'JOIN_MEETING_RETRY';
5536
5877
  },
5537
- turnServerInfo,
5538
5878
  forceTurnDiscovery,
5879
+ turnServerInfo,
5880
+ shouldRetryMediaWithOnlyTurnTLS ? 'relay' : undefined,
5539
5881
  mediaOptions
5540
5882
  );
5541
5883
 
5542
- this.joinWithMediaRetryInfo = {isRetry: false, prevJoinResponse: undefined};
5884
+ this.joinWithMediaRetryInfo = {retryCount: 0, prevJoinResponse: undefined};
5885
+
5886
+ this.locusInfo.suspendDestroyMeeting(false);
5543
5887
 
5544
5888
  return {
5545
5889
  join: joinResponse,
@@ -5553,15 +5897,21 @@ export default class Meeting extends StatelessWebexPlugin {
5553
5897
 
5554
5898
  this.roap.abortTurnDiscovery();
5555
5899
 
5556
- // if this was the first attempt, let's do a retry
5557
- let shouldRetry = !isRetry;
5900
+ // let's do a retry (but not on 1-1 calls, because the flow would get too complicated)
5901
+ let shouldRetry =
5902
+ !MeetingsUtil.isOneOnOneCall(this.locusInfo.parsedLocus) &&
5903
+ (retryCount < 1 ||
5904
+ ((error instanceof UserNotJoinedError || this.isErrorMeaningLocusDroppedUs(error)) &&
5905
+ retryCount < JOIN_WITH_MEDIA_RETRY_MAX_COUNT));
5558
5906
 
5559
5907
  if (
5560
5908
  CallDiagnosticUtils.isSdpOfferCreationError(error) ||
5561
- CallDiagnosticUtils.isWebrtcApiNotAvailableError(error)
5909
+ CallDiagnosticUtils.isWebrtcApiNotAvailableError(error) ||
5910
+ this.isLocusUserFullError(error)
5562
5911
  ) {
5563
5912
  // errors related to offer creation (for example missing H264 codec) will happen again no matter how many times we try,
5564
5913
  // so there is no point doing a retry
5914
+ // when the locus is full, we also don't want to retry, because it will just fail again
5565
5915
  shouldRetry = false;
5566
5916
  }
5567
5917
 
@@ -5579,8 +5929,8 @@ export default class Meeting extends StatelessWebexPlugin {
5579
5929
  });
5580
5930
  }
5581
5931
 
5582
- // we only want to call leave if join was successful and this was a retry or we won't be doing any more retries
5583
- if (joined && (isRetry || !shouldRetry)) {
5932
+ // we only want to call leave if join was successful, and we won't be doing any more retries
5933
+ if (joined && !shouldRetry) {
5584
5934
  try {
5585
5935
  await this.leave({resourceId: joinOptions?.resourceId, reason: 'joinWithMedia failure'});
5586
5936
  } catch (e) {
@@ -5597,7 +5947,7 @@ export default class Meeting extends StatelessWebexPlugin {
5597
5947
  reason: error.message,
5598
5948
  stack: error.stack,
5599
5949
  leaveErrorReason: leaveError?.message,
5600
- isRetry,
5950
+ isRetry: retryCount > 0,
5601
5951
  },
5602
5952
  {
5603
5953
  type: error.name,
@@ -5606,15 +5956,30 @@ export default class Meeting extends StatelessWebexPlugin {
5606
5956
 
5607
5957
  if (shouldRetry) {
5608
5958
  LoggerProxy.logger.warn('Meeting:index#joinWithMedia --> retrying call to joinWithMedia');
5609
- this.joinWithMediaRetryInfo.isRetry = true;
5959
+ this.joinWithMediaRetryInfo.retryCount = retryCount + 1;
5610
5960
  this.joinWithMediaRetryInfo.prevJoinResponse = joinResponse;
5961
+ this.joinWithMediaRetryInfo.prevError = error;
5962
+ if (!this.joinWithMediaRetryInfo.firstError) {
5963
+ this.joinWithMediaRetryInfo.firstError = error;
5964
+ }
5611
5965
 
5612
5966
  return this.joinWithMedia(options);
5613
5967
  }
5614
5968
 
5615
- this.joinWithMediaRetryInfo = {isRetry: false, prevJoinResponse: undefined};
5969
+ const {firstError} = this.joinWithMediaRetryInfo;
5616
5970
 
5617
- throw error;
5971
+ this.joinWithMediaRetryInfo = {
5972
+ retryCount: 0,
5973
+ prevJoinResponse: undefined,
5974
+ firstError: undefined,
5975
+ prevError: undefined,
5976
+ };
5977
+
5978
+ this.locusInfo.suspendDestroyMeeting(false);
5979
+
5980
+ // LOCUS_USER_FULL is a definitive capacity error the client must surface, so it takes
5981
+ // precedence over any earlier retryable error stored in firstError.
5982
+ throw this.isLocusUserFullError(error) ? error : firstError ?? error;
5618
5983
  }
5619
5984
  }
5620
5985
 
@@ -5719,8 +6084,7 @@ export default class Meeting extends StatelessWebexPlugin {
5719
6084
 
5720
6085
  try {
5721
6086
  const voiceaListenerCaptionUpdate = (payload) => {
5722
- // @ts-ignore
5723
- this.webex.internal.voicea.off(
6087
+ this.voiceaChannel?.off(
5724
6088
  VOICEAEVENTS.CAPTION_LANGUAGE_UPDATE,
5725
6089
  voiceaListenerCaptionUpdate
5726
6090
  );
@@ -5736,13 +6100,8 @@ export default class Meeting extends StatelessWebexPlugin {
5736
6100
  reject(payload);
5737
6101
  }
5738
6102
  };
5739
- // @ts-ignore
5740
- this.webex.internal.voicea.on(
5741
- VOICEAEVENTS.CAPTION_LANGUAGE_UPDATE,
5742
- voiceaListenerCaptionUpdate
5743
- );
5744
- // @ts-ignore
5745
- this.webex.internal.voicea.requestLanguage(language);
6103
+ this.voiceaChannel?.on(VOICEAEVENTS.CAPTION_LANGUAGE_UPDATE, voiceaListenerCaptionUpdate);
6104
+ this.voiceaChannel?.requestLanguage(language);
5746
6105
  } catch (error) {
5747
6106
  LoggerProxy.logger.error(`Meeting:index#setCaptionLanguage --> ${error}`);
5748
6107
 
@@ -5776,8 +6135,7 @@ export default class Meeting extends StatelessWebexPlugin {
5776
6135
 
5777
6136
  try {
5778
6137
  const voiceaListenerLanguageUpdate = (payload) => {
5779
- // @ts-ignore
5780
- this.webex.internal.voicea.off(
6138
+ this.voiceaChannel?.off(
5781
6139
  VOICEAEVENTS.SPOKEN_LANGUAGE_UPDATE,
5782
6140
  voiceaListenerLanguageUpdate
5783
6141
  );
@@ -5794,14 +6152,9 @@ export default class Meeting extends StatelessWebexPlugin {
5794
6152
  }
5795
6153
  };
5796
6154
 
5797
- // @ts-ignore
5798
- this.webex.internal.voicea.on(
5799
- VOICEAEVENTS.SPOKEN_LANGUAGE_UPDATE,
5800
- voiceaListenerLanguageUpdate
5801
- );
6155
+ this.voiceaChannel?.on(VOICEAEVENTS.SPOKEN_LANGUAGE_UPDATE, voiceaListenerLanguageUpdate);
5802
6156
 
5803
- // @ts-ignore
5804
- this.webex.internal.voicea.setSpokenLanguage(language);
6157
+ this.voiceaChannel?.setSpokenLanguage(language);
5805
6158
  } catch (error) {
5806
6159
  LoggerProxy.logger.error(`Meeting:index#setSpokenLanguage --> ${error}`);
5807
6160
 
@@ -5823,12 +6176,18 @@ export default class Meeting extends StatelessWebexPlugin {
5823
6176
  );
5824
6177
 
5825
6178
  try {
6179
+ if (!this.voiceaChannel) {
6180
+ LoggerProxy.logger.warn(
6181
+ 'Meeting:index#startTranscription --> voiceaChannel not available'
6182
+ );
6183
+
6184
+ return;
6185
+ }
6186
+
5826
6187
  if (!this.areVoiceaEventsSetup) {
5827
6188
  this.setUpVoiceaListeners();
5828
6189
  }
5829
-
5830
- // @ts-ignore
5831
- await this.webex.internal.voicea.turnOnCaptions(options?.spokenLanguage);
6190
+ await this.voiceaChannel.turnOnCaptions(options?.spokenLanguage);
5832
6191
  } catch (error) {
5833
6192
  LoggerProxy.logger.error(`Meeting:index#startTranscription --> ${error}`);
5834
6193
  Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.RECEIVE_TRANSCRIPTION_FAILURE, {
@@ -5845,6 +6204,22 @@ export default class Meeting extends StatelessWebexPlugin {
5845
6204
  }
5846
6205
  }
5847
6206
 
6207
+ /**
6208
+ * Starts transcription when requested by the current Locus controls and an
6209
+ * active LLM channel is ready.
6210
+ * @internal
6211
+ * @returns {void}
6212
+ */
6213
+ public startTranscriptionIfNeeded(): void {
6214
+ if (
6215
+ this.locusInfo.controls?.transcribe?.transcribing &&
6216
+ !this.areVoiceaEventsSetup &&
6217
+ this.voiceaChannel?.isLLMConnected()
6218
+ ) {
6219
+ this.startTranscription();
6220
+ }
6221
+ }
6222
+
5848
6223
  /** Handles Locus LLM events
5849
6224
  *
5850
6225
  * @param {LocusLLMEvent} event - The Locus LLM event to process
@@ -5857,7 +6232,18 @@ export default class Meeting extends StatelessWebexPlugin {
5857
6232
  storeEventForDebugging('llm', event.data);
5858
6233
  }
5859
6234
 
6235
+ const {trackingId} = event;
6236
+
5860
6237
  this.locusInfo.parse(this, event.data);
6238
+
6239
+ // Only the client whose /sync request tracking id matches the tracking id echoed back on this
6240
+ // LLM message should emit client.locus.sync.complete. The tracking id lives at the top level
6241
+ // of the received LLM event envelope. When it is absent there is nothing to correlate, so
6242
+ // skip. onLocusSyncLlmMessage records the LLM arrival time and is a no-op unless a stored
6243
+ // record for this meeting matches the tracking id.
6244
+ if (trackingId) {
6245
+ this.onLocusSyncLlmMessage(this.id, trackingId);
6246
+ }
5861
6247
  } else {
5862
6248
  LoggerProxy.logger.warn(
5863
6249
  `Meeting:index#processLocusLLMEvent --> Unknown event type: ${event.data.eventType}`
@@ -5866,17 +6252,50 @@ export default class Meeting extends StatelessWebexPlugin {
5866
6252
  };
5867
6253
 
5868
6254
  /**
5869
- * Callback called when a relay event is received from meeting LLM Connection
5870
- * @param {RelayEvent} e Event object coming from LLM Connection
5871
- * @private
5872
- * @returns {void}
6255
+ * Verifies the relay event was delivered for the active LLM session binding.
6256
+ * With the factory pattern, each meeting owns its channel, so we just verify
6257
+ * the route matches our channel's binding or the practice session binding.
6258
+ * @param {RelayEvent} event Event object coming from LLM Connection
6259
+ * @returns {boolean}
5873
6260
  */
5874
- private processRelayEvent = (e: RelayEvent): void => {
6261
+ private isRelayEventRouteValid(event: RelayEvent): boolean {
6262
+ const route = event?.headers?.route;
6263
+
6264
+ if (!route) {
6265
+ return true;
6266
+ }
6267
+
6268
+ // With the factory pattern, both channels may be connected simultaneously.
6269
+ // Determine which session is "active" based on whether PS channel is connected.
6270
+ const isPracticeSession = this.webinar?.isPracticeSessionLLMChannelConnected() ?? false;
6271
+
6272
+ const expectedBinding = isPracticeSession
6273
+ ? this.webinar?.getPracticeSessionBinding()
6274
+ : this.llmChannel?.getBinding();
6275
+
6276
+ if (!expectedBinding || route === expectedBinding) {
6277
+ return true;
6278
+ }
6279
+
6280
+ return false;
6281
+ }
6282
+
6283
+ /**
6284
+ * Callback called when a relay event is received from meeting LLM Connection
6285
+ * @param {RelayEvent} e Event object coming from LLM Connection
6286
+ * @private
6287
+ * @returns {void}
6288
+ */
6289
+ private processRelayEvent = (e: RelayEvent): void => {
6290
+ if (!this.isRelayEventRouteValid(e)) {
6291
+ return;
6292
+ }
5875
6293
  switch (e.data.relayType) {
5876
6294
  case REACTION_RELAY_TYPES.REACTION:
6295
+ // @ts-ignore - config coming from registerPlugin
5877
6296
  if (
5878
6297
  // @ts-ignore - config coming from registerPlugin
5879
- (this.config.receiveReactions || options.receiveReactions) &&
6298
+ this.config.receiveReactions &&
5880
6299
  this.isReactionsSupported()
5881
6300
  ) {
5882
6301
  const member = this.members.membersCollection.get(e.data.sender.participantId);
@@ -5917,32 +6336,27 @@ export default class Meeting extends StatelessWebexPlugin {
5917
6336
  * @returns {void}
5918
6337
  */
5919
6338
  stopTranscription() {
5920
- // @ts-ignore
5921
- this.webex.internal.voicea.off(
6339
+ this.voiceaChannel?.off(
5922
6340
  VOICEAEVENTS.VOICEA_ANNOUNCEMENT,
5923
6341
  this.voiceaListenerCallbacks[VOICEAEVENTS.VOICEA_ANNOUNCEMENT]
5924
6342
  );
5925
6343
 
5926
- // @ts-ignore
5927
- this.webex.internal.voicea.off(
6344
+ this.voiceaChannel?.off(
5928
6345
  VOICEAEVENTS.CAPTIONS_TURNED_ON,
5929
6346
  this.voiceaListenerCallbacks[VOICEAEVENTS.CAPTIONS_TURNED_ON]
5930
6347
  );
5931
6348
 
5932
- // @ts-ignore
5933
- this.webex.internal.voicea.off(
6349
+ this.voiceaChannel?.off(
5934
6350
  VOICEAEVENTS.EVA_COMMAND,
5935
6351
  this.voiceaListenerCallbacks[VOICEAEVENTS.EVA_COMMAND]
5936
6352
  );
5937
6353
 
5938
- // @ts-ignore
5939
- this.webex.internal.voicea.off(
6354
+ this.voiceaChannel?.off(
5940
6355
  VOICEAEVENTS.NEW_CAPTION,
5941
6356
  this.voiceaListenerCallbacks[VOICEAEVENTS.NEW_CAPTION]
5942
6357
  );
5943
6358
 
5944
- // @ts-ignore
5945
- this.webex.internal.voicea.deregisterEvents();
6359
+ this.voiceaChannel?.deregisterEvents();
5946
6360
 
5947
6361
  this.areVoiceaEventsSetup = false;
5948
6362
  this.triggerStopReceivingTranscriptionEvent();
@@ -5975,15 +6389,13 @@ export default class Meeting extends StatelessWebexPlugin {
5975
6389
  */
5976
6390
  private restoreLLMSubscriptionsIfNeeded(): void {
5977
6391
  try {
5978
- // @ts-ignore
5979
- const isCaptionBoxOn = this.webex.internal.voicea?.getIsCaptionBoxOn?.();
6392
+ const keepTranscriptionSubscribed = this.voiceaChannel?.getKeepTranscriptionSubscribed();
5980
6393
 
5981
- if (!isCaptionBoxOn) {
6394
+ if (!keepTranscriptionSubscribed) {
5982
6395
  return;
5983
6396
  }
5984
6397
 
5985
- // @ts-ignore
5986
- this.webex.internal.voicea.updateSubchannelSubscriptions({subscribe: ['transcription']});
6398
+ this.voiceaChannel?.updateSubchannelSubscriptions({subscribe: ['transcription']});
5987
6399
  } catch (error) {
5988
6400
  const msg = error?.message || String(error);
5989
6401
 
@@ -6002,6 +6414,7 @@ export default class Meeting extends StatelessWebexPlugin {
6002
6414
  */
6003
6415
  private handleLLMOnline = (): void => {
6004
6416
  this.restoreLLMSubscriptionsIfNeeded();
6417
+ this.locusInfo.syncAllHashTreeDatasets({onlyLLM: true});
6005
6418
 
6006
6419
  Trigger.trigger(
6007
6420
  this,
@@ -6233,11 +6646,7 @@ export default class Meeting extends StatelessWebexPlugin {
6233
6646
  this.saveDataChannelToken(join);
6234
6647
  // @ts-ignore - config coming from registerPlugin
6235
6648
  if (this.config.enableAutomaticLLM) {
6236
- // @ts-ignore
6237
- this.webex.internal.llm.off('online', this.handleLLMOnline);
6238
- // @ts-ignore
6239
- this.webex.internal.llm.on('online', this.handleLLMOnline);
6240
- this.updateLLMConnection()
6649
+ this.updateLLMConnection({isInitialJoinPhase: true})
6241
6650
  .catch((error) => {
6242
6651
  LoggerProxy.logger.error(
6243
6652
  'Meeting:index#join --> Transcription Socket Connection Failed',
@@ -6271,12 +6680,10 @@ export default class Meeting extends StatelessWebexPlugin {
6271
6680
  this.clearLLMHealthCheckTimer();
6272
6681
 
6273
6682
  this.llmHealthCheckTimer = setTimeout(() => {
6274
- // @ts-ignore
6275
- const isConnected = this.webex.internal.llm.isConnected();
6683
+ const isConnected = this.llmChannel?.isConnected() ?? false;
6276
6684
 
6277
6685
  if (!isConnected) {
6278
- // @ts-ignore
6279
- const {hasEverConnected} = this.webex.internal.llm;
6686
+ const hasEverConnected = this.llmChannel?.hasEverConnected ?? false;
6280
6687
 
6281
6688
  // only send metric if not connected - to avoid too many metrics
6282
6689
  Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.LLM_HEALTHCHECK_FAILURE, {
@@ -6302,28 +6709,88 @@ export default class Meeting extends StatelessWebexPlugin {
6302
6709
  }
6303
6710
 
6304
6711
  /**
6305
- * Disconnects and cleans up the default LLM session listeners/timers.
6712
+ * Removes LLM event listeners and clears the health check timer.
6713
+ * Must be called before Locus /leave to avoid unnecessary syncs triggered
6714
+ * by events received while leaving (per Locus team recommendation).
6715
+ * Idempotent: safe to call multiple times; .off() is a no-op when no
6716
+ * matching listener is registered.
6717
+ * @private
6718
+ * @returns {void}
6719
+ */
6720
+ private stopListeningForLLMEvents() {
6721
+ this.llmChannel?.off('event:relay.event', this.processRelayEvent);
6722
+ this.llmChannel?.off(LOCUS_LLM_EVENT, this.processLocusLLMEvent);
6723
+ this.llmChannel?.off('online', this.handleLLMOnline);
6724
+ this.breakouts?.unregisterLLMChannel();
6725
+ // voiceaChannel persists across LLM reconnects; switchLLMChannel() handles re-subscribing
6726
+ this.clearLLMHealthCheckTimer();
6727
+ }
6728
+
6729
+ /**
6730
+ * Stops listening on every event bus (LLM, Mercury, voicea/transcription,
6731
+ * annotation) that could otherwise deliver events to this meeting while
6732
+ * Locus is processing /leave or /end. Per the Locus team recommendation,
6733
+ * this must run before the Locus request is dispatched to avoid
6734
+ * unnecessary syncs triggered by in-flight events.
6735
+ *
6736
+ * Voicea (transcription) subscribes to llm 'event:relay.event' internally,
6737
+ * and the annotation plugin subscribes to both mercury and llm, so both
6738
+ * must be torn down alongside the direct LLM/Mercury listeners.
6739
+ *
6740
+ * Idempotent: safe to call multiple times; .off() is a no-op when no
6741
+ * matching listener is registered, and stopTranscription is guarded.
6742
+ * @private
6743
+ * @returns {void}
6744
+ */
6745
+ private stopListeningForMeetingEvents() {
6746
+ this.stopListeningForLLMEvents();
6747
+ this.stopListeningForMercuryEvents();
6748
+ if (this.areVoiceaEventsSetup) {
6749
+ this.stopTranscription();
6750
+ }
6751
+ // Reset to initial shape instead of null - transcription is always a valid object
6752
+ this.transcription = this.getInitialTranscription();
6753
+ this.annotation.deregisterEvents();
6754
+ }
6755
+
6756
+ /**
6757
+ * Disconnects and cleans up the LLM channel owned by this meeting.
6758
+ *
6306
6759
  * @param {Object} options
6307
- * @param {boolean} [options.removeOnlineListener=true] removes the one-time online listener
6308
6760
  * @param {boolean} [options.throwOnError=true] rethrows disconnect errors when true
6761
+ * @param {boolean} [options.preserveVoiceaChannel=false] when true, keeps voiceaChannel for switchLLMChannel() during reconnects
6309
6762
  * @returns {Promise<void>}
6310
6763
  */
6311
6764
  private cleanupLLMConneciton = async ({
6312
- removeOnlineListener = true,
6313
6765
  throwOnError = true,
6766
+ preserveVoiceaChannel = false,
6314
6767
  }: {
6315
- removeOnlineListener?: boolean;
6316
6768
  throwOnError?: boolean;
6769
+ preserveVoiceaChannel?: boolean;
6317
6770
  } = {}): Promise<void> => {
6771
+ // Always clear the timer, even if there's no channel
6772
+ this.clearLLMHealthCheckTimer();
6773
+
6774
+ // Permanent cleanup must deregister voiceaChannel regardless of LLM presence.
6775
+ // When a transient reconnect fails (LLM registration error), llmChannel is undefined
6776
+ // but voiceaChannel may still exist with listeners attached to the old emitter.
6777
+ if (!preserveVoiceaChannel) {
6778
+ this.voiceaChannel?.deregisterEvents();
6779
+ this.voiceaChannel = undefined;
6780
+ }
6781
+
6782
+ if (!this.llmChannel) {
6783
+ return;
6784
+ }
6785
+
6318
6786
  try {
6319
- // @ts-ignore - Fix type
6320
- await this.webex.internal.llm.disconnectLLM({
6787
+ await this.llmChannel.disconnect({
6321
6788
  code: 3050,
6322
6789
  reason: 'done (permanent)',
6323
6790
  });
6324
6791
  } catch (error) {
6325
6792
  LoggerProxy.logger.error(
6326
- 'Meeting:index#cleanupLLMConneciton --> Failed to disconnect default LLM session',
6793
+ 'Meeting:index#cleanupLLMConneciton --> Failed to disconnect LLM channel',
6327
6794
  error
6328
6795
  );
6329
6796
 
@@ -6331,32 +6798,25 @@ export default class Meeting extends StatelessWebexPlugin {
6331
6798
  throw error;
6332
6799
  }
6333
6800
  } finally {
6334
- if (removeOnlineListener) {
6335
- // @ts-ignore - Fix type
6336
- this.webex.internal.llm.off('online', this.handleLLMOnline);
6337
- }
6338
- // @ts-ignore - fix types
6339
- this.webex.internal.llm.off('event:relay.event', this.processRelayEvent);
6340
- // @ts-ignore - Fix type
6341
- this.webex.internal.llm.off(LOCUS_LLM_EVENT, this.processLocusLLMEvent);
6342
-
6343
- this.clearLLMHealthCheckTimer();
6801
+ this.stopListeningForLLMEvents();
6802
+ this.llmChannel = undefined;
6344
6803
  }
6345
6804
  };
6346
6805
 
6347
6806
  /**
6348
- * Clears all data channel tokens stored in LLM.
6349
- * Called during meeting cleanup to ensure stale tokens are not reused.
6807
+ * Sets the datachannel token on the meeting's LLM channel.
6808
+ * Used by the DataChannelAuthTokenInterceptor after refreshing tokens.
6809
+ * @param {string} token - The new datachannel token
6350
6810
  * @returns {void}
6351
6811
  */
6352
- clearDataChannelToken(): void {
6353
- // @ts-ignore
6354
- this.webex.internal.llm.resetDatachannelTokens();
6812
+ setLLMChannelDataToken(token: string): void {
6813
+ this.llmChannel?.setDatachannelToken(token);
6355
6814
  }
6356
6815
 
6357
6816
  /**
6358
- * Saves the data channel tokens from the join response into LLM so that
6359
- * updateLLMConnection / updatePSDataChannel don't need to fetch them from locusInfo.
6817
+ * Saves the data channel tokens from the join response.
6818
+ * Default session token is stored on this.llmChannel when available.
6819
+ * Practice session token is stored on the webinar's practice LLM channel.
6360
6820
  * @param {Object} join - The parsed join response (from MeetingUtil.parseLocusJoin)
6361
6821
  * @returns {void}
6362
6822
  */
@@ -6364,17 +6824,19 @@ export default class Meeting extends StatelessWebexPlugin {
6364
6824
  const datachannelToken = join?.locus?.self?.datachannelToken;
6365
6825
  const practiceSessionDatachannelToken = join?.locus?.self?.practiceSessionDatachannelToken;
6366
6826
 
6827
+ // Store default session token on our LLM channel if it exists
6828
+ if (datachannelToken && this.llmChannel) {
6829
+ this.llmChannel.setDatachannelToken(datachannelToken);
6830
+ }
6831
+
6832
+ // Store the token temporarily for use when channel is created
6367
6833
  if (datachannelToken) {
6368
- // @ts-ignore
6369
- this.webex.internal.llm.setDatachannelToken(datachannelToken, DataChannelTokenType.Default);
6834
+ this._pendingDatachannelToken = datachannelToken;
6370
6835
  }
6371
6836
 
6837
+ // Practice session token is handled by webinar
6372
6838
  if (practiceSessionDatachannelToken) {
6373
- // @ts-ignore
6374
- this.webex.internal.llm.setDatachannelToken(
6375
- practiceSessionDatachannelToken,
6376
- DataChannelTokenType.PracticeSession
6377
- );
6839
+ this.webinar.setPracticeSessionDatachannelToken(practiceSessionDatachannelToken);
6378
6840
  }
6379
6841
  }
6380
6842
 
@@ -6385,8 +6847,8 @@ export default class Meeting extends StatelessWebexPlugin {
6385
6847
  */
6386
6848
  private async ensureDefaultDatachannelTokenAfterAdmit(): Promise<boolean> {
6387
6849
  try {
6388
- // @ts-ignore
6389
- const datachannelToken = this.webex.internal.llm.getDatachannelToken();
6850
+ const datachannelToken =
6851
+ this.llmChannel?.getDatachannelToken() ?? this._pendingDatachannelToken;
6390
6852
  // @ts-ignore
6391
6853
  const isDataChannelTokenEnabled = await this.webex.internal.llm.isDataChannelTokenEnabled();
6392
6854
 
@@ -6405,11 +6867,12 @@ export default class Meeting extends StatelessWebexPlugin {
6405
6867
  return false;
6406
6868
  }
6407
6869
 
6408
- // @ts-ignore
6409
- this.webex.internal.llm.setDatachannelToken(
6410
- fetchedDatachannelToken,
6411
- DataChannelTokenType.Default
6412
- );
6870
+ // Store on channel if exists, otherwise save as pending
6871
+ if (this.llmChannel) {
6872
+ this.llmChannel.setDatachannelToken(fetchedDatachannelToken);
6873
+ } else {
6874
+ this._pendingDatachannelToken = fetchedDatachannelToken;
6875
+ }
6413
6876
 
6414
6877
  return true;
6415
6878
  } catch (error) {
@@ -6427,61 +6890,229 @@ export default class Meeting extends StatelessWebexPlugin {
6427
6890
  /**
6428
6891
  * Connects to low latency mercury and reconnects if the address has changed
6429
6892
  * It will also disconnect if called when the meeting has ended
6893
+ * @param {Object} [options]
6894
+ * @param {boolean} [options.isInitialJoinPhase] true when called from initial join flow
6430
6895
  * @returns {Promise}
6431
6896
  */
6432
- async updateLLMConnection() {
6897
+ async updateLLMConnection({isInitialJoinPhase = false}: {isInitialJoinPhase?: boolean} = {}) {
6433
6898
  // @ts-ignore - Fix type
6434
6899
  const {url = undefined, info: {datachannelUrl = undefined} = {}} = this.locusInfo || {};
6435
6900
 
6436
6901
  const isJoined = this.isJoined();
6902
+ const dataChannelUrl = datachannelUrl;
6437
6903
 
6438
- // @ts-ignore
6439
- const datachannelToken = this.webex.internal.llm.getDatachannelToken(
6440
- DataChannelTokenType.Default
6441
- );
6904
+ // If we have an existing channel, check if we should reuse it or clean it up
6905
+ if (this.llmChannel) {
6906
+ const isSameUrls =
6907
+ url === this.llmChannel.getLocusUrl() &&
6908
+ dataChannelUrl === this.llmChannel.getDatachannelUrl();
6442
6909
 
6443
- const dataChannelUrl = datachannelUrl;
6910
+ // If already connected to same URLs, skip reconnect
6911
+ if (this.llmChannel.isConnected() && isSameUrls && isJoined) {
6912
+ return undefined;
6913
+ }
6444
6914
 
6445
- // @ts-ignore - Fix type
6446
- if (this.webex.internal.llm.isConnected()) {
6447
- if (
6448
- // @ts-ignore - Fix type
6449
- url === this.webex.internal.llm.getLocusUrl() &&
6450
- // @ts-ignore - Fix type
6451
- dataChannelUrl === this.webex.internal.llm.getDatachannelUrl() &&
6452
- isJoined
6453
- ) {
6915
+ // If currently connecting to same URLs, wait for that to complete
6916
+ if (this.llmChannel.isConnecting() && isSameUrls && isJoined) {
6454
6917
  return undefined;
6455
6918
  }
6456
- await this.cleanupLLMConneciton({removeOnlineListener: false});
6919
+
6920
+ // URLs changed or not joined, disconnect existing channel
6921
+ await this.cleanupLLMConneciton({preserveVoiceaChannel: true});
6457
6922
  }
6458
6923
 
6459
- if (!isJoined) {
6924
+ if (!isJoined || !url || !dataChannelUrl) {
6925
+ // Either not joined, or locusInfo hasn't synced url/datachannelUrl yet
6926
+ // (SELF_UNADMITTED_GUEST/SELF_ADMITTED_GUEST can fire before datachannelUrl is
6927
+ // populated on rejoin). Any stale channel was already disconnected above; don't
6928
+ // create/register a new one with an empty URL. handleDataChannelUrlChange() will
6929
+ // re-invoke this once MEETING_INFO_UPDATED delivers the real datachannelUrl.
6460
6930
  return undefined;
6461
6931
  }
6462
6932
 
6933
+ // Create a new LLM channel for this meeting
6463
6934
  // @ts-ignore - Fix type
6464
- return this.webex.internal.llm
6935
+ this.llmChannel = this.webex.internal.llm.createChannel();
6936
+
6937
+ // Get token from pending (saved from join response) or channel
6938
+ const datachannelToken = this._pendingDatachannelToken ?? this.llmChannel.getDatachannelToken();
6939
+
6940
+ // Set up refresh handler before registration so interceptor-triggered token
6941
+ // refresh during register POST can resolve a valid handler.
6942
+ this.llmChannel.setRefreshHandler(() => this.refreshDataChannelToken());
6943
+
6944
+ // If we have a pending token, store it on the channel
6945
+ if (this._pendingDatachannelToken) {
6946
+ this.llmChannel.setDatachannelToken(this._pendingDatachannelToken);
6947
+ this._pendingDatachannelToken = undefined;
6948
+ }
6949
+
6950
+ return this.llmChannel
6465
6951
  .registerAndConnect(url, dataChannelUrl, datachannelToken)
6466
6952
  .then((registerAndConnectResult) => {
6467
- // @ts-ignore - Fix type
6468
- this.webex.internal.llm.off('event:relay.event', this.processRelayEvent);
6469
- // @ts-ignore - Fix type
6470
- this.webex.internal.llm.on('event:relay.event', this.processRelayEvent);
6471
- // @ts-ignore - Fix type
6472
- this.webex.internal.llm.off(LOCUS_LLM_EVENT, this.processLocusLLMEvent);
6473
- // @ts-ignore - Fix type
6474
- this.webex.internal.llm.on(LOCUS_LLM_EVENT, this.processLocusLLMEvent);
6953
+ this.locusInfo.syncAllHashTreeDatasets({onlyLLM: true});
6954
+
6955
+ // Register event listeners on the channel
6956
+ this.llmChannel.off('event:relay.event', this.processRelayEvent);
6957
+ this.llmChannel.on('event:relay.event', this.processRelayEvent);
6958
+ this.llmChannel.off(LOCUS_LLM_EVENT, this.processLocusLLMEvent);
6959
+ this.llmChannel.on(LOCUS_LLM_EVENT, this.processLocusLLMEvent);
6960
+ this.llmChannel.off('online', this.handleLLMOnline);
6961
+ this.llmChannel.on('online', this.handleLLMOnline);
6962
+
6963
+ // Register annotation channel only if not in practice session
6964
+ // (practice session manages its own annotation channel via updatePSDataChannel)
6965
+ if (!this.webinar?.isJoinPracticeSessionDataChannel()) {
6966
+ this.annotation.registerChannel(this.llmChannel);
6967
+ }
6968
+
6969
+ // Register breakouts channel
6970
+ this.breakouts.registerLLMChannel(this.llmChannel);
6971
+
6475
6972
  LoggerProxy.logger.info(
6476
6973
  'Meeting:index#updateLLMConnection --> enabled to receive relay events!'
6477
6974
  );
6478
-
6479
6975
  this.startLLMHealthCheckTimer();
6480
6976
 
6977
+ // Switch voiceaChannel to use the new LLM channel (preserves transcription state).
6978
+ // Skip if practice session is active - practice session manages its own voicea binding
6979
+ // via updatePSDataChannel, and switching here would break practice session captions.
6980
+ const isPracticeSessionActive =
6981
+ this.webinar?.isPracticeSessionLLMChannelConnected() ?? false;
6982
+
6983
+ if (!this.voiceaChannel) {
6984
+ // @ts-ignore - Fix type
6985
+ this.voiceaChannel = this.webex.internal.voicea.createChannel();
6986
+ }
6987
+
6988
+ if (!isPracticeSessionActive) {
6989
+ // Fire-and-forget: caption restoration shouldn't block LLM connection result.
6990
+ // transcription is always initialized (reset to initial shape, never null),
6991
+ // so no re-init needed here.
6992
+ this.voiceaChannel
6993
+ .switchLLMChannel(this.llmChannel)
6994
+ .then(() => {
6995
+ this.startTranscriptionIfNeeded();
6996
+ })
6997
+ .catch((error) => {
6998
+ LoggerProxy.logger.warn(
6999
+ 'Meeting:index#updateLLMConnection --> failed to switch voicea channel:',
7000
+ error
7001
+ );
7002
+ });
7003
+ }
7004
+
7005
+ if (registerAndConnectResult) {
7006
+ if (isInitialJoinPhase) {
7007
+ this.sendLLMConnectMetric(registerAndConnectResult);
7008
+ }
7009
+
7010
+ this.breakouts?.trigger(BREAKOUTS.EVENTS.LLM_CONNECT_RESPONSE, {
7011
+ meeting: this,
7012
+ llmLatency: registerAndConnectResult,
7013
+ });
7014
+ }
7015
+
6481
7016
  return Promise.resolve(registerAndConnectResult);
7017
+ })
7018
+ .catch((error) => {
7019
+ // Prefer the partial timing registerAndConnect attaches when register succeeded but the
7020
+ // websocket connect() failed, so a ws failure isn't misreported as register never completing.
7021
+ const llmLatency = {
7022
+ clientLLMDatachannelResponseTime: error?.timing?.clientLLMDatachannelResponseTime ?? 0,
7023
+ clientLLMWebSocketConnectTime: 0,
7024
+ };
7025
+
7026
+ if (isInitialJoinPhase) {
7027
+ this.sendLLMConnectMetric(llmLatency, error);
7028
+ }
7029
+
7030
+ this.breakouts?.trigger(BREAKOUTS.EVENTS.LLM_CONNECT_RESPONSE, {
7031
+ meeting: this,
7032
+ llmLatency,
7033
+ error,
7034
+ });
7035
+
7036
+ // Clean up the channel on failure
7037
+ this.llmChannel = undefined;
7038
+
7039
+ return Promise.reject(error);
6482
7040
  });
6483
7041
  }
6484
7042
 
7043
+ /**
7044
+ * Ensures breakout join response metric with LLM latency is emitted only once per breakout move id.
7045
+ * @param {string | undefined} breakoutMoveId
7046
+ * @param {boolean} [hasLLMLatency=false]
7047
+ * @returns {boolean}
7048
+ */
7049
+ private shouldEmitBreakoutJoinResponseMetric(
7050
+ breakoutMoveId?: string,
7051
+ hasLLMLatency = false
7052
+ ): boolean {
7053
+ if (!breakoutMoveId) {
7054
+ return false;
7055
+ }
7056
+
7057
+ if (!hasLLMLatency) {
7058
+ // When automatic LLM is enabled, updateLLMConnection will emit this same breakout join
7059
+ // response after the LLM connection finishes, including llmLatency and llmWebsocketUrl.
7060
+ // Suppress the earlier non-LLM event to avoid sending two events for the same move id,
7061
+ // where the first one would be missing the LLM-specific fields we want to validate.
7062
+ // @ts-ignore - config coming from registerPlugin
7063
+ return !this.config.enableAutomaticLLM;
7064
+ }
7065
+
7066
+ if (this.emittedBreakoutJoinResponseMoveIds.has(breakoutMoveId)) {
7067
+ return false;
7068
+ }
7069
+
7070
+ this.emittedBreakoutJoinResponseMoveIds.add(breakoutMoveId);
7071
+
7072
+ return true;
7073
+ }
7074
+
7075
+ /**
7076
+ * Sends LLM connect latencies for initial join flow.
7077
+ * @param {RegisterAndConnectTiming} timings
7078
+ * @param {any} [error]
7079
+ * @returns {void}
7080
+ */
7081
+ private sendLLMConnectMetric(timings: RegisterAndConnectTiming, error?: any) {
7082
+ // @ts-ignore
7083
+ const llmWebsocketUrl = this.webex.internal.llm.getWebSocketUrl?.() || undefined;
7084
+ const {clientLLMDatachannelResponseTime = 0, clientLLMWebSocketConnectTime} = timings || {};
7085
+
7086
+ const llmLatency: any = {
7087
+ clientLLMDatachannelResponseTime,
7088
+ };
7089
+
7090
+ if (clientLLMWebSocketConnectTime !== undefined) {
7091
+ llmLatency.clientLLMWebSocketConnectTime = clientLLMWebSocketConnectTime;
7092
+ }
7093
+
7094
+ const payload: any = {
7095
+ identifiers: {
7096
+ llmWebsocketUrl,
7097
+ },
7098
+ llmLatency,
7099
+ };
7100
+
7101
+ const options: any = {
7102
+ meetingId: this.id,
7103
+ ...(error && {rawError: error}),
7104
+ };
7105
+
7106
+ const metricEvent = {
7107
+ name: 'client.llm.connect.response',
7108
+ payload,
7109
+ options,
7110
+ };
7111
+
7112
+ // @ts-ignore
7113
+ this.webex.internal.newMetrics.submitClientEvent(metricEvent);
7114
+ }
7115
+
6485
7116
  /**
6486
7117
  * Use phone for meeting audio
6487
7118
  * @param {String} phoneNumber If provided, it will dial-out using this number. If not provided, dial-in will be used
@@ -6909,16 +7540,32 @@ export default class Meeting extends StatelessWebexPlugin {
6909
7540
  // @ts-ignore
6910
7541
  const cdl = this.webex.internal.newMetrics.callDiagnosticLatencies;
6911
7542
 
7543
+ // Compute the offer->answer latency from when the local SDP offer was generated up to now,
7544
+ // rather than from the stored remote-sdp-received timestamp. That stored timestamp uses
7545
+ // saveFirstTimestampOnly, so if waitForRemoteSDPAnswer() already timed out and submitted a
7546
+ // remote-sdp-received event, the stored value would be pinned to the timeout time and would
7547
+ // under-report an answer that arrives late. This handler fires exactly when the answer is
7548
+ // processed, so Date.now() is the accurate "received" time.
7549
+ // (submitClientEvent below still records the remote-sdp-received timestamp used by the CA
7550
+ // join-time metric, so we don't need to save it here.)
7551
+ const localSdpGeneratedTimestamp = cdl.latencyTimestamps.get(
7552
+ 'client.media-engine.local-sdp-generated'
7553
+ );
7554
+ const localSDPGenRemoteSDPRecv =
7555
+ localSdpGeneratedTimestamp !== undefined
7556
+ ? Date.now() - localSdpGeneratedTimestamp
7557
+ : undefined;
7558
+
6912
7559
  // @ts-ignore
6913
7560
  this.webex.internal.newMetrics.submitClientEvent({
6914
7561
  name: 'client.media-engine.remote-sdp-received',
7562
+ payload: {
7563
+ eventData: {
7564
+ localSDPGenRemoteSDPRecv,
7565
+ },
7566
+ },
6915
7567
  options: {meetingId: this.id},
6916
7568
  });
6917
- Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.ROAP_OFFER_TO_ANSWER_LATENCY, {
6918
- correlation_id: this.correlationId,
6919
- latency: cdl.getLocalSDPGenRemoteSDPRecv(),
6920
- meetingId: this.id,
6921
- });
6922
7569
 
6923
7570
  if (this.deferSDPAnswer) {
6924
7571
  this.deferSDPAnswer.resolve();
@@ -7504,23 +8151,108 @@ export default class Meeting extends StatelessWebexPlugin {
7504
8151
  }
7505
8152
  }
7506
8153
  });
8154
+ this.statsAnalyzer.on(StatsAnalyzerEventNames.STATS_UPDATE, (data) => {
8155
+ // Extract srtpCipher from transport stats
8156
+ let srtpCipher: string | undefined;
8157
+ for (const stats of data.stats.values()) {
8158
+ if (stats.type === 'transport' && stats.srtpCipher) {
8159
+ srtpCipher = stats.srtpCipher as string;
8160
+ break;
8161
+ }
8162
+ }
8163
+
8164
+ // Only emit event if srtpCipher has changed
8165
+ if (srtpCipher && srtpCipher !== this.mediaProperties.srtpCipher) {
8166
+ LoggerProxy.logger.info(
8167
+ `Meeting:index#setupStatsAnalyzerEventHandlers --> SRTP cipher changed from ${this.mediaProperties.srtpCipher} to ${srtpCipher}`
8168
+ );
8169
+ this.mediaProperties.srtpCipher = srtpCipher;
8170
+ Trigger.trigger(
8171
+ this,
8172
+ {
8173
+ file: 'meeting/index',
8174
+ function: 'setupStatsAnalyzerEventHandlers',
8175
+ },
8176
+ EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
8177
+ {srtpCipher}
8178
+ );
8179
+ }
8180
+ });
7507
8181
  };
7508
8182
 
7509
8183
  getMediaConnectionDebugId() {
7510
8184
  return `MC-${this.id.substring(0, 4)}`;
7511
8185
  }
7512
8186
 
8187
+ /**
8188
+ * Checks if the error indicates that Locus dropped us from the meeting,
8189
+ * either directly on the error or wrapped inside an AddMediaFailed cause.
8190
+ * This method is meant to be called only with errors thrown by Meeting.addMediaInternal()
8191
+ *
8192
+ * @param {Error} error
8193
+ * @returns {boolean}
8194
+ */
8195
+ private isErrorMeaningLocusDroppedUs(error: Error | undefined): boolean {
8196
+ const statusCode = (error as any)?.statusCode;
8197
+ const causeStatusCode = (error as any)?.cause?.statusCode;
8198
+
8199
+ return (
8200
+ statusCode === 409 || statusCode === 403 || causeStatusCode === 409 || causeStatusCode === 403
8201
+ );
8202
+ }
8203
+
8204
+ private isLocusUserFullError(error: Error | undefined): boolean {
8205
+ return (error as any)?.error?.body?.errorCode === LocusErrorCodes.LOCUS_USER_FULL;
8206
+ }
8207
+
8208
+ /**
8209
+ * Determines if the next media attempt should use only TURN-TLS (iceTransportPolicy='relay').
8210
+ * We do this in the hope that it will minimize the chance of Homer sending DTLS packets on a wrong
8211
+ * transport (as there will be only 1 transport) and dealing with firewalls that let STUN packets through, but block
8212
+ * other UDP traffic.
8213
+ *
8214
+ * For clients landing on video mesh nodes (VMN), reachability might still have successful TLS (to public nodes)
8215
+ * but TURN discovery will result in empty TURN urls array and iceTransportPolicy='relay' will still be overriden to undefined,
8216
+ * see the code in establishMediaConnection()
8217
+ *
8218
+ * @param {Error} prevError - The error from the previous addMedia attempt
8219
+ * @returns {Promise<boolean>}
8220
+ */
8221
+ private async shouldRetryMediaWithOnlyTurnTLS(prevError: Error | undefined): Promise<boolean> {
8222
+ if (
8223
+ this.isMultistream &&
8224
+ prevError instanceof AddMediaFailed &&
8225
+ prevError.isDtlsHandshakeFailure &&
8226
+ prevError.connectionType === 'UDP'
8227
+ ) {
8228
+ const hasTlsReachability =
8229
+ // @ts-ignore
8230
+ await this.webex.meetings.reachability.isAnyClusterReachableViaProtocol('xtls');
8231
+
8232
+ if (hasTlsReachability) {
8233
+ LoggerProxy.logger.info(
8234
+ 'Meeting:index#shouldRetryMediaWithOnlyTurnTLS --> previous attempt failed due to DTLS handshake failure over UDP and TLS reachability is available'
8235
+ );
8236
+
8237
+ return true;
8238
+ }
8239
+ }
8240
+
8241
+ return false;
8242
+ }
8243
+
7513
8244
  /**
7514
8245
  * Creates a webrtc media connection and publishes streams to it
7515
8246
  *
7516
8247
  * @param {Object} turnServerInfo TURN server information
7517
8248
  * @param {BundlePolicy} [bundlePolicy] Bundle policy settings
7518
- * @param {AddMediaOptions} [options] Options for enabling/disabling audio/video
8249
+ * @param {RTCIceTransportPolicy} [iceTransportPolicy] ICE transport policy override
7519
8250
  * @returns {RoapMediaConnection | MultistreamRoapMediaConnection}
7520
8251
  */
7521
8252
  private async createMediaConnection(
7522
8253
  turnServerInfo?: TurnServerInfo,
7523
- bundlePolicy?: BundlePolicy
8254
+ bundlePolicy?: BundlePolicy,
8255
+ iceTransportPolicy?: RTCIceTransportPolicy
7524
8256
  ) {
7525
8257
  this.rtcMetrics = this.isMultistream
7526
8258
  ? // @ts-ignore
@@ -7544,12 +8276,15 @@ export default class Meeting extends StatelessWebexPlugin {
7544
8276
  enableExtmap: this.config.enableExtmap,
7545
8277
  turnServerInfo,
7546
8278
  bundlePolicy,
8279
+ iceTransportPolicy,
7547
8280
  // @ts-ignore - config coming from registerPlugin
7548
8281
  iceCandidatesTimeout: this.config.iceCandidatesGatheringTimeout,
7549
8282
  // @ts-ignore - config coming from registerPlugin
7550
8283
  disableAudioMainDtx: this.config.experimental.disableAudioMainDtx,
7551
8284
  // @ts-ignore - config coming from registerPlugin
7552
8285
  enableAudioTwcc: this.config.enableAudioTwccForMultistream,
8286
+ // @ts-ignore - config coming from registerPlugin
8287
+ enableAv1SlidesSupport: this.config.enableAv1SlidesSupport,
7553
8288
  stopIceGatheringAfterFirstRelayCandidate:
7554
8289
  // @ts-ignore - config coming from registerPlugin
7555
8290
  this.config.stopIceGatheringAfterFirstRelayCandidate,
@@ -7569,6 +8304,7 @@ export default class Meeting extends StatelessWebexPlugin {
7569
8304
  this.mediaProperties.mediaDirection.receiveShare,
7570
8305
  ];
7571
8306
 
8307
+ this.sendSlotManager.reset();
7572
8308
  this.sendSlotManager.createSlot(mc, MediaType.VideoMain, videoEnabled);
7573
8309
  this.sendSlotManager.createSlot(mc, MediaType.AudioMain, audioEnabled);
7574
8310
  this.sendSlotManager.createSlot(mc, MediaType.VideoSlides, shareEnabled);
@@ -7668,7 +8404,7 @@ export default class Meeting extends StatelessWebexPlugin {
7668
8404
  try {
7669
8405
  await this.mediaProperties.waitForMediaConnectionConnected(this.correlationId);
7670
8406
  } catch (error) {
7671
- const {iceConnected} = error;
8407
+ const {iceConnected} = error as MediaConnectionAwaiterFailureResult;
7672
8408
 
7673
8409
  if (!this.hasMediaConnectionConnectedAtLeastOnce) {
7674
8410
  // Only send CA event for join flow if we haven't successfully connected media yet
@@ -7708,13 +8444,12 @@ export default class Meeting extends StatelessWebexPlugin {
7708
8444
  });
7709
8445
  }
7710
8446
 
7711
- const timedOutError = new Error(
7712
- `Timed out waiting for media connection to be connected, correlationId=${this.correlationId}`
8447
+ throw new MediaConnectionTimedOutError(
8448
+ `Timed out waiting for media connection to be connected, correlationId=${this.correlationId}`,
8449
+ iceConnected,
8450
+ // keep reference to the original rejected result (which is the object the SDK reports to CA as rawError above)
8451
+ error
7713
8452
  );
7714
-
7715
- timedOutError.cause = error;
7716
-
7717
- throw timedOutError;
7718
8453
  }
7719
8454
  }
7720
8455
 
@@ -7760,12 +8495,12 @@ export default class Meeting extends StatelessWebexPlugin {
7760
8495
  return !member.isSelf && !member.isPairedWithSelf && !member.isAudioMuted;
7761
8496
  });
7762
8497
 
7763
- if (atLeastOneUnmutedOtherMember) {
7764
- this.mediaProperties.sendMediaIssueMetric(
7765
- 'inbound_audio',
7766
- data.issueSubType,
7767
- this.correlationId
7768
- );
8498
+ // we also ignore any issues while we're waiting in the lobby, as we're not receiving any audio yet
8499
+ if (atLeastOneUnmutedOtherMember && !this.isUserUnadmitted) {
8500
+ this.mediaProperties.sendMediaIssueMetric('inbound_audio', data.issueSubType, {
8501
+ correlationId: this.correlationId,
8502
+ isMultistream: this.isMultistream,
8503
+ });
7769
8504
 
7770
8505
  Trigger.trigger(
7771
8506
  this,
@@ -7927,7 +8662,20 @@ export default class Meeting extends StatelessWebexPlugin {
7927
8662
  error
7928
8663
  );
7929
8664
 
7930
- throw new AddMediaFailed(error);
8665
+ const {connectionType, selectedCandidatePairChanges, numTransports} =
8666
+ await this.mediaProperties.getCurrentConnectionInfo();
8667
+
8668
+ const iceConnected = error instanceof MediaConnectionTimedOutError && error.iceConnected;
8669
+
8670
+ throw new AddMediaFailed({
8671
+ cause: error,
8672
+ connectionType,
8673
+ selectedCandidatePairChanges,
8674
+ numTransports,
8675
+ iceConnected,
8676
+ iceConnectedAtLeastOnce:
8677
+ error instanceof MediaConnectionTimedOutError ? error.iceConnectedAtLeastOnce : undefined,
8678
+ });
7931
8679
  }
7932
8680
  }
7933
8681
 
@@ -8002,7 +8750,21 @@ export default class Meeting extends StatelessWebexPlugin {
8002
8750
  ({turnServerInfo} = await this.doTurnDiscovery(isReconnecting, isForced));
8003
8751
  }
8004
8752
 
8005
- const mc = await this.createMediaConnection(turnServerInfo, bundlePolicy);
8753
+ if (
8754
+ (!turnServerInfo || !turnServerInfo.urls?.length) &&
8755
+ this.addMediaData.iceTransportPolicy === 'relay'
8756
+ ) {
8757
+ LoggerProxy.logger.info(
8758
+ `${LOG_HEADER} cannot do iceTransportPolicy=relay, because there is no turn server info available`
8759
+ );
8760
+ // drop the forced relay policy and use the default, because we don't have a TURN server
8761
+ this.addMediaData.iceTransportPolicy = undefined;
8762
+ }
8763
+ const mediaConnection = await this.createMediaConnection(
8764
+ turnServerInfo,
8765
+ bundlePolicy,
8766
+ this.addMediaData.iceTransportPolicy
8767
+ );
8006
8768
 
8007
8769
  LoggerProxy.logger.info(
8008
8770
  `${LOG_HEADER} media connection created this.isMultistream=${this.isMultistream}`
@@ -8039,7 +8801,7 @@ export default class Meeting extends StatelessWebexPlugin {
8039
8801
  await this.remoteMediaManager.start();
8040
8802
  }
8041
8803
 
8042
- await mc.initiateOffer();
8804
+ await mediaConnection.initiateOffer();
8043
8805
 
8044
8806
  await this.waitForRemoteSDPAnswer();
8045
8807
 
@@ -8107,6 +8869,9 @@ export default class Meeting extends StatelessWebexPlugin {
8107
8869
 
8108
8870
  this.isMultistream = false;
8109
8871
 
8872
+ // reset iceTransportPolicy, because it's only applied for multistream media connections
8873
+ this.addMediaData.iceTransportPolicy = undefined;
8874
+
8110
8875
  if (this.mediaProperties.webrtcMediaConnection) {
8111
8876
  // close peer connection, but don't reset mute state information, because we will want to use it on the retry
8112
8877
  this.closePeerConnections(false);
@@ -8187,6 +8952,8 @@ export default class Meeting extends StatelessWebexPlugin {
8187
8952
  regionCode: this.webex.meetings.geoHintInfo?.regionCode,
8188
8953
  },
8189
8954
  preferTranscoding: !this.isMultistream,
8955
+ getCurrentSelfUrl: () => this.selfUrl,
8956
+ waitForSelfUrlChange: () => this.waitForSelfUrlChange(),
8190
8957
  },
8191
8958
  {
8192
8959
  // @ts-ignore
@@ -8195,6 +8962,41 @@ export default class Meeting extends StatelessWebexPlugin {
8195
8962
  );
8196
8963
  }
8197
8964
 
8965
+ /**
8966
+ * Waits for LocusInfo to update meeting.selfUrl, with a timeout fallback.
8967
+ * @returns {Promise<void>}
8968
+ * @private
8969
+ * @memberof Meeting
8970
+ */
8971
+ private waitForSelfUrlChange(): Promise<void> {
8972
+ if (this.joinWithMediaRetryInfo.retryCount > 0) {
8973
+ /* During joinWithMedia() retries we can get 403/409 from Locus and it doesn't mean
8974
+ * that the selfUrl will change, it is usually caused by Locus dropping us as a result of
8975
+ * media connection failure during joinWithMedia's earlier media connection attempt,
8976
+ * so we don't want to wait for selfUrl change as this would only slow down the join process. */
8977
+ LoggerProxy.logger.info(
8978
+ 'Meeting:index#waitForSelfUrlChange --> joinWithMedia retry in progress, will not wait for selfUrl change'
8979
+ );
8980
+
8981
+ return Promise.resolve();
8982
+ }
8983
+
8984
+ if (!this.promisesWaitingForPropUpdate.selfUrl) {
8985
+ const pendingSelfUrlUpdate = new Defer();
8986
+
8987
+ this.promisesWaitingForPropUpdate.selfUrl = pendingSelfUrlUpdate;
8988
+
8989
+ setTimeout(() => {
8990
+ if (this.promisesWaitingForPropUpdate.selfUrl === pendingSelfUrlUpdate) {
8991
+ delete this.promisesWaitingForPropUpdate.selfUrl;
8992
+ pendingSelfUrlUpdate.resolve();
8993
+ }
8994
+ }, 5000);
8995
+ }
8996
+
8997
+ return this.promisesWaitingForPropUpdate.selfUrl.promise;
8998
+ }
8999
+
8198
9000
  /**
8199
9001
  * Creates a media connection to the server. Media connection is required for sending or receiving any audio/video.
8200
9002
  *
@@ -8206,8 +9008,9 @@ export default class Meeting extends StatelessWebexPlugin {
8206
9008
  addMedia(options: AddMediaOptions = {}): Promise<void> {
8207
9009
  return this.addMediaInternal(
8208
9010
  () => (this.turnServerUsed ? 'JOIN_MEETING_FINAL' : 'JOIN_MEETING_RETRY'),
8209
- undefined,
8210
9011
  false,
9012
+ undefined /* turnServerInfo - it will be fetched via doTurnDiscovery() */,
9013
+ undefined /* iceTransportPolicy - we're relying on the default value */,
8211
9014
  options
8212
9015
  );
8213
9016
  }
@@ -8216,8 +9019,9 @@ export default class Meeting extends StatelessWebexPlugin {
8216
9019
  * Internal version of addMedia() with some more arguments for finer control of its behavior
8217
9020
  *
8218
9021
  * @param {Function} icePhaseCallback - callback to determine the icePhase for CA "client.ice.end" failure events
8219
- * @param {TurnServerInfo} turnServerInfo - TURN server information
8220
9022
  * @param {boolean} forceTurnDiscovery - if true, TURN discovery will be done
9023
+ * @param {TurnServerInfo} turnServerInfo - TURN server information
9024
+ * @param {RTCIceTransportPolicy} [iceTransportPolicy] - ICE transport policy override
8221
9025
  * @param {AddMediaOptions} options - same as options of the public addMedia() method
8222
9026
  * @returns {Promise<void>}
8223
9027
  * @protected
@@ -8225,21 +9029,30 @@ export default class Meeting extends StatelessWebexPlugin {
8225
9029
  */
8226
9030
  protected async addMediaInternal(
8227
9031
  icePhaseCallback: () => string,
8228
- turnServerInfo: TurnServerInfo,
8229
- forceTurnDiscovery,
9032
+ forceTurnDiscovery: boolean,
9033
+ turnServerInfo?: TurnServerInfo,
9034
+ iceTransportPolicy?: RTCIceTransportPolicy,
8230
9035
  options: AddMediaOptions = {}
8231
9036
  ): Promise<void> {
8232
9037
  this.addMediaData.retriedWithTurnServer = false;
8233
9038
  this.addMediaData.icePhaseCallback = icePhaseCallback;
9039
+ this.addMediaData.iceTransportPolicy = iceTransportPolicy;
8234
9040
 
8235
9041
  this.hasMediaConnectionConnectedAtLeastOnce = false;
8236
9042
  const LOG_HEADER = 'Meeting:index#addMedia -->';
9043
+ const optionsForLogging = {
9044
+ ...options,
9045
+ remoteMediaManagerConfig: getRemoteMediaManagerConfigForLogging(
9046
+ options.remoteMediaManagerConfig
9047
+ ),
9048
+ };
9049
+
8237
9050
  LoggerProxy.logger.info(
8238
9051
  `${LOG_HEADER} called with: options=${JSON.stringify(
8239
- options
9052
+ optionsForLogging
8240
9053
  )}, turnServerInfo=${JSON.stringify(
8241
9054
  turnServerInfo
8242
- )}, forceTurnDiscovery=${forceTurnDiscovery}`
9055
+ )}, forceTurnDiscovery=${forceTurnDiscovery}, iceTransportPolicy=${iceTransportPolicy}`
8243
9056
  );
8244
9057
 
8245
9058
  if (options.allowMediaInLobby !== true && this.meetingState !== FULL_STATE.ACTIVE) {
@@ -8353,12 +9166,7 @@ export default class Meeting extends StatelessWebexPlugin {
8353
9166
 
8354
9167
  // Establish new media connection with forced TURN discovery
8355
9168
  // We need to do TURN discovery again, because backend will be creating a new confluence, so it might land on a different node or cluster
8356
- await this.establishMediaConnection(
8357
- remoteMediaManagerConfig,
8358
- bundlePolicy,
8359
- true,
8360
- undefined
8361
- );
9169
+ await this.establishMediaConnection(remoteMediaManagerConfig, bundlePolicy, true);
8362
9170
  } else {
8363
9171
  throw error;
8364
9172
  }
@@ -8387,7 +9195,8 @@ export default class Meeting extends StatelessWebexPlugin {
8387
9195
  numTransports,
8388
9196
  isMultistream: this.isMultistream,
8389
9197
  retriedWithTurnServer: this.addMediaData.retriedWithTurnServer,
8390
- isJoinWithMediaRetry: this.joinWithMediaRetryInfo.isRetry,
9198
+ isJoinWithMediaRetry: this.joinWithMediaRetryInfo.retryCount > 0,
9199
+ iceTransportPolicy: this.addMediaData.iceTransportPolicy || 'all',
8391
9200
  ...reachabilityMetrics,
8392
9201
  ...iceCandidateErrors,
8393
9202
  iceCandidatesCount: this.iceCandidatesCount,
@@ -8409,14 +9218,16 @@ export default class Meeting extends StatelessWebexPlugin {
8409
9218
  // We can log ReceiveSlot SSRCs only after the SDP exchange, so doing it here:
8410
9219
  this.remoteMediaManager?.logAllReceiveSlots();
8411
9220
  this.startPeriodicLogUpload();
8412
- } catch (error) {
9221
+ } catch (error: any) {
8413
9222
  LoggerProxy.logger.error(`${LOG_HEADER} failed to establish media connection: `, error);
8414
9223
 
8415
9224
  // @ts-ignore
8416
9225
  const reachabilityMetrics = await this.getMediaReachabilityMetricFields();
8417
9226
 
8418
- const {selectedCandidatePairChanges, numTransports} =
8419
- await this.mediaProperties.getCurrentConnectionInfo();
9227
+ const {connectionType, selectedCandidatePairChanges, numTransports} =
9228
+ error instanceof AddMediaFailed
9229
+ ? error
9230
+ : await this.mediaProperties.getCurrentConnectionInfo();
8420
9231
 
8421
9232
  const iceCandidateErrors = Object.fromEntries(this.iceCandidateErrors);
8422
9233
 
@@ -8432,7 +9243,8 @@ export default class Meeting extends StatelessWebexPlugin {
8432
9243
  turnServerUsed: this.turnServerUsed,
8433
9244
  retriedWithTurnServer: this.addMediaData.retriedWithTurnServer,
8434
9245
  isMultistream: this.isMultistream,
8435
- isJoinWithMediaRetry: this.joinWithMediaRetryInfo.isRetry,
9246
+ isJoinWithMediaRetry: this.joinWithMediaRetryInfo.retryCount > 0,
9247
+ iceTransportPolicy: this.addMediaData.iceTransportPolicy || 'all',
8436
9248
  signalingState:
8437
9249
  this.mediaProperties.webrtcMediaConnection?.multistreamConnection?.pc?.pc
8438
9250
  ?.signalingState ||
@@ -8448,6 +9260,7 @@ export default class Meeting extends StatelessWebexPlugin {
8448
9260
  ?.iceConnectionState ||
8449
9261
  this.mediaProperties.webrtcMediaConnection?.mediaConnection?.pc?.iceConnectionState ||
8450
9262
  'unknown',
9263
+ connectionType,
8451
9264
  ...reachabilityMetrics,
8452
9265
  ...iceCandidateErrors,
8453
9266
  iceCandidatesCount: this.iceCandidatesCount,
@@ -8796,6 +9609,7 @@ export default class Meeting extends StatelessWebexPlugin {
8796
9609
  options: {meetingId: this.id},
8797
9610
  });
8798
9611
  LoggerProxy.logger.log('Meeting:index#leave --> Leaving a meeting');
9612
+ this.stopListeningForMeetingEvents();
8799
9613
 
8800
9614
  return MeetingUtil.leaveMeeting(this, options)
8801
9615
  .then(async (leave) => {
@@ -9661,6 +10475,8 @@ export default class Meeting extends StatelessWebexPlugin {
9661
10475
  locus_id: this.locusId,
9662
10476
  });
9663
10477
 
10478
+ this.stopListeningForMeetingEvents();
10479
+
9664
10480
  return MeetingUtil.endMeetingForAll(this)
9665
10481
  .then(async (end) => {
9666
10482
  this.meetingFiniteStateMachine.end();
@@ -9722,13 +10538,14 @@ export default class Meeting extends StatelessWebexPlugin {
9722
10538
  }
9723
10539
  this.queuedMediaUpdates = [];
9724
10540
 
9725
- this.stopTranscription();
9726
- this.transcription = undefined;
10541
+ // Listener teardown (transcription, annotation, llm/mercury) runs in
10542
+ // stopListeningForMeetingEvents() before /leave and /end so events
10543
+ // received mid-teardown do not trigger Locus syncs.
10544
+ // Token cleanup happens automatically when cleanupLLMConneciton destroys the channel.
10545
+ // A new voiceaChannel is created on the next join. In-session LLM reconnects and
10546
+ // practice-session transitions use their own cleanup paths and preserve the channel.
9727
10547
 
9728
- this.annotation.deregisterEvents();
9729
-
9730
- this.clearDataChannelToken();
9731
- await this.cleanupLLMConneciton({throwOnError: false});
10548
+ await this.cleanupLLMConneciton({throwOnError: false, preserveVoiceaChannel: false});
9732
10549
  };
9733
10550
 
9734
10551
  /**
@@ -9804,15 +10621,12 @@ export default class Meeting extends StatelessWebexPlugin {
9804
10621
  * @public
9805
10622
  * @memberof Meeting
9806
10623
  */
9807
- public sendReaction(reactionType: ReactionServerType, skinToneType?: SkinToneType) {
10624
+ public sendReaction(reactionType: string, skinToneType?: SkinToneType) {
9808
10625
  const reactionChannelUrl = this.locusInfo?.controls?.reactions?.reactionChannelUrl as string;
9809
10626
  const participantId = this.members.selfId;
9810
10627
 
9811
- const reactionData = Reactions[reactionType];
10628
+ const reactionData = Reactions[reactionType] || {type: reactionType};
9812
10629
 
9813
- if (!reactionData) {
9814
- return Promise.reject(new Error(`${reactionType} is not a valid reaction.`));
9815
- }
9816
10630
  const skinToneData = SkinTones[skinToneType] || SkinTones.normal;
9817
10631
  const reaction: Reaction = {
9818
10632
  ...reactionData,
@@ -10467,6 +11281,34 @@ export default class Meeting extends StatelessWebexPlugin {
10467
11281
  }
10468
11282
  }
10469
11283
 
11284
+ /**
11285
+ * Checks if the LLM channel is connected.
11286
+ * Handles practice session context automatically - returns practice session
11287
+ * LLM channel status when in practice session, main LLM channel status otherwise.
11288
+ * @returns {boolean} True if the appropriate LLM channel is connected
11289
+ */
11290
+ public isLLMConnected(): boolean {
11291
+ if (this.webinar?.isJoinPracticeSessionDataChannel()) {
11292
+ return this.webinar.isPracticeSessionLLMChannelConnected();
11293
+ }
11294
+
11295
+ return this.llmChannel?.isConnected() ?? false;
11296
+ }
11297
+
11298
+ /**
11299
+ * Gets the locus URL from the LLM channel.
11300
+ * Handles practice session context automatically - returns practice session
11301
+ * LLM channel's locus URL when in practice session, main LLM channel's locus URL otherwise.
11302
+ * @returns {string | undefined} The locus URL or undefined
11303
+ */
11304
+ public getLLMLocusUrl(): string | undefined {
11305
+ if (this.webinar?.isJoinPracticeSessionDataChannel()) {
11306
+ return this.webinar.getPracticeSessionLocusUrl();
11307
+ }
11308
+
11309
+ return this.llmChannel?.getLocusUrl();
11310
+ }
11311
+
10470
11312
  /**
10471
11313
  * Determines the current data channel token type based on the meeting state.
10472
11314
  *