@webex/plugin-meetings 3.12.0-next.18 → 3.12.0-next.181

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 (307) 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 +207 -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 +26 -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 +1844 -959
  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/reachability/clusterReachability.js.map +1 -1
  137. package/dist/reachability/index.js +121 -83
  138. package/dist/reachability/index.js.map +1 -1
  139. package/dist/reachability/reachability.types.js +2 -0
  140. package/dist/reachability/reachability.types.js.map +1 -1
  141. package/dist/reachability/util.js +45 -0
  142. package/dist/reachability/util.js.map +1 -1
  143. package/dist/reactions/reactions.type.js.map +1 -1
  144. package/dist/recording-controller/index.js +1 -3
  145. package/dist/recording-controller/index.js.map +1 -1
  146. package/dist/roap/turnDiscovery.js +8 -1
  147. package/dist/roap/turnDiscovery.js.map +1 -1
  148. package/dist/types/annotation/index.d.ts +19 -0
  149. package/dist/types/common/errors/webex-errors.d.ts +36 -2
  150. package/dist/types/config.d.ts +3 -2
  151. package/dist/types/constants.d.ts +15 -2
  152. package/dist/types/controls-options-manager/index.d.ts +16 -0
  153. package/dist/types/hashTree/constants.d.ts +1 -0
  154. package/dist/types/hashTree/hashTreeParser.d.ts +201 -22
  155. package/dist/types/hashTree/utils.d.ts +7 -0
  156. package/dist/types/index.d.ts +4 -0
  157. package/dist/types/interceptors/locusRetry.d.ts +4 -4
  158. package/dist/types/interpretation/interpretation.types.d.ts +10 -0
  159. package/dist/types/locus-info/index.d.ts +106 -8
  160. package/dist/types/locus-info/infoUtils.d.ts +8 -0
  161. package/dist/types/locus-info/types.d.ts +22 -1
  162. package/dist/types/media/MediaConnectionAwaiter.d.ts +66 -49
  163. package/dist/types/media/properties.d.ts +6 -2
  164. package/dist/types/meeting/in-meeting-actions.d.ts +4 -0
  165. package/dist/types/meeting/index.d.ts +217 -16
  166. package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
  167. package/dist/types/meeting/request.d.ts +1 -0
  168. package/dist/types/meeting/util.d.ts +12 -1
  169. package/dist/types/meeting-info/meeting-info-v2.d.ts +1 -0
  170. package/dist/types/meetings/index.d.ts +40 -19
  171. package/dist/types/meetings/meetings.types.d.ts +15 -0
  172. package/dist/types/meetings/request.d.ts +14 -0
  173. package/dist/types/member/index.d.ts +1 -0
  174. package/dist/types/member/types.d.ts +1 -0
  175. package/dist/types/member/util.d.ts +9 -0
  176. package/dist/types/members/index.d.ts +15 -2
  177. package/dist/types/members/util.d.ts +1 -5
  178. package/dist/types/metrics/constants.d.ts +6 -0
  179. package/dist/types/multistream/codec/constants.d.ts +7 -0
  180. package/dist/types/multistream/mediaRequestManager.d.ts +22 -5
  181. package/dist/types/multistream/remoteMediaManager.d.ts +18 -0
  182. package/dist/types/reachability/clusterReachability.d.ts +3 -3
  183. package/dist/types/reachability/index.d.ts +10 -3
  184. package/dist/types/reachability/reachability.types.d.ts +7 -0
  185. package/dist/types/reachability/util.d.ts +17 -0
  186. package/dist/types/reactions/reactions.type.d.ts +3 -0
  187. package/dist/webinar/index.js +441 -252
  188. package/dist/webinar/index.js.map +1 -1
  189. package/package.json +26 -24
  190. package/src/aiEnableRequest/ai-docs/ai-enable-request-spec.md +223 -0
  191. package/src/aiEnableRequest/index.ts +16 -0
  192. package/src/annotation/ai-docs/annotation-spec.md +236 -0
  193. package/src/annotation/index.ts +61 -29
  194. package/src/breakouts/ai-docs/breakouts-spec.md +324 -0
  195. package/src/breakouts/breakout.ts +3 -1
  196. package/src/breakouts/events.ts +33 -11
  197. package/src/breakouts/index.ts +145 -3
  198. package/src/common/errors/webex-errors.ts +56 -3
  199. package/src/config.ts +3 -2
  200. package/src/constants.ts +23 -4
  201. package/src/controls-options-manager/ai-docs/controls-options-manager-spec.md +243 -0
  202. package/src/controls-options-manager/index.ts +62 -10
  203. package/src/hashTree/ai-docs/hash-tree-spec.md +267 -0
  204. package/src/hashTree/constants.ts +7 -0
  205. package/src/hashTree/hashTreeParser.ts +861 -193
  206. package/src/hashTree/utils.ts +19 -0
  207. package/src/index.ts +7 -0
  208. package/src/interceptors/ai-docs/interceptors-spec.md +247 -0
  209. package/src/interceptors/dataChannelAuthToken.ts +59 -12
  210. package/src/interceptors/locusRetry.ts +26 -5
  211. package/src/interpretation/ai-docs/interpretation-spec.md +256 -0
  212. package/src/interpretation/index.ts +65 -10
  213. package/src/interpretation/interpretation.types.ts +11 -0
  214. package/src/locus-info/ai-docs/locus-info-spec.md +293 -0
  215. package/src/locus-info/controlsUtils.ts +3 -1
  216. package/src/locus-info/index.ts +566 -164
  217. package/src/locus-info/infoUtils.ts +41 -6
  218. package/src/locus-info/types.ts +26 -1
  219. package/src/media/MediaConnectionAwaiter.ts +229 -196
  220. package/src/media/ai-docs/media-spec.md +267 -0
  221. package/src/media/index.ts +10 -1
  222. package/src/media/properties.ts +8 -3
  223. package/src/meeting/ai-docs/meeting-spec.md +401 -0
  224. package/src/meeting/in-meeting-actions.ts +8 -0
  225. package/src/meeting/index.ts +1085 -252
  226. package/src/meeting/locusMediaRequest.ts +106 -6
  227. package/src/meeting/muteState.ts +10 -1
  228. package/src/meeting/request.ts +11 -0
  229. package/src/meeting/util.ts +53 -9
  230. package/src/meeting/voicea-meeting.ts +1 -1
  231. package/src/meeting-info/ai-docs/meeting-info-spec.md +261 -0
  232. package/src/meeting-info/meeting-info-v2.ts +11 -4
  233. package/src/meetings/ai-docs/meetings-spec.md +296 -0
  234. package/src/meetings/index.ts +202 -81
  235. package/src/meetings/meetings.types.ts +19 -0
  236. package/src/meetings/request.ts +43 -0
  237. package/src/meetings/util.ts +117 -4
  238. package/src/member/ai-docs/member-spec.md +196 -0
  239. package/src/member/index.ts +10 -0
  240. package/src/member/types.ts +1 -0
  241. package/src/member/util.ts +29 -0
  242. package/src/members/ai-docs/members-spec.md +256 -0
  243. package/src/members/index.ts +70 -7
  244. package/src/members/util.ts +12 -4
  245. package/src/metrics/ai-docs/metrics-spec.md +185 -0
  246. package/src/metrics/constants.ts +6 -0
  247. package/src/multistream/ai-docs/multistream-spec.md +292 -0
  248. package/src/multistream/codec/constants.ts +58 -0
  249. package/src/multistream/mediaRequestManager.ts +119 -28
  250. package/src/multistream/receiveSlot.ts +18 -0
  251. package/src/multistream/remoteMediaManager.ts +23 -1
  252. package/src/personal-meeting-room/ai-docs/personal-meeting-room-spec.md +234 -0
  253. package/src/reachability/ai-docs/reachability-spec.md +261 -0
  254. package/src/reachability/clusterReachability.ts +3 -2
  255. package/src/reachability/index.ts +47 -16
  256. package/src/reachability/reachability.types.ts +11 -0
  257. package/src/reachability/util.ts +36 -0
  258. package/src/reactions/ai-docs/reactions-spec.md +198 -0
  259. package/src/reactions/reactions.type.ts +3 -0
  260. package/src/reconnection-manager/ai-docs/reconnection-manager-spec.md +272 -0
  261. package/src/recording-controller/ai-docs/recording-controller-spec.md +223 -0
  262. package/src/recording-controller/index.ts +1 -2
  263. package/src/roap/ai-docs/roap-spec.md +241 -0
  264. package/src/roap/turnDiscovery.ts +9 -1
  265. package/src/webinar/ai-docs/webinar-spec.md +243 -0
  266. package/src/webinar/index.ts +247 -89
  267. package/test/unit/spec/aiEnableRequest/index.ts +86 -0
  268. package/test/unit/spec/annotation/index.ts +214 -182
  269. package/test/unit/spec/breakouts/breakout.ts +9 -3
  270. package/test/unit/spec/breakouts/events.ts +120 -2
  271. package/test/unit/spec/breakouts/index.ts +336 -15
  272. package/test/unit/spec/common/errors/webex-errors.ts +78 -0
  273. package/test/unit/spec/controls-options-manager/index.js +139 -32
  274. package/test/unit/spec/hashTree/hashTreeParser.ts +2451 -184
  275. package/test/unit/spec/hashTree/utils.ts +37 -0
  276. package/test/unit/spec/interceptors/dataChannelAuthToken.ts +179 -1
  277. package/test/unit/spec/interceptors/locusRetry.ts +234 -5
  278. package/test/unit/spec/interpretation/index.ts +119 -4
  279. package/test/unit/spec/locus-info/controlsUtils.js +172 -57
  280. package/test/unit/spec/locus-info/index.js +1014 -58
  281. package/test/unit/spec/locus-info/infoUtils.js +184 -1
  282. package/test/unit/spec/media/MediaConnectionAwaiter.ts +479 -17
  283. package/test/unit/spec/media/index.ts +92 -0
  284. package/test/unit/spec/media/properties.ts +26 -26
  285. package/test/unit/spec/meeting/in-meeting-actions.ts +4 -0
  286. package/test/unit/spec/meeting/index.js +3462 -493
  287. package/test/unit/spec/meeting/locusMediaRequest.ts +406 -4
  288. package/test/unit/spec/meeting/muteState.js +81 -0
  289. package/test/unit/spec/meeting/request.js +12 -0
  290. package/test/unit/spec/meeting/utils.js +205 -19
  291. package/test/unit/spec/meeting/voicea-meeting.ts +85 -1
  292. package/test/unit/spec/meeting-info/meetinginfov2.js +88 -11
  293. package/test/unit/spec/meetings/index.js +549 -49
  294. package/test/unit/spec/meetings/request.js +141 -0
  295. package/test/unit/spec/meetings/utils.js +402 -51
  296. package/test/unit/spec/member/index.js +7 -0
  297. package/test/unit/spec/member/util.js +89 -0
  298. package/test/unit/spec/members/index.js +216 -0
  299. package/test/unit/spec/members/request.js +37 -1
  300. package/test/unit/spec/members/utils.js +63 -0
  301. package/test/unit/spec/multistream/mediaRequestManager.ts +501 -37
  302. package/test/unit/spec/multistream/remoteMediaManager.ts +46 -0
  303. package/test/unit/spec/reachability/index.ts +128 -46
  304. package/test/unit/spec/reachability/util.ts +31 -0
  305. package/test/unit/spec/recording-controller/index.js +9 -8
  306. package/test/unit/spec/roap/turnDiscovery.ts +20 -0
  307. 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,6 +5491,7 @@ export default class Meeting extends StatelessWebexPlugin {
5173
5491
  );
5174
5492
 
5175
5493
  this.receiveSlotManager.reset();
5494
+
5176
5495
  this.mediaProperties.webrtcMediaConnection.close();
5177
5496
  this.mediaProperties.unsetPeerConnection();
5178
5497
  this.sendSlotManager.reset();
@@ -5460,7 +5779,7 @@ export default class Meeting extends StatelessWebexPlugin {
5460
5779
  } = {}
5461
5780
  ) {
5462
5781
  const {mediaOptions, joinOptions = {}} = options;
5463
- const {isRetry, prevJoinResponse} = this.joinWithMediaRetryInfo;
5782
+ const {retryCount, prevJoinResponse, prevError} = this.joinWithMediaRetryInfo;
5464
5783
 
5465
5784
  if (!mediaOptions?.allowMediaInLobby) {
5466
5785
  return Promise.reject(
@@ -5471,9 +5790,6 @@ export default class Meeting extends StatelessWebexPlugin {
5471
5790
 
5472
5791
  LoggerProxy.logger.info('Meeting:index#joinWithMedia called');
5473
5792
 
5474
- let joined = false;
5475
- let joinResponse = prevJoinResponse;
5476
-
5477
5793
  /* Before we do anything, check if RTCPeerConnection is available. Normally this is checked
5478
5794
  by addMediaInternal() itself when creating the media connection, but since joinWithMedia()
5479
5795
  is a convenience method that does both join() and addMedia(), we want to fail fast here
@@ -5486,12 +5802,28 @@ export default class Meeting extends StatelessWebexPlugin {
5486
5802
  );
5487
5803
  }
5488
5804
 
5805
+ /* While we're trying to join, we may fail and be doing a retry. In that case,
5806
+ we sometimes get dropped by Locus as a result of the 1st failed attempt.
5807
+ That notification from Locus needs to be ignored, otherwise it causes the meeting to be
5808
+ cleaned up and prevents the retry from running correctly.
5809
+ */
5810
+ this.locusInfo.suspendDestroyMeeting(true);
5811
+
5812
+ let joined = false;
5813
+ let joinResponse = prevJoinResponse;
5814
+
5815
+ const shouldJoin =
5816
+ !joinResponse || // first try, when the join response is empty
5817
+ (prevError && prevError instanceof UserNotJoinedError) || // last try failed with UserNotJoinedError
5818
+ this.isErrorMeaningLocusDroppedUs(prevError) ||
5819
+ MeetingUtil.isUserInLeftState(this.locusInfo); // locus dropped the connection before we can re-try addMedia
5820
+
5489
5821
  try {
5490
5822
  let turnServerInfo;
5491
5823
  let turnDiscoverySkippedReason;
5492
5824
  let forceTurnDiscovery = false;
5493
5825
 
5494
- if (!joinResponse) {
5826
+ if (shouldJoin) {
5495
5827
  // This is the 1st attempt or a retry after join request failed -> we need to do a join with TURN discovery
5496
5828
 
5497
5829
  const turnDiscoveryRequest = await this.roap.generateTurnDiscoveryRequestMessage(
@@ -5530,16 +5862,24 @@ export default class Meeting extends StatelessWebexPlugin {
5530
5862
  joined = true;
5531
5863
  }
5532
5864
 
5865
+ const shouldRetryMediaWithOnlyTurnTLS = await this.shouldRetryMediaWithOnlyTurnTLS(prevError);
5866
+
5533
5867
  const mediaResponse = await this.addMediaInternal(
5534
5868
  () => {
5535
- return this.joinWithMediaRetryInfo.isRetry ? 'JOIN_MEETING_FINAL' : 'JOIN_MEETING_RETRY';
5869
+ // callback is not called when UserNotJoinedError is thrown
5870
+ return this.joinWithMediaRetryInfo.retryCount >= 1
5871
+ ? 'JOIN_MEETING_FINAL'
5872
+ : 'JOIN_MEETING_RETRY';
5536
5873
  },
5537
- turnServerInfo,
5538
5874
  forceTurnDiscovery,
5875
+ turnServerInfo,
5876
+ shouldRetryMediaWithOnlyTurnTLS ? 'relay' : undefined,
5539
5877
  mediaOptions
5540
5878
  );
5541
5879
 
5542
- this.joinWithMediaRetryInfo = {isRetry: false, prevJoinResponse: undefined};
5880
+ this.joinWithMediaRetryInfo = {retryCount: 0, prevJoinResponse: undefined};
5881
+
5882
+ this.locusInfo.suspendDestroyMeeting(false);
5543
5883
 
5544
5884
  return {
5545
5885
  join: joinResponse,
@@ -5553,15 +5893,21 @@ export default class Meeting extends StatelessWebexPlugin {
5553
5893
 
5554
5894
  this.roap.abortTurnDiscovery();
5555
5895
 
5556
- // if this was the first attempt, let's do a retry
5557
- let shouldRetry = !isRetry;
5896
+ // let's do a retry (but not on 1-1 calls, because the flow would get too complicated)
5897
+ let shouldRetry =
5898
+ !MeetingsUtil.isOneOnOneCall(this.locusInfo.parsedLocus) &&
5899
+ (retryCount < 1 ||
5900
+ ((error instanceof UserNotJoinedError || this.isErrorMeaningLocusDroppedUs(error)) &&
5901
+ retryCount < JOIN_WITH_MEDIA_RETRY_MAX_COUNT));
5558
5902
 
5559
5903
  if (
5560
5904
  CallDiagnosticUtils.isSdpOfferCreationError(error) ||
5561
- CallDiagnosticUtils.isWebrtcApiNotAvailableError(error)
5905
+ CallDiagnosticUtils.isWebrtcApiNotAvailableError(error) ||
5906
+ this.isLocusUserFullError(error)
5562
5907
  ) {
5563
5908
  // errors related to offer creation (for example missing H264 codec) will happen again no matter how many times we try,
5564
5909
  // so there is no point doing a retry
5910
+ // when the locus is full, we also don't want to retry, because it will just fail again
5565
5911
  shouldRetry = false;
5566
5912
  }
5567
5913
 
@@ -5579,8 +5925,8 @@ export default class Meeting extends StatelessWebexPlugin {
5579
5925
  });
5580
5926
  }
5581
5927
 
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)) {
5928
+ // we only want to call leave if join was successful, and we won't be doing any more retries
5929
+ if (joined && !shouldRetry) {
5584
5930
  try {
5585
5931
  await this.leave({resourceId: joinOptions?.resourceId, reason: 'joinWithMedia failure'});
5586
5932
  } catch (e) {
@@ -5597,7 +5943,7 @@ export default class Meeting extends StatelessWebexPlugin {
5597
5943
  reason: error.message,
5598
5944
  stack: error.stack,
5599
5945
  leaveErrorReason: leaveError?.message,
5600
- isRetry,
5946
+ isRetry: retryCount > 0,
5601
5947
  },
5602
5948
  {
5603
5949
  type: error.name,
@@ -5606,15 +5952,30 @@ export default class Meeting extends StatelessWebexPlugin {
5606
5952
 
5607
5953
  if (shouldRetry) {
5608
5954
  LoggerProxy.logger.warn('Meeting:index#joinWithMedia --> retrying call to joinWithMedia');
5609
- this.joinWithMediaRetryInfo.isRetry = true;
5955
+ this.joinWithMediaRetryInfo.retryCount = retryCount + 1;
5610
5956
  this.joinWithMediaRetryInfo.prevJoinResponse = joinResponse;
5957
+ this.joinWithMediaRetryInfo.prevError = error;
5958
+ if (!this.joinWithMediaRetryInfo.firstError) {
5959
+ this.joinWithMediaRetryInfo.firstError = error;
5960
+ }
5611
5961
 
5612
5962
  return this.joinWithMedia(options);
5613
5963
  }
5614
5964
 
5615
- this.joinWithMediaRetryInfo = {isRetry: false, prevJoinResponse: undefined};
5965
+ const {firstError} = this.joinWithMediaRetryInfo;
5616
5966
 
5617
- throw error;
5967
+ this.joinWithMediaRetryInfo = {
5968
+ retryCount: 0,
5969
+ prevJoinResponse: undefined,
5970
+ firstError: undefined,
5971
+ prevError: undefined,
5972
+ };
5973
+
5974
+ this.locusInfo.suspendDestroyMeeting(false);
5975
+
5976
+ // LOCUS_USER_FULL is a definitive capacity error the client must surface, so it takes
5977
+ // precedence over any earlier retryable error stored in firstError.
5978
+ throw this.isLocusUserFullError(error) ? error : firstError ?? error;
5618
5979
  }
5619
5980
  }
5620
5981
 
@@ -5719,8 +6080,7 @@ export default class Meeting extends StatelessWebexPlugin {
5719
6080
 
5720
6081
  try {
5721
6082
  const voiceaListenerCaptionUpdate = (payload) => {
5722
- // @ts-ignore
5723
- this.webex.internal.voicea.off(
6083
+ this.voiceaChannel?.off(
5724
6084
  VOICEAEVENTS.CAPTION_LANGUAGE_UPDATE,
5725
6085
  voiceaListenerCaptionUpdate
5726
6086
  );
@@ -5736,13 +6096,8 @@ export default class Meeting extends StatelessWebexPlugin {
5736
6096
  reject(payload);
5737
6097
  }
5738
6098
  };
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);
6099
+ this.voiceaChannel?.on(VOICEAEVENTS.CAPTION_LANGUAGE_UPDATE, voiceaListenerCaptionUpdate);
6100
+ this.voiceaChannel?.requestLanguage(language);
5746
6101
  } catch (error) {
5747
6102
  LoggerProxy.logger.error(`Meeting:index#setCaptionLanguage --> ${error}`);
5748
6103
 
@@ -5776,8 +6131,7 @@ export default class Meeting extends StatelessWebexPlugin {
5776
6131
 
5777
6132
  try {
5778
6133
  const voiceaListenerLanguageUpdate = (payload) => {
5779
- // @ts-ignore
5780
- this.webex.internal.voicea.off(
6134
+ this.voiceaChannel?.off(
5781
6135
  VOICEAEVENTS.SPOKEN_LANGUAGE_UPDATE,
5782
6136
  voiceaListenerLanguageUpdate
5783
6137
  );
@@ -5794,14 +6148,9 @@ export default class Meeting extends StatelessWebexPlugin {
5794
6148
  }
5795
6149
  };
5796
6150
 
5797
- // @ts-ignore
5798
- this.webex.internal.voicea.on(
5799
- VOICEAEVENTS.SPOKEN_LANGUAGE_UPDATE,
5800
- voiceaListenerLanguageUpdate
5801
- );
6151
+ this.voiceaChannel?.on(VOICEAEVENTS.SPOKEN_LANGUAGE_UPDATE, voiceaListenerLanguageUpdate);
5802
6152
 
5803
- // @ts-ignore
5804
- this.webex.internal.voicea.setSpokenLanguage(language);
6153
+ this.voiceaChannel?.setSpokenLanguage(language);
5805
6154
  } catch (error) {
5806
6155
  LoggerProxy.logger.error(`Meeting:index#setSpokenLanguage --> ${error}`);
5807
6156
 
@@ -5823,12 +6172,18 @@ export default class Meeting extends StatelessWebexPlugin {
5823
6172
  );
5824
6173
 
5825
6174
  try {
6175
+ if (!this.voiceaChannel) {
6176
+ LoggerProxy.logger.warn(
6177
+ 'Meeting:index#startTranscription --> voiceaChannel not available'
6178
+ );
6179
+
6180
+ return;
6181
+ }
6182
+
5826
6183
  if (!this.areVoiceaEventsSetup) {
5827
6184
  this.setUpVoiceaListeners();
5828
6185
  }
5829
-
5830
- // @ts-ignore
5831
- await this.webex.internal.voicea.turnOnCaptions(options?.spokenLanguage);
6186
+ await this.voiceaChannel.turnOnCaptions(options?.spokenLanguage);
5832
6187
  } catch (error) {
5833
6188
  LoggerProxy.logger.error(`Meeting:index#startTranscription --> ${error}`);
5834
6189
  Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.RECEIVE_TRANSCRIPTION_FAILURE, {
@@ -5845,6 +6200,22 @@ export default class Meeting extends StatelessWebexPlugin {
5845
6200
  }
5846
6201
  }
5847
6202
 
6203
+ /**
6204
+ * Starts transcription when requested by the current Locus controls and an
6205
+ * active LLM channel is ready.
6206
+ * @internal
6207
+ * @returns {void}
6208
+ */
6209
+ public startTranscriptionIfNeeded(): void {
6210
+ if (
6211
+ this.locusInfo.controls?.transcribe?.transcribing &&
6212
+ !this.areVoiceaEventsSetup &&
6213
+ this.voiceaChannel?.isLLMConnected()
6214
+ ) {
6215
+ this.startTranscription();
6216
+ }
6217
+ }
6218
+
5848
6219
  /** Handles Locus LLM events
5849
6220
  *
5850
6221
  * @param {LocusLLMEvent} event - The Locus LLM event to process
@@ -5857,7 +6228,18 @@ export default class Meeting extends StatelessWebexPlugin {
5857
6228
  storeEventForDebugging('llm', event.data);
5858
6229
  }
5859
6230
 
6231
+ const {trackingId} = event;
6232
+
5860
6233
  this.locusInfo.parse(this, event.data);
6234
+
6235
+ // Only the client whose /sync request tracking id matches the tracking id echoed back on this
6236
+ // LLM message should emit client.locus.sync.complete. The tracking id lives at the top level
6237
+ // of the received LLM event envelope. When it is absent there is nothing to correlate, so
6238
+ // skip. onLocusSyncLlmMessage records the LLM arrival time and is a no-op unless a stored
6239
+ // record for this meeting matches the tracking id.
6240
+ if (trackingId) {
6241
+ this.onLocusSyncLlmMessage(this.id, trackingId);
6242
+ }
5861
6243
  } else {
5862
6244
  LoggerProxy.logger.warn(
5863
6245
  `Meeting:index#processLocusLLMEvent --> Unknown event type: ${event.data.eventType}`
@@ -5866,17 +6248,50 @@ export default class Meeting extends StatelessWebexPlugin {
5866
6248
  };
5867
6249
 
5868
6250
  /**
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}
6251
+ * Verifies the relay event was delivered for the active LLM session binding.
6252
+ * With the factory pattern, each meeting owns its channel, so we just verify
6253
+ * the route matches our channel's binding or the practice session binding.
6254
+ * @param {RelayEvent} event Event object coming from LLM Connection
6255
+ * @returns {boolean}
5873
6256
  */
5874
- private processRelayEvent = (e: RelayEvent): void => {
5875
- switch (e.data.relayType) {
5876
- case REACTION_RELAY_TYPES.REACTION:
5877
- if (
6257
+ private isRelayEventRouteValid(event: RelayEvent): boolean {
6258
+ const route = event?.headers?.route;
6259
+
6260
+ if (!route) {
6261
+ return true;
6262
+ }
6263
+
6264
+ // With the factory pattern, both channels may be connected simultaneously.
6265
+ // Determine which session is "active" based on whether PS channel is connected.
6266
+ const isPracticeSession = this.webinar?.isPracticeSessionLLMChannelConnected() ?? false;
6267
+
6268
+ const expectedBinding = isPracticeSession
6269
+ ? this.webinar?.getPracticeSessionBinding()
6270
+ : this.llmChannel?.getBinding();
6271
+
6272
+ if (!expectedBinding || route === expectedBinding) {
6273
+ return true;
6274
+ }
6275
+
6276
+ return false;
6277
+ }
6278
+
6279
+ /**
6280
+ * Callback called when a relay event is received from meeting LLM Connection
6281
+ * @param {RelayEvent} e Event object coming from LLM Connection
6282
+ * @private
6283
+ * @returns {void}
6284
+ */
6285
+ private processRelayEvent = (e: RelayEvent): void => {
6286
+ if (!this.isRelayEventRouteValid(e)) {
6287
+ return;
6288
+ }
6289
+ switch (e.data.relayType) {
6290
+ case REACTION_RELAY_TYPES.REACTION:
6291
+ // @ts-ignore - config coming from registerPlugin
6292
+ if (
5878
6293
  // @ts-ignore - config coming from registerPlugin
5879
- (this.config.receiveReactions || options.receiveReactions) &&
6294
+ this.config.receiveReactions &&
5880
6295
  this.isReactionsSupported()
5881
6296
  ) {
5882
6297
  const member = this.members.membersCollection.get(e.data.sender.participantId);
@@ -5917,32 +6332,27 @@ export default class Meeting extends StatelessWebexPlugin {
5917
6332
  * @returns {void}
5918
6333
  */
5919
6334
  stopTranscription() {
5920
- // @ts-ignore
5921
- this.webex.internal.voicea.off(
6335
+ this.voiceaChannel?.off(
5922
6336
  VOICEAEVENTS.VOICEA_ANNOUNCEMENT,
5923
6337
  this.voiceaListenerCallbacks[VOICEAEVENTS.VOICEA_ANNOUNCEMENT]
5924
6338
  );
5925
6339
 
5926
- // @ts-ignore
5927
- this.webex.internal.voicea.off(
6340
+ this.voiceaChannel?.off(
5928
6341
  VOICEAEVENTS.CAPTIONS_TURNED_ON,
5929
6342
  this.voiceaListenerCallbacks[VOICEAEVENTS.CAPTIONS_TURNED_ON]
5930
6343
  );
5931
6344
 
5932
- // @ts-ignore
5933
- this.webex.internal.voicea.off(
6345
+ this.voiceaChannel?.off(
5934
6346
  VOICEAEVENTS.EVA_COMMAND,
5935
6347
  this.voiceaListenerCallbacks[VOICEAEVENTS.EVA_COMMAND]
5936
6348
  );
5937
6349
 
5938
- // @ts-ignore
5939
- this.webex.internal.voicea.off(
6350
+ this.voiceaChannel?.off(
5940
6351
  VOICEAEVENTS.NEW_CAPTION,
5941
6352
  this.voiceaListenerCallbacks[VOICEAEVENTS.NEW_CAPTION]
5942
6353
  );
5943
6354
 
5944
- // @ts-ignore
5945
- this.webex.internal.voicea.deregisterEvents();
6355
+ this.voiceaChannel?.deregisterEvents();
5946
6356
 
5947
6357
  this.areVoiceaEventsSetup = false;
5948
6358
  this.triggerStopReceivingTranscriptionEvent();
@@ -5975,15 +6385,13 @@ export default class Meeting extends StatelessWebexPlugin {
5975
6385
  */
5976
6386
  private restoreLLMSubscriptionsIfNeeded(): void {
5977
6387
  try {
5978
- // @ts-ignore
5979
- const isCaptionBoxOn = this.webex.internal.voicea?.getIsCaptionBoxOn?.();
6388
+ const keepTranscriptionSubscribed = this.voiceaChannel?.getKeepTranscriptionSubscribed();
5980
6389
 
5981
- if (!isCaptionBoxOn) {
6390
+ if (!keepTranscriptionSubscribed) {
5982
6391
  return;
5983
6392
  }
5984
6393
 
5985
- // @ts-ignore
5986
- this.webex.internal.voicea.updateSubchannelSubscriptions({subscribe: ['transcription']});
6394
+ this.voiceaChannel?.updateSubchannelSubscriptions({subscribe: ['transcription']});
5987
6395
  } catch (error) {
5988
6396
  const msg = error?.message || String(error);
5989
6397
 
@@ -6002,6 +6410,7 @@ export default class Meeting extends StatelessWebexPlugin {
6002
6410
  */
6003
6411
  private handleLLMOnline = (): void => {
6004
6412
  this.restoreLLMSubscriptionsIfNeeded();
6413
+ this.locusInfo.syncAllHashTreeDatasets({onlyLLM: true});
6005
6414
 
6006
6415
  Trigger.trigger(
6007
6416
  this,
@@ -6233,11 +6642,7 @@ export default class Meeting extends StatelessWebexPlugin {
6233
6642
  this.saveDataChannelToken(join);
6234
6643
  // @ts-ignore - config coming from registerPlugin
6235
6644
  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()
6645
+ this.updateLLMConnection({isInitialJoinPhase: true})
6241
6646
  .catch((error) => {
6242
6647
  LoggerProxy.logger.error(
6243
6648
  'Meeting:index#join --> Transcription Socket Connection Failed',
@@ -6271,12 +6676,10 @@ export default class Meeting extends StatelessWebexPlugin {
6271
6676
  this.clearLLMHealthCheckTimer();
6272
6677
 
6273
6678
  this.llmHealthCheckTimer = setTimeout(() => {
6274
- // @ts-ignore
6275
- const isConnected = this.webex.internal.llm.isConnected();
6679
+ const isConnected = this.llmChannel?.isConnected() ?? false;
6276
6680
 
6277
6681
  if (!isConnected) {
6278
- // @ts-ignore
6279
- const {hasEverConnected} = this.webex.internal.llm;
6682
+ const hasEverConnected = this.llmChannel?.hasEverConnected ?? false;
6280
6683
 
6281
6684
  // only send metric if not connected - to avoid too many metrics
6282
6685
  Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.LLM_HEALTHCHECK_FAILURE, {
@@ -6302,28 +6705,88 @@ export default class Meeting extends StatelessWebexPlugin {
6302
6705
  }
6303
6706
 
6304
6707
  /**
6305
- * Disconnects and cleans up the default LLM session listeners/timers.
6708
+ * Removes LLM event listeners and clears the health check timer.
6709
+ * Must be called before Locus /leave to avoid unnecessary syncs triggered
6710
+ * by events received while leaving (per Locus team recommendation).
6711
+ * Idempotent: safe to call multiple times; .off() is a no-op when no
6712
+ * matching listener is registered.
6713
+ * @private
6714
+ * @returns {void}
6715
+ */
6716
+ private stopListeningForLLMEvents() {
6717
+ this.llmChannel?.off('event:relay.event', this.processRelayEvent);
6718
+ this.llmChannel?.off(LOCUS_LLM_EVENT, this.processLocusLLMEvent);
6719
+ this.llmChannel?.off('online', this.handleLLMOnline);
6720
+ this.breakouts?.unregisterLLMChannel();
6721
+ // voiceaChannel persists across LLM reconnects; switchLLMChannel() handles re-subscribing
6722
+ this.clearLLMHealthCheckTimer();
6723
+ }
6724
+
6725
+ /**
6726
+ * Stops listening on every event bus (LLM, Mercury, voicea/transcription,
6727
+ * annotation) that could otherwise deliver events to this meeting while
6728
+ * Locus is processing /leave or /end. Per the Locus team recommendation,
6729
+ * this must run before the Locus request is dispatched to avoid
6730
+ * unnecessary syncs triggered by in-flight events.
6731
+ *
6732
+ * Voicea (transcription) subscribes to llm 'event:relay.event' internally,
6733
+ * and the annotation plugin subscribes to both mercury and llm, so both
6734
+ * must be torn down alongside the direct LLM/Mercury listeners.
6735
+ *
6736
+ * Idempotent: safe to call multiple times; .off() is a no-op when no
6737
+ * matching listener is registered, and stopTranscription is guarded.
6738
+ * @private
6739
+ * @returns {void}
6740
+ */
6741
+ private stopListeningForMeetingEvents() {
6742
+ this.stopListeningForLLMEvents();
6743
+ this.stopListeningForMercuryEvents();
6744
+ if (this.areVoiceaEventsSetup) {
6745
+ this.stopTranscription();
6746
+ }
6747
+ // Reset to initial shape instead of null - transcription is always a valid object
6748
+ this.transcription = this.getInitialTranscription();
6749
+ this.annotation.deregisterEvents();
6750
+ }
6751
+
6752
+ /**
6753
+ * Disconnects and cleans up the LLM channel owned by this meeting.
6754
+ *
6306
6755
  * @param {Object} options
6307
- * @param {boolean} [options.removeOnlineListener=true] removes the one-time online listener
6308
6756
  * @param {boolean} [options.throwOnError=true] rethrows disconnect errors when true
6757
+ * @param {boolean} [options.preserveVoiceaChannel=false] when true, keeps voiceaChannel for switchLLMChannel() during reconnects
6309
6758
  * @returns {Promise<void>}
6310
6759
  */
6311
6760
  private cleanupLLMConneciton = async ({
6312
- removeOnlineListener = true,
6313
6761
  throwOnError = true,
6762
+ preserveVoiceaChannel = false,
6314
6763
  }: {
6315
- removeOnlineListener?: boolean;
6316
6764
  throwOnError?: boolean;
6765
+ preserveVoiceaChannel?: boolean;
6317
6766
  } = {}): Promise<void> => {
6767
+ // Always clear the timer, even if there's no channel
6768
+ this.clearLLMHealthCheckTimer();
6769
+
6770
+ // Permanent cleanup must deregister voiceaChannel regardless of LLM presence.
6771
+ // When a transient reconnect fails (LLM registration error), llmChannel is undefined
6772
+ // but voiceaChannel may still exist with listeners attached to the old emitter.
6773
+ if (!preserveVoiceaChannel) {
6774
+ this.voiceaChannel?.deregisterEvents();
6775
+ this.voiceaChannel = undefined;
6776
+ }
6777
+
6778
+ if (!this.llmChannel) {
6779
+ return;
6780
+ }
6781
+
6318
6782
  try {
6319
- // @ts-ignore - Fix type
6320
- await this.webex.internal.llm.disconnectLLM({
6783
+ await this.llmChannel.disconnect({
6321
6784
  code: 3050,
6322
6785
  reason: 'done (permanent)',
6323
6786
  });
6324
6787
  } catch (error) {
6325
6788
  LoggerProxy.logger.error(
6326
- 'Meeting:index#cleanupLLMConneciton --> Failed to disconnect default LLM session',
6789
+ 'Meeting:index#cleanupLLMConneciton --> Failed to disconnect LLM channel',
6327
6790
  error
6328
6791
  );
6329
6792
 
@@ -6331,32 +6794,25 @@ export default class Meeting extends StatelessWebexPlugin {
6331
6794
  throw error;
6332
6795
  }
6333
6796
  } 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();
6797
+ this.stopListeningForLLMEvents();
6798
+ this.llmChannel = undefined;
6344
6799
  }
6345
6800
  };
6346
6801
 
6347
6802
  /**
6348
- * Clears all data channel tokens stored in LLM.
6349
- * Called during meeting cleanup to ensure stale tokens are not reused.
6803
+ * Sets the datachannel token on the meeting's LLM channel.
6804
+ * Used by the DataChannelAuthTokenInterceptor after refreshing tokens.
6805
+ * @param {string} token - The new datachannel token
6350
6806
  * @returns {void}
6351
6807
  */
6352
- clearDataChannelToken(): void {
6353
- // @ts-ignore
6354
- this.webex.internal.llm.resetDatachannelTokens();
6808
+ setLLMChannelDataToken(token: string): void {
6809
+ this.llmChannel?.setDatachannelToken(token);
6355
6810
  }
6356
6811
 
6357
6812
  /**
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.
6813
+ * Saves the data channel tokens from the join response.
6814
+ * Default session token is stored on this.llmChannel when available.
6815
+ * Practice session token is stored on the webinar's practice LLM channel.
6360
6816
  * @param {Object} join - The parsed join response (from MeetingUtil.parseLocusJoin)
6361
6817
  * @returns {void}
6362
6818
  */
@@ -6364,17 +6820,19 @@ export default class Meeting extends StatelessWebexPlugin {
6364
6820
  const datachannelToken = join?.locus?.self?.datachannelToken;
6365
6821
  const practiceSessionDatachannelToken = join?.locus?.self?.practiceSessionDatachannelToken;
6366
6822
 
6823
+ // Store default session token on our LLM channel if it exists
6824
+ if (datachannelToken && this.llmChannel) {
6825
+ this.llmChannel.setDatachannelToken(datachannelToken);
6826
+ }
6827
+
6828
+ // Store the token temporarily for use when channel is created
6367
6829
  if (datachannelToken) {
6368
- // @ts-ignore
6369
- this.webex.internal.llm.setDatachannelToken(datachannelToken, DataChannelTokenType.Default);
6830
+ this._pendingDatachannelToken = datachannelToken;
6370
6831
  }
6371
6832
 
6833
+ // Practice session token is handled by webinar
6372
6834
  if (practiceSessionDatachannelToken) {
6373
- // @ts-ignore
6374
- this.webex.internal.llm.setDatachannelToken(
6375
- practiceSessionDatachannelToken,
6376
- DataChannelTokenType.PracticeSession
6377
- );
6835
+ this.webinar.setPracticeSessionDatachannelToken(practiceSessionDatachannelToken);
6378
6836
  }
6379
6837
  }
6380
6838
 
@@ -6385,8 +6843,8 @@ export default class Meeting extends StatelessWebexPlugin {
6385
6843
  */
6386
6844
  private async ensureDefaultDatachannelTokenAfterAdmit(): Promise<boolean> {
6387
6845
  try {
6388
- // @ts-ignore
6389
- const datachannelToken = this.webex.internal.llm.getDatachannelToken();
6846
+ const datachannelToken =
6847
+ this.llmChannel?.getDatachannelToken() ?? this._pendingDatachannelToken;
6390
6848
  // @ts-ignore
6391
6849
  const isDataChannelTokenEnabled = await this.webex.internal.llm.isDataChannelTokenEnabled();
6392
6850
 
@@ -6405,11 +6863,12 @@ export default class Meeting extends StatelessWebexPlugin {
6405
6863
  return false;
6406
6864
  }
6407
6865
 
6408
- // @ts-ignore
6409
- this.webex.internal.llm.setDatachannelToken(
6410
- fetchedDatachannelToken,
6411
- DataChannelTokenType.Default
6412
- );
6866
+ // Store on channel if exists, otherwise save as pending
6867
+ if (this.llmChannel) {
6868
+ this.llmChannel.setDatachannelToken(fetchedDatachannelToken);
6869
+ } else {
6870
+ this._pendingDatachannelToken = fetchedDatachannelToken;
6871
+ }
6413
6872
 
6414
6873
  return true;
6415
6874
  } catch (error) {
@@ -6427,61 +6886,224 @@ export default class Meeting extends StatelessWebexPlugin {
6427
6886
  /**
6428
6887
  * Connects to low latency mercury and reconnects if the address has changed
6429
6888
  * It will also disconnect if called when the meeting has ended
6889
+ * @param {Object} [options]
6890
+ * @param {boolean} [options.isInitialJoinPhase] true when called from initial join flow
6430
6891
  * @returns {Promise}
6431
6892
  */
6432
- async updateLLMConnection() {
6893
+ async updateLLMConnection({isInitialJoinPhase = false}: {isInitialJoinPhase?: boolean} = {}) {
6433
6894
  // @ts-ignore - Fix type
6434
6895
  const {url = undefined, info: {datachannelUrl = undefined} = {}} = this.locusInfo || {};
6435
6896
 
6436
6897
  const isJoined = this.isJoined();
6898
+ const dataChannelUrl = datachannelUrl;
6437
6899
 
6438
- // @ts-ignore
6439
- const datachannelToken = this.webex.internal.llm.getDatachannelToken(
6440
- DataChannelTokenType.Default
6441
- );
6900
+ // If we have an existing channel, check if we should reuse it or clean it up
6901
+ if (this.llmChannel) {
6902
+ const isSameUrls =
6903
+ url === this.llmChannel.getLocusUrl() &&
6904
+ dataChannelUrl === this.llmChannel.getDatachannelUrl();
6442
6905
 
6443
- const dataChannelUrl = datachannelUrl;
6906
+ // If already connected to same URLs, skip reconnect
6907
+ if (this.llmChannel.isConnected() && isSameUrls && isJoined) {
6908
+ return undefined;
6909
+ }
6444
6910
 
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
- ) {
6911
+ // If currently connecting to same URLs, wait for that to complete
6912
+ if (this.llmChannel.isConnecting() && isSameUrls && isJoined) {
6454
6913
  return undefined;
6455
6914
  }
6456
- await this.cleanupLLMConneciton({removeOnlineListener: false});
6915
+
6916
+ // URLs changed or not joined, disconnect existing channel
6917
+ await this.cleanupLLMConneciton({preserveVoiceaChannel: true});
6457
6918
  }
6458
6919
 
6459
6920
  if (!isJoined) {
6460
6921
  return undefined;
6461
6922
  }
6462
6923
 
6924
+ // Create a new LLM channel for this meeting
6463
6925
  // @ts-ignore - Fix type
6464
- return this.webex.internal.llm
6926
+ this.llmChannel = this.webex.internal.llm.createChannel();
6927
+
6928
+ // Get token from pending (saved from join response) or channel
6929
+ const datachannelToken = this._pendingDatachannelToken ?? this.llmChannel.getDatachannelToken();
6930
+
6931
+ // Set up refresh handler before registration so interceptor-triggered token
6932
+ // refresh during register POST can resolve a valid handler.
6933
+ this.llmChannel.setRefreshHandler(() => this.refreshDataChannelToken());
6934
+
6935
+ // If we have a pending token, store it on the channel
6936
+ if (this._pendingDatachannelToken) {
6937
+ this.llmChannel.setDatachannelToken(this._pendingDatachannelToken);
6938
+ this._pendingDatachannelToken = undefined;
6939
+ }
6940
+
6941
+ return this.llmChannel
6465
6942
  .registerAndConnect(url, dataChannelUrl, datachannelToken)
6466
6943
  .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);
6944
+ this.locusInfo.syncAllHashTreeDatasets({onlyLLM: true});
6945
+
6946
+ // Register event listeners on the channel
6947
+ this.llmChannel.off('event:relay.event', this.processRelayEvent);
6948
+ this.llmChannel.on('event:relay.event', this.processRelayEvent);
6949
+ this.llmChannel.off(LOCUS_LLM_EVENT, this.processLocusLLMEvent);
6950
+ this.llmChannel.on(LOCUS_LLM_EVENT, this.processLocusLLMEvent);
6951
+ this.llmChannel.off('online', this.handleLLMOnline);
6952
+ this.llmChannel.on('online', this.handleLLMOnline);
6953
+
6954
+ // Register annotation channel only if not in practice session
6955
+ // (practice session manages its own annotation channel via updatePSDataChannel)
6956
+ if (!this.webinar?.isJoinPracticeSessionDataChannel()) {
6957
+ this.annotation.registerChannel(this.llmChannel);
6958
+ }
6959
+
6960
+ // Register breakouts channel
6961
+ this.breakouts.registerLLMChannel(this.llmChannel);
6962
+
6475
6963
  LoggerProxy.logger.info(
6476
6964
  'Meeting:index#updateLLMConnection --> enabled to receive relay events!'
6477
6965
  );
6478
-
6479
6966
  this.startLLMHealthCheckTimer();
6480
6967
 
6968
+ // Switch voiceaChannel to use the new LLM channel (preserves transcription state).
6969
+ // Skip if practice session is active - practice session manages its own voicea binding
6970
+ // via updatePSDataChannel, and switching here would break practice session captions.
6971
+ const isPracticeSessionActive =
6972
+ this.webinar?.isPracticeSessionLLMChannelConnected() ?? false;
6973
+
6974
+ if (!this.voiceaChannel) {
6975
+ // @ts-ignore - Fix type
6976
+ this.voiceaChannel = this.webex.internal.voicea.createChannel();
6977
+ }
6978
+
6979
+ if (!isPracticeSessionActive) {
6980
+ // Fire-and-forget: caption restoration shouldn't block LLM connection result.
6981
+ // transcription is always initialized (reset to initial shape, never null),
6982
+ // so no re-init needed here.
6983
+ this.voiceaChannel
6984
+ .switchLLMChannel(this.llmChannel)
6985
+ .then(() => {
6986
+ this.startTranscriptionIfNeeded();
6987
+ })
6988
+ .catch((error) => {
6989
+ LoggerProxy.logger.warn(
6990
+ 'Meeting:index#updateLLMConnection --> failed to switch voicea channel:',
6991
+ error
6992
+ );
6993
+ });
6994
+ }
6995
+
6996
+ if (registerAndConnectResult) {
6997
+ if (isInitialJoinPhase) {
6998
+ this.sendLLMConnectMetric(registerAndConnectResult);
6999
+ }
7000
+
7001
+ this.breakouts?.trigger(BREAKOUTS.EVENTS.LLM_CONNECT_RESPONSE, {
7002
+ meeting: this,
7003
+ llmLatency: registerAndConnectResult,
7004
+ });
7005
+ }
7006
+
6481
7007
  return Promise.resolve(registerAndConnectResult);
7008
+ })
7009
+ .catch((error) => {
7010
+ // Prefer the partial timing registerAndConnect attaches when register succeeded but the
7011
+ // websocket connect() failed, so a ws failure isn't misreported as register never completing.
7012
+ const llmLatency = {
7013
+ clientLLMDatachannelResponseTime: error?.timing?.clientLLMDatachannelResponseTime ?? 0,
7014
+ clientLLMWebSocketConnectTime: 0,
7015
+ };
7016
+
7017
+ if (isInitialJoinPhase) {
7018
+ this.sendLLMConnectMetric(llmLatency, error);
7019
+ }
7020
+
7021
+ this.breakouts?.trigger(BREAKOUTS.EVENTS.LLM_CONNECT_RESPONSE, {
7022
+ meeting: this,
7023
+ llmLatency,
7024
+ error,
7025
+ });
7026
+
7027
+ // Clean up the channel on failure
7028
+ this.llmChannel = undefined;
7029
+
7030
+ return Promise.reject(error);
6482
7031
  });
6483
7032
  }
6484
7033
 
7034
+ /**
7035
+ * Ensures breakout join response metric with LLM latency is emitted only once per breakout move id.
7036
+ * @param {string | undefined} breakoutMoveId
7037
+ * @param {boolean} [hasLLMLatency=false]
7038
+ * @returns {boolean}
7039
+ */
7040
+ private shouldEmitBreakoutJoinResponseMetric(
7041
+ breakoutMoveId?: string,
7042
+ hasLLMLatency = false
7043
+ ): boolean {
7044
+ if (!breakoutMoveId) {
7045
+ return false;
7046
+ }
7047
+
7048
+ if (!hasLLMLatency) {
7049
+ // When automatic LLM is enabled, updateLLMConnection will emit this same breakout join
7050
+ // response after the LLM connection finishes, including llmLatency and llmWebsocketUrl.
7051
+ // Suppress the earlier non-LLM event to avoid sending two events for the same move id,
7052
+ // where the first one would be missing the LLM-specific fields we want to validate.
7053
+ // @ts-ignore - config coming from registerPlugin
7054
+ return !this.config.enableAutomaticLLM;
7055
+ }
7056
+
7057
+ if (this.emittedBreakoutJoinResponseMoveIds.has(breakoutMoveId)) {
7058
+ return false;
7059
+ }
7060
+
7061
+ this.emittedBreakoutJoinResponseMoveIds.add(breakoutMoveId);
7062
+
7063
+ return true;
7064
+ }
7065
+
7066
+ /**
7067
+ * Sends LLM connect latencies for initial join flow.
7068
+ * @param {RegisterAndConnectTiming} timings
7069
+ * @param {any} [error]
7070
+ * @returns {void}
7071
+ */
7072
+ private sendLLMConnectMetric(timings: RegisterAndConnectTiming, error?: any) {
7073
+ // @ts-ignore
7074
+ const llmWebsocketUrl = this.webex.internal.llm.getWebSocketUrl?.() || undefined;
7075
+ const {clientLLMDatachannelResponseTime = 0, clientLLMWebSocketConnectTime} = timings || {};
7076
+
7077
+ const llmLatency: any = {
7078
+ clientLLMDatachannelResponseTime,
7079
+ };
7080
+
7081
+ if (clientLLMWebSocketConnectTime !== undefined) {
7082
+ llmLatency.clientLLMWebSocketConnectTime = clientLLMWebSocketConnectTime;
7083
+ }
7084
+
7085
+ const payload: any = {
7086
+ identifiers: {
7087
+ llmWebsocketUrl,
7088
+ },
7089
+ llmLatency,
7090
+ };
7091
+
7092
+ const options: any = {
7093
+ meetingId: this.id,
7094
+ ...(error && {rawError: error}),
7095
+ };
7096
+
7097
+ const metricEvent = {
7098
+ name: 'client.llm.connect.response',
7099
+ payload,
7100
+ options,
7101
+ };
7102
+
7103
+ // @ts-ignore
7104
+ this.webex.internal.newMetrics.submitClientEvent(metricEvent);
7105
+ }
7106
+
6485
7107
  /**
6486
7108
  * Use phone for meeting audio
6487
7109
  * @param {String} phoneNumber If provided, it will dial-out using this number. If not provided, dial-in will be used
@@ -6909,16 +7531,32 @@ export default class Meeting extends StatelessWebexPlugin {
6909
7531
  // @ts-ignore
6910
7532
  const cdl = this.webex.internal.newMetrics.callDiagnosticLatencies;
6911
7533
 
7534
+ // Compute the offer->answer latency from when the local SDP offer was generated up to now,
7535
+ // rather than from the stored remote-sdp-received timestamp. That stored timestamp uses
7536
+ // saveFirstTimestampOnly, so if waitForRemoteSDPAnswer() already timed out and submitted a
7537
+ // remote-sdp-received event, the stored value would be pinned to the timeout time and would
7538
+ // under-report an answer that arrives late. This handler fires exactly when the answer is
7539
+ // processed, so Date.now() is the accurate "received" time.
7540
+ // (submitClientEvent below still records the remote-sdp-received timestamp used by the CA
7541
+ // join-time metric, so we don't need to save it here.)
7542
+ const localSdpGeneratedTimestamp = cdl.latencyTimestamps.get(
7543
+ 'client.media-engine.local-sdp-generated'
7544
+ );
7545
+ const localSDPGenRemoteSDPRecv =
7546
+ localSdpGeneratedTimestamp !== undefined
7547
+ ? Date.now() - localSdpGeneratedTimestamp
7548
+ : undefined;
7549
+
6912
7550
  // @ts-ignore
6913
7551
  this.webex.internal.newMetrics.submitClientEvent({
6914
7552
  name: 'client.media-engine.remote-sdp-received',
7553
+ payload: {
7554
+ eventData: {
7555
+ localSDPGenRemoteSDPRecv,
7556
+ },
7557
+ },
6915
7558
  options: {meetingId: this.id},
6916
7559
  });
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
7560
 
6923
7561
  if (this.deferSDPAnswer) {
6924
7562
  this.deferSDPAnswer.resolve();
@@ -7504,23 +8142,108 @@ export default class Meeting extends StatelessWebexPlugin {
7504
8142
  }
7505
8143
  }
7506
8144
  });
8145
+ this.statsAnalyzer.on(StatsAnalyzerEventNames.STATS_UPDATE, (data) => {
8146
+ // Extract srtpCipher from transport stats
8147
+ let srtpCipher: string | undefined;
8148
+ for (const stats of data.stats.values()) {
8149
+ if (stats.type === 'transport' && stats.srtpCipher) {
8150
+ srtpCipher = stats.srtpCipher as string;
8151
+ break;
8152
+ }
8153
+ }
8154
+
8155
+ // Only emit event if srtpCipher has changed
8156
+ if (srtpCipher && srtpCipher !== this.mediaProperties.srtpCipher) {
8157
+ LoggerProxy.logger.info(
8158
+ `Meeting:index#setupStatsAnalyzerEventHandlers --> SRTP cipher changed from ${this.mediaProperties.srtpCipher} to ${srtpCipher}`
8159
+ );
8160
+ this.mediaProperties.srtpCipher = srtpCipher;
8161
+ Trigger.trigger(
8162
+ this,
8163
+ {
8164
+ file: 'meeting/index',
8165
+ function: 'setupStatsAnalyzerEventHandlers',
8166
+ },
8167
+ EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
8168
+ {srtpCipher}
8169
+ );
8170
+ }
8171
+ });
7507
8172
  };
7508
8173
 
7509
8174
  getMediaConnectionDebugId() {
7510
8175
  return `MC-${this.id.substring(0, 4)}`;
7511
8176
  }
7512
8177
 
8178
+ /**
8179
+ * Checks if the error indicates that Locus dropped us from the meeting,
8180
+ * either directly on the error or wrapped inside an AddMediaFailed cause.
8181
+ * This method is meant to be called only with errors thrown by Meeting.addMediaInternal()
8182
+ *
8183
+ * @param {Error} error
8184
+ * @returns {boolean}
8185
+ */
8186
+ private isErrorMeaningLocusDroppedUs(error: Error | undefined): boolean {
8187
+ const statusCode = (error as any)?.statusCode;
8188
+ const causeStatusCode = (error as any)?.cause?.statusCode;
8189
+
8190
+ return (
8191
+ statusCode === 409 || statusCode === 403 || causeStatusCode === 409 || causeStatusCode === 403
8192
+ );
8193
+ }
8194
+
8195
+ private isLocusUserFullError(error: Error | undefined): boolean {
8196
+ return (error as any)?.error?.body?.errorCode === LocusErrorCodes.LOCUS_USER_FULL;
8197
+ }
8198
+
8199
+ /**
8200
+ * Determines if the next media attempt should use only TURN-TLS (iceTransportPolicy='relay').
8201
+ * We do this in the hope that it will minimize the chance of Homer sending DTLS packets on a wrong
8202
+ * transport (as there will be only 1 transport) and dealing with firewalls that let STUN packets through, but block
8203
+ * other UDP traffic.
8204
+ *
8205
+ * For clients landing on video mesh nodes (VMN), reachability might still have successful TLS (to public nodes)
8206
+ * but TURN discovery will result in empty TURN urls array and iceTransportPolicy='relay' will still be overriden to undefined,
8207
+ * see the code in establishMediaConnection()
8208
+ *
8209
+ * @param {Error} prevError - The error from the previous addMedia attempt
8210
+ * @returns {Promise<boolean>}
8211
+ */
8212
+ private async shouldRetryMediaWithOnlyTurnTLS(prevError: Error | undefined): Promise<boolean> {
8213
+ if (
8214
+ this.isMultistream &&
8215
+ prevError instanceof AddMediaFailed &&
8216
+ prevError.isDtlsHandshakeFailure &&
8217
+ prevError.connectionType === 'UDP'
8218
+ ) {
8219
+ const hasTlsReachability =
8220
+ // @ts-ignore
8221
+ await this.webex.meetings.reachability.isAnyClusterReachableViaProtocol('xtls');
8222
+
8223
+ if (hasTlsReachability) {
8224
+ LoggerProxy.logger.info(
8225
+ 'Meeting:index#shouldRetryMediaWithOnlyTurnTLS --> previous attempt failed due to DTLS handshake failure over UDP and TLS reachability is available'
8226
+ );
8227
+
8228
+ return true;
8229
+ }
8230
+ }
8231
+
8232
+ return false;
8233
+ }
8234
+
7513
8235
  /**
7514
8236
  * Creates a webrtc media connection and publishes streams to it
7515
8237
  *
7516
8238
  * @param {Object} turnServerInfo TURN server information
7517
8239
  * @param {BundlePolicy} [bundlePolicy] Bundle policy settings
7518
- * @param {AddMediaOptions} [options] Options for enabling/disabling audio/video
8240
+ * @param {RTCIceTransportPolicy} [iceTransportPolicy] ICE transport policy override
7519
8241
  * @returns {RoapMediaConnection | MultistreamRoapMediaConnection}
7520
8242
  */
7521
8243
  private async createMediaConnection(
7522
8244
  turnServerInfo?: TurnServerInfo,
7523
- bundlePolicy?: BundlePolicy
8245
+ bundlePolicy?: BundlePolicy,
8246
+ iceTransportPolicy?: RTCIceTransportPolicy
7524
8247
  ) {
7525
8248
  this.rtcMetrics = this.isMultistream
7526
8249
  ? // @ts-ignore
@@ -7544,12 +8267,15 @@ export default class Meeting extends StatelessWebexPlugin {
7544
8267
  enableExtmap: this.config.enableExtmap,
7545
8268
  turnServerInfo,
7546
8269
  bundlePolicy,
8270
+ iceTransportPolicy,
7547
8271
  // @ts-ignore - config coming from registerPlugin
7548
8272
  iceCandidatesTimeout: this.config.iceCandidatesGatheringTimeout,
7549
8273
  // @ts-ignore - config coming from registerPlugin
7550
8274
  disableAudioMainDtx: this.config.experimental.disableAudioMainDtx,
7551
8275
  // @ts-ignore - config coming from registerPlugin
7552
8276
  enableAudioTwcc: this.config.enableAudioTwccForMultistream,
8277
+ // @ts-ignore - config coming from registerPlugin
8278
+ enableAv1SlidesSupport: this.config.enableAv1SlidesSupport,
7553
8279
  stopIceGatheringAfterFirstRelayCandidate:
7554
8280
  // @ts-ignore - config coming from registerPlugin
7555
8281
  this.config.stopIceGatheringAfterFirstRelayCandidate,
@@ -7569,6 +8295,7 @@ export default class Meeting extends StatelessWebexPlugin {
7569
8295
  this.mediaProperties.mediaDirection.receiveShare,
7570
8296
  ];
7571
8297
 
8298
+ this.sendSlotManager.reset();
7572
8299
  this.sendSlotManager.createSlot(mc, MediaType.VideoMain, videoEnabled);
7573
8300
  this.sendSlotManager.createSlot(mc, MediaType.AudioMain, audioEnabled);
7574
8301
  this.sendSlotManager.createSlot(mc, MediaType.VideoSlides, shareEnabled);
@@ -7668,7 +8395,7 @@ export default class Meeting extends StatelessWebexPlugin {
7668
8395
  try {
7669
8396
  await this.mediaProperties.waitForMediaConnectionConnected(this.correlationId);
7670
8397
  } catch (error) {
7671
- const {iceConnected} = error;
8398
+ const {iceConnected} = error as MediaConnectionAwaiterFailureResult;
7672
8399
 
7673
8400
  if (!this.hasMediaConnectionConnectedAtLeastOnce) {
7674
8401
  // Only send CA event for join flow if we haven't successfully connected media yet
@@ -7708,13 +8435,12 @@ export default class Meeting extends StatelessWebexPlugin {
7708
8435
  });
7709
8436
  }
7710
8437
 
7711
- const timedOutError = new Error(
7712
- `Timed out waiting for media connection to be connected, correlationId=${this.correlationId}`
8438
+ throw new MediaConnectionTimedOutError(
8439
+ `Timed out waiting for media connection to be connected, correlationId=${this.correlationId}`,
8440
+ iceConnected,
8441
+ // keep reference to the original rejected result (which is the object the SDK reports to CA as rawError above)
8442
+ error
7713
8443
  );
7714
-
7715
- timedOutError.cause = error;
7716
-
7717
- throw timedOutError;
7718
8444
  }
7719
8445
  }
7720
8446
 
@@ -7760,12 +8486,12 @@ export default class Meeting extends StatelessWebexPlugin {
7760
8486
  return !member.isSelf && !member.isPairedWithSelf && !member.isAudioMuted;
7761
8487
  });
7762
8488
 
7763
- if (atLeastOneUnmutedOtherMember) {
7764
- this.mediaProperties.sendMediaIssueMetric(
7765
- 'inbound_audio',
7766
- data.issueSubType,
7767
- this.correlationId
7768
- );
8489
+ // we also ignore any issues while we're waiting in the lobby, as we're not receiving any audio yet
8490
+ if (atLeastOneUnmutedOtherMember && !this.isUserUnadmitted) {
8491
+ this.mediaProperties.sendMediaIssueMetric('inbound_audio', data.issueSubType, {
8492
+ correlationId: this.correlationId,
8493
+ isMultistream: this.isMultistream,
8494
+ });
7769
8495
 
7770
8496
  Trigger.trigger(
7771
8497
  this,
@@ -7927,7 +8653,20 @@ export default class Meeting extends StatelessWebexPlugin {
7927
8653
  error
7928
8654
  );
7929
8655
 
7930
- throw new AddMediaFailed(error);
8656
+ const {connectionType, selectedCandidatePairChanges, numTransports} =
8657
+ await this.mediaProperties.getCurrentConnectionInfo();
8658
+
8659
+ const iceConnected = error instanceof MediaConnectionTimedOutError && error.iceConnected;
8660
+
8661
+ throw new AddMediaFailed({
8662
+ cause: error,
8663
+ connectionType,
8664
+ selectedCandidatePairChanges,
8665
+ numTransports,
8666
+ iceConnected,
8667
+ iceConnectedAtLeastOnce:
8668
+ error instanceof MediaConnectionTimedOutError ? error.iceConnectedAtLeastOnce : undefined,
8669
+ });
7931
8670
  }
7932
8671
  }
7933
8672
 
@@ -8002,7 +8741,21 @@ export default class Meeting extends StatelessWebexPlugin {
8002
8741
  ({turnServerInfo} = await this.doTurnDiscovery(isReconnecting, isForced));
8003
8742
  }
8004
8743
 
8005
- const mc = await this.createMediaConnection(turnServerInfo, bundlePolicy);
8744
+ if (
8745
+ (!turnServerInfo || !turnServerInfo.urls?.length) &&
8746
+ this.addMediaData.iceTransportPolicy === 'relay'
8747
+ ) {
8748
+ LoggerProxy.logger.info(
8749
+ `${LOG_HEADER} cannot do iceTransportPolicy=relay, because there is no turn server info available`
8750
+ );
8751
+ // drop the forced relay policy and use the default, because we don't have a TURN server
8752
+ this.addMediaData.iceTransportPolicy = undefined;
8753
+ }
8754
+ const mediaConnection = await this.createMediaConnection(
8755
+ turnServerInfo,
8756
+ bundlePolicy,
8757
+ this.addMediaData.iceTransportPolicy
8758
+ );
8006
8759
 
8007
8760
  LoggerProxy.logger.info(
8008
8761
  `${LOG_HEADER} media connection created this.isMultistream=${this.isMultistream}`
@@ -8039,7 +8792,7 @@ export default class Meeting extends StatelessWebexPlugin {
8039
8792
  await this.remoteMediaManager.start();
8040
8793
  }
8041
8794
 
8042
- await mc.initiateOffer();
8795
+ await mediaConnection.initiateOffer();
8043
8796
 
8044
8797
  await this.waitForRemoteSDPAnswer();
8045
8798
 
@@ -8107,6 +8860,9 @@ export default class Meeting extends StatelessWebexPlugin {
8107
8860
 
8108
8861
  this.isMultistream = false;
8109
8862
 
8863
+ // reset iceTransportPolicy, because it's only applied for multistream media connections
8864
+ this.addMediaData.iceTransportPolicy = undefined;
8865
+
8110
8866
  if (this.mediaProperties.webrtcMediaConnection) {
8111
8867
  // close peer connection, but don't reset mute state information, because we will want to use it on the retry
8112
8868
  this.closePeerConnections(false);
@@ -8187,6 +8943,8 @@ export default class Meeting extends StatelessWebexPlugin {
8187
8943
  regionCode: this.webex.meetings.geoHintInfo?.regionCode,
8188
8944
  },
8189
8945
  preferTranscoding: !this.isMultistream,
8946
+ getCurrentSelfUrl: () => this.selfUrl,
8947
+ waitForSelfUrlChange: () => this.waitForSelfUrlChange(),
8190
8948
  },
8191
8949
  {
8192
8950
  // @ts-ignore
@@ -8195,6 +8953,41 @@ export default class Meeting extends StatelessWebexPlugin {
8195
8953
  );
8196
8954
  }
8197
8955
 
8956
+ /**
8957
+ * Waits for LocusInfo to update meeting.selfUrl, with a timeout fallback.
8958
+ * @returns {Promise<void>}
8959
+ * @private
8960
+ * @memberof Meeting
8961
+ */
8962
+ private waitForSelfUrlChange(): Promise<void> {
8963
+ if (this.joinWithMediaRetryInfo.retryCount > 0) {
8964
+ /* During joinWithMedia() retries we can get 403/409 from Locus and it doesn't mean
8965
+ * that the selfUrl will change, it is usually caused by Locus dropping us as a result of
8966
+ * media connection failure during joinWithMedia's earlier media connection attempt,
8967
+ * so we don't want to wait for selfUrl change as this would only slow down the join process. */
8968
+ LoggerProxy.logger.info(
8969
+ 'Meeting:index#waitForSelfUrlChange --> joinWithMedia retry in progress, will not wait for selfUrl change'
8970
+ );
8971
+
8972
+ return Promise.resolve();
8973
+ }
8974
+
8975
+ if (!this.promisesWaitingForPropUpdate.selfUrl) {
8976
+ const pendingSelfUrlUpdate = new Defer();
8977
+
8978
+ this.promisesWaitingForPropUpdate.selfUrl = pendingSelfUrlUpdate;
8979
+
8980
+ setTimeout(() => {
8981
+ if (this.promisesWaitingForPropUpdate.selfUrl === pendingSelfUrlUpdate) {
8982
+ delete this.promisesWaitingForPropUpdate.selfUrl;
8983
+ pendingSelfUrlUpdate.resolve();
8984
+ }
8985
+ }, 5000);
8986
+ }
8987
+
8988
+ return this.promisesWaitingForPropUpdate.selfUrl.promise;
8989
+ }
8990
+
8198
8991
  /**
8199
8992
  * Creates a media connection to the server. Media connection is required for sending or receiving any audio/video.
8200
8993
  *
@@ -8206,8 +8999,9 @@ export default class Meeting extends StatelessWebexPlugin {
8206
8999
  addMedia(options: AddMediaOptions = {}): Promise<void> {
8207
9000
  return this.addMediaInternal(
8208
9001
  () => (this.turnServerUsed ? 'JOIN_MEETING_FINAL' : 'JOIN_MEETING_RETRY'),
8209
- undefined,
8210
9002
  false,
9003
+ undefined /* turnServerInfo - it will be fetched via doTurnDiscovery() */,
9004
+ undefined /* iceTransportPolicy - we're relying on the default value */,
8211
9005
  options
8212
9006
  );
8213
9007
  }
@@ -8216,8 +9010,9 @@ export default class Meeting extends StatelessWebexPlugin {
8216
9010
  * Internal version of addMedia() with some more arguments for finer control of its behavior
8217
9011
  *
8218
9012
  * @param {Function} icePhaseCallback - callback to determine the icePhase for CA "client.ice.end" failure events
8219
- * @param {TurnServerInfo} turnServerInfo - TURN server information
8220
9013
  * @param {boolean} forceTurnDiscovery - if true, TURN discovery will be done
9014
+ * @param {TurnServerInfo} turnServerInfo - TURN server information
9015
+ * @param {RTCIceTransportPolicy} [iceTransportPolicy] - ICE transport policy override
8221
9016
  * @param {AddMediaOptions} options - same as options of the public addMedia() method
8222
9017
  * @returns {Promise<void>}
8223
9018
  * @protected
@@ -8225,21 +9020,30 @@ export default class Meeting extends StatelessWebexPlugin {
8225
9020
  */
8226
9021
  protected async addMediaInternal(
8227
9022
  icePhaseCallback: () => string,
8228
- turnServerInfo: TurnServerInfo,
8229
- forceTurnDiscovery,
9023
+ forceTurnDiscovery: boolean,
9024
+ turnServerInfo?: TurnServerInfo,
9025
+ iceTransportPolicy?: RTCIceTransportPolicy,
8230
9026
  options: AddMediaOptions = {}
8231
9027
  ): Promise<void> {
8232
9028
  this.addMediaData.retriedWithTurnServer = false;
8233
9029
  this.addMediaData.icePhaseCallback = icePhaseCallback;
9030
+ this.addMediaData.iceTransportPolicy = iceTransportPolicy;
8234
9031
 
8235
9032
  this.hasMediaConnectionConnectedAtLeastOnce = false;
8236
9033
  const LOG_HEADER = 'Meeting:index#addMedia -->';
9034
+ const optionsForLogging = {
9035
+ ...options,
9036
+ remoteMediaManagerConfig: getRemoteMediaManagerConfigForLogging(
9037
+ options.remoteMediaManagerConfig
9038
+ ),
9039
+ };
9040
+
8237
9041
  LoggerProxy.logger.info(
8238
9042
  `${LOG_HEADER} called with: options=${JSON.stringify(
8239
- options
9043
+ optionsForLogging
8240
9044
  )}, turnServerInfo=${JSON.stringify(
8241
9045
  turnServerInfo
8242
- )}, forceTurnDiscovery=${forceTurnDiscovery}`
9046
+ )}, forceTurnDiscovery=${forceTurnDiscovery}, iceTransportPolicy=${iceTransportPolicy}`
8243
9047
  );
8244
9048
 
8245
9049
  if (options.allowMediaInLobby !== true && this.meetingState !== FULL_STATE.ACTIVE) {
@@ -8353,12 +9157,7 @@ export default class Meeting extends StatelessWebexPlugin {
8353
9157
 
8354
9158
  // Establish new media connection with forced TURN discovery
8355
9159
  // 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
- );
9160
+ await this.establishMediaConnection(remoteMediaManagerConfig, bundlePolicy, true);
8362
9161
  } else {
8363
9162
  throw error;
8364
9163
  }
@@ -8387,7 +9186,8 @@ export default class Meeting extends StatelessWebexPlugin {
8387
9186
  numTransports,
8388
9187
  isMultistream: this.isMultistream,
8389
9188
  retriedWithTurnServer: this.addMediaData.retriedWithTurnServer,
8390
- isJoinWithMediaRetry: this.joinWithMediaRetryInfo.isRetry,
9189
+ isJoinWithMediaRetry: this.joinWithMediaRetryInfo.retryCount > 0,
9190
+ iceTransportPolicy: this.addMediaData.iceTransportPolicy || 'all',
8391
9191
  ...reachabilityMetrics,
8392
9192
  ...iceCandidateErrors,
8393
9193
  iceCandidatesCount: this.iceCandidatesCount,
@@ -8409,14 +9209,16 @@ export default class Meeting extends StatelessWebexPlugin {
8409
9209
  // We can log ReceiveSlot SSRCs only after the SDP exchange, so doing it here:
8410
9210
  this.remoteMediaManager?.logAllReceiveSlots();
8411
9211
  this.startPeriodicLogUpload();
8412
- } catch (error) {
9212
+ } catch (error: any) {
8413
9213
  LoggerProxy.logger.error(`${LOG_HEADER} failed to establish media connection: `, error);
8414
9214
 
8415
9215
  // @ts-ignore
8416
9216
  const reachabilityMetrics = await this.getMediaReachabilityMetricFields();
8417
9217
 
8418
- const {selectedCandidatePairChanges, numTransports} =
8419
- await this.mediaProperties.getCurrentConnectionInfo();
9218
+ const {connectionType, selectedCandidatePairChanges, numTransports} =
9219
+ error instanceof AddMediaFailed
9220
+ ? error
9221
+ : await this.mediaProperties.getCurrentConnectionInfo();
8420
9222
 
8421
9223
  const iceCandidateErrors = Object.fromEntries(this.iceCandidateErrors);
8422
9224
 
@@ -8432,7 +9234,8 @@ export default class Meeting extends StatelessWebexPlugin {
8432
9234
  turnServerUsed: this.turnServerUsed,
8433
9235
  retriedWithTurnServer: this.addMediaData.retriedWithTurnServer,
8434
9236
  isMultistream: this.isMultistream,
8435
- isJoinWithMediaRetry: this.joinWithMediaRetryInfo.isRetry,
9237
+ isJoinWithMediaRetry: this.joinWithMediaRetryInfo.retryCount > 0,
9238
+ iceTransportPolicy: this.addMediaData.iceTransportPolicy || 'all',
8436
9239
  signalingState:
8437
9240
  this.mediaProperties.webrtcMediaConnection?.multistreamConnection?.pc?.pc
8438
9241
  ?.signalingState ||
@@ -8448,6 +9251,7 @@ export default class Meeting extends StatelessWebexPlugin {
8448
9251
  ?.iceConnectionState ||
8449
9252
  this.mediaProperties.webrtcMediaConnection?.mediaConnection?.pc?.iceConnectionState ||
8450
9253
  'unknown',
9254
+ connectionType,
8451
9255
  ...reachabilityMetrics,
8452
9256
  ...iceCandidateErrors,
8453
9257
  iceCandidatesCount: this.iceCandidatesCount,
@@ -8796,6 +9600,7 @@ export default class Meeting extends StatelessWebexPlugin {
8796
9600
  options: {meetingId: this.id},
8797
9601
  });
8798
9602
  LoggerProxy.logger.log('Meeting:index#leave --> Leaving a meeting');
9603
+ this.stopListeningForMeetingEvents();
8799
9604
 
8800
9605
  return MeetingUtil.leaveMeeting(this, options)
8801
9606
  .then(async (leave) => {
@@ -9661,6 +10466,8 @@ export default class Meeting extends StatelessWebexPlugin {
9661
10466
  locus_id: this.locusId,
9662
10467
  });
9663
10468
 
10469
+ this.stopListeningForMeetingEvents();
10470
+
9664
10471
  return MeetingUtil.endMeetingForAll(this)
9665
10472
  .then(async (end) => {
9666
10473
  this.meetingFiniteStateMachine.end();
@@ -9722,13 +10529,14 @@ export default class Meeting extends StatelessWebexPlugin {
9722
10529
  }
9723
10530
  this.queuedMediaUpdates = [];
9724
10531
 
9725
- this.stopTranscription();
9726
- this.transcription = undefined;
10532
+ // Listener teardown (transcription, annotation, llm/mercury) runs in
10533
+ // stopListeningForMeetingEvents() before /leave and /end so events
10534
+ // received mid-teardown do not trigger Locus syncs.
10535
+ // Token cleanup happens automatically when cleanupLLMConneciton destroys the channel.
10536
+ // A new voiceaChannel is created on the next join. In-session LLM reconnects and
10537
+ // practice-session transitions use their own cleanup paths and preserve the channel.
9727
10538
 
9728
- this.annotation.deregisterEvents();
9729
-
9730
- this.clearDataChannelToken();
9731
- await this.cleanupLLMConneciton({throwOnError: false});
10539
+ await this.cleanupLLMConneciton({throwOnError: false, preserveVoiceaChannel: false});
9732
10540
  };
9733
10541
 
9734
10542
  /**
@@ -9804,15 +10612,12 @@ export default class Meeting extends StatelessWebexPlugin {
9804
10612
  * @public
9805
10613
  * @memberof Meeting
9806
10614
  */
9807
- public sendReaction(reactionType: ReactionServerType, skinToneType?: SkinToneType) {
10615
+ public sendReaction(reactionType: string, skinToneType?: SkinToneType) {
9808
10616
  const reactionChannelUrl = this.locusInfo?.controls?.reactions?.reactionChannelUrl as string;
9809
10617
  const participantId = this.members.selfId;
9810
10618
 
9811
- const reactionData = Reactions[reactionType];
10619
+ const reactionData = Reactions[reactionType] || {type: reactionType};
9812
10620
 
9813
- if (!reactionData) {
9814
- return Promise.reject(new Error(`${reactionType} is not a valid reaction.`));
9815
- }
9816
10621
  const skinToneData = SkinTones[skinToneType] || SkinTones.normal;
9817
10622
  const reaction: Reaction = {
9818
10623
  ...reactionData,
@@ -10467,6 +11272,34 @@ export default class Meeting extends StatelessWebexPlugin {
10467
11272
  }
10468
11273
  }
10469
11274
 
11275
+ /**
11276
+ * Checks if the LLM channel is connected.
11277
+ * Handles practice session context automatically - returns practice session
11278
+ * LLM channel status when in practice session, main LLM channel status otherwise.
11279
+ * @returns {boolean} True if the appropriate LLM channel is connected
11280
+ */
11281
+ public isLLMConnected(): boolean {
11282
+ if (this.webinar?.isJoinPracticeSessionDataChannel()) {
11283
+ return this.webinar.isPracticeSessionLLMChannelConnected();
11284
+ }
11285
+
11286
+ return this.llmChannel?.isConnected() ?? false;
11287
+ }
11288
+
11289
+ /**
11290
+ * Gets the locus URL from the LLM channel.
11291
+ * Handles practice session context automatically - returns practice session
11292
+ * LLM channel's locus URL when in practice session, main LLM channel's locus URL otherwise.
11293
+ * @returns {string | undefined} The locus URL or undefined
11294
+ */
11295
+ public getLLMLocusUrl(): string | undefined {
11296
+ if (this.webinar?.isJoinPracticeSessionDataChannel()) {
11297
+ return this.webinar.getPracticeSessionLocusUrl();
11298
+ }
11299
+
11300
+ return this.llmChannel?.getLocusUrl();
11301
+ }
11302
+
10470
11303
  /**
10471
11304
  * Determines the current data channel token type based on the meeting state.
10472
11305
  *