@webex/plugin-meetings 3.12.0-webex-services-ready.4 → 3.13.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) 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 +130 -4
  22. package/ai-docs/ARCHITECTURE.md +208 -0
  23. package/ai-docs/CONTRACTS.md +267 -0
  24. package/ai-docs/DATA_MODEL.md +64 -0
  25. package/ai-docs/GETTING_STARTED.md +73 -0
  26. package/ai-docs/GLOSSARY.md +56 -0
  27. package/ai-docs/REVIEW_CHECKLIST.md +45 -0
  28. package/ai-docs/RULES.md +79 -0
  29. package/ai-docs/SECURITY.md +74 -0
  30. package/ai-docs/SERVICE_STATE.md +59 -0
  31. package/ai-docs/SPEC_INDEX.md +85 -0
  32. package/ai-docs/TEST_INDEX.md +45 -0
  33. package/ai-docs/adr/0001-migrate-existing-docs-into-sdd.md +61 -0
  34. package/ai-docs/patterns/defensive-error-propagation.md +55 -0
  35. package/ai-docs/patterns/event-scope-emission.md +46 -0
  36. package/ai-docs/patterns/source-to-test-path-mirroring.md +45 -0
  37. package/ai-docs/patterns/stateless-plugin-request-classes.md +53 -0
  38. package/ai-docs/patterns/typed-constants-and-enum-values.md +47 -0
  39. package/assets/README.md +28 -0
  40. package/assets/e2ee-0.0.1.js +2 -0
  41. package/assets/e2ee-0.0.1.wasm +0 -0
  42. package/dist/aiEnableRequest/index.js +1 -1
  43. package/dist/annotation/index.js +55 -19
  44. package/dist/annotation/index.js.map +1 -1
  45. package/dist/assets/e2ee-0.0.1.js +2 -0
  46. package/dist/assets/e2ee-0.0.1.wasm +0 -0
  47. package/dist/breakouts/breakout.js +1 -1
  48. package/dist/breakouts/index.js +39 -5
  49. package/dist/breakouts/index.js.map +1 -1
  50. package/dist/common/errors/webex-errors.js +7 -2
  51. package/dist/common/errors/webex-errors.js.map +1 -1
  52. package/dist/config.js +1 -0
  53. package/dist/config.js.map +1 -1
  54. package/dist/constants.js +6 -5
  55. package/dist/constants.js.map +1 -1
  56. package/dist/hashTree/hashTreeParser.js +101 -48
  57. package/dist/hashTree/hashTreeParser.js.map +1 -1
  58. package/dist/index.js +1 -0
  59. package/dist/index.js.map +1 -1
  60. package/dist/interceptors/dataChannelAuthToken.js +41 -59
  61. package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
  62. package/dist/interceptors/locusRetry.js +1 -1
  63. package/dist/interceptors/locusRetry.js.map +1 -1
  64. package/dist/interpretation/index.js +46 -12
  65. package/dist/interpretation/index.js.map +1 -1
  66. package/dist/interpretation/siLanguage.js +1 -1
  67. package/dist/locus-info/index.js +236 -80
  68. package/dist/locus-info/index.js.map +1 -1
  69. package/dist/locus-info/types.js +2 -1
  70. package/dist/locus-info/types.js.map +1 -1
  71. package/dist/media/MediaConnectionAwaiter.js +225 -175
  72. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  73. package/dist/meeting/index.js +355 -299
  74. package/dist/meeting/index.js.map +1 -1
  75. package/dist/meeting/util.js +8 -2
  76. package/dist/meeting/util.js.map +1 -1
  77. package/dist/meeting/voicea-meeting.js +2 -1
  78. package/dist/meeting/voicea-meeting.js.map +1 -1
  79. package/dist/meeting-info/meeting-info-v2.js +10 -3
  80. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  81. package/dist/meetings/index.js +72 -31
  82. package/dist/meetings/index.js.map +1 -1
  83. package/dist/multistream/remoteMediaManager.js +32 -4
  84. package/dist/multistream/remoteMediaManager.js.map +1 -1
  85. package/dist/multistream/sendSlotManager.js +11 -1
  86. package/dist/multistream/sendSlotManager.js.map +1 -1
  87. package/dist/types/annotation/index.d.ts +19 -0
  88. package/dist/types/common/errors/webex-errors.d.ts +6 -2
  89. package/dist/types/config.d.ts +1 -0
  90. package/dist/types/constants.d.ts +2 -1
  91. package/dist/types/hashTree/hashTreeParser.d.ts +12 -0
  92. package/dist/types/index.d.ts +1 -0
  93. package/dist/types/locus-info/index.d.ts +45 -1
  94. package/dist/types/locus-info/types.d.ts +1 -0
  95. package/dist/types/media/MediaConnectionAwaiter.d.ts +61 -53
  96. package/dist/types/meeting/index.d.ts +49 -12
  97. package/dist/types/meeting/util.d.ts +3 -1
  98. package/dist/types/meeting-info/meeting-info-v2.d.ts +1 -0
  99. package/dist/types/meetings/index.d.ts +2 -1
  100. package/dist/types/multistream/remoteMediaManager.d.ts +18 -0
  101. package/dist/types/multistream/sendSlotManager.d.ts +5 -1
  102. package/dist/webinar/index.js +298 -255
  103. package/dist/webinar/index.js.map +1 -1
  104. package/package.json +25 -23
  105. package/src/aiEnableRequest/ai-docs/ai-enable-request-spec.md +223 -0
  106. package/src/annotation/ai-docs/annotation-spec.md +236 -0
  107. package/src/annotation/index.ts +61 -29
  108. package/src/breakouts/ai-docs/breakouts-spec.md +324 -0
  109. package/src/breakouts/index.ts +35 -2
  110. package/src/common/errors/webex-errors.ts +8 -2
  111. package/src/config.ts +5 -1
  112. package/src/constants.ts +2 -1
  113. package/src/controls-options-manager/ai-docs/controls-options-manager-spec.md +243 -0
  114. package/src/hashTree/ai-docs/hash-tree-spec.md +267 -0
  115. package/src/hashTree/hashTreeParser.ts +67 -3
  116. package/src/index.ts +1 -0
  117. package/src/interceptors/ai-docs/interceptors-spec.md +247 -0
  118. package/src/interceptors/dataChannelAuthToken.ts +48 -77
  119. package/src/interceptors/locusRetry.ts +1 -1
  120. package/src/interpretation/ai-docs/interpretation-spec.md +256 -0
  121. package/src/interpretation/index.ts +38 -1
  122. package/src/locus-info/ai-docs/locus-info-spec.md +293 -0
  123. package/src/locus-info/index.ts +156 -35
  124. package/src/locus-info/types.ts +1 -0
  125. package/src/media/MediaConnectionAwaiter.ts +223 -207
  126. package/src/media/ai-docs/media-spec.md +267 -0
  127. package/src/meeting/ai-docs/meeting-spec.md +404 -0
  128. package/src/meeting/index.ts +332 -296
  129. package/src/meeting/util.ts +7 -4
  130. package/src/meeting/voicea-meeting.ts +1 -1
  131. package/src/meeting-info/ai-docs/meeting-info-spec.md +261 -0
  132. package/src/meeting-info/meeting-info-v2.ts +7 -2
  133. package/src/meetings/ai-docs/meetings-spec.md +296 -0
  134. package/src/meetings/index.ts +59 -23
  135. package/src/member/ai-docs/member-spec.md +196 -0
  136. package/src/members/ai-docs/members-spec.md +256 -0
  137. package/src/metrics/ai-docs/metrics-spec.md +185 -0
  138. package/src/multistream/ai-docs/multistream-spec.md +295 -0
  139. package/src/multistream/remoteMediaManager.ts +23 -1
  140. package/src/multistream/sendSlotManager.ts +15 -1
  141. package/src/personal-meeting-room/ai-docs/personal-meeting-room-spec.md +234 -0
  142. package/src/reachability/ai-docs/reachability-spec.md +261 -0
  143. package/src/reactions/ai-docs/reactions-spec.md +198 -0
  144. package/src/reconnection-manager/ai-docs/reconnection-manager-spec.md +272 -0
  145. package/src/recording-controller/ai-docs/recording-controller-spec.md +223 -0
  146. package/src/roap/ai-docs/roap-spec.md +241 -0
  147. package/src/webinar/ai-docs/webinar-spec.md +243 -0
  148. package/src/webinar/index.ts +168 -188
  149. package/test/unit/spec/annotation/index.ts +214 -182
  150. package/test/unit/spec/breakouts/index.ts +145 -13
  151. package/test/unit/spec/hashTree/hashTreeParser.ts +212 -1
  152. package/test/unit/spec/interceptors/dataChannelAuthToken.ts +81 -99
  153. package/test/unit/spec/interceptors/locusRetry.ts +29 -1
  154. package/test/unit/spec/interpretation/index.ts +93 -0
  155. package/test/unit/spec/locus-info/index.js +397 -0
  156. package/test/unit/spec/media/MediaConnectionAwaiter.ts +426 -19
  157. package/test/unit/spec/media/properties.ts +3 -3
  158. package/test/unit/spec/meeting/index.js +1219 -723
  159. package/test/unit/spec/meeting/utils.js +52 -18
  160. package/test/unit/spec/meeting/voicea-meeting.ts +85 -1
  161. package/test/unit/spec/meeting-info/meetinginfov2.js +69 -1
  162. package/test/unit/spec/meetings/index.js +145 -43
  163. package/test/unit/spec/multistream/remoteMediaManager.ts +46 -0
  164. package/test/unit/spec/multistream/sendSlotManager.ts +30 -2
  165. package/test/unit/spec/webinar/index.ts +886 -718
@@ -34,6 +34,7 @@ import {
34
34
  } from '@webex/internal-media-core';
35
35
 
36
36
  import {DataChannelTokenType, type RegisterAndConnectTiming} from '@webex/internal-plugin-llm';
37
+ import type LLMChannel from '@webex/internal-plugin-llm';
37
38
 
38
39
  import {
39
40
  LocalStream,
@@ -50,6 +51,7 @@ import {
50
51
  EVENT_TRIGGERS as VOICEAEVENTS,
51
52
  TURN_ON_CAPTION_STATUS,
52
53
  type MeetingTranscriptPayload,
54
+ type VoiceaChannel,
53
55
  } from '@webex/internal-plugin-voicea';
54
56
 
55
57
  import {
@@ -57,6 +59,7 @@ import {
57
59
  isBrowserMediaError,
58
60
  isBrowserMediaErrorName,
59
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';
60
63
  import {CapabilityState, WebCapabilities} from '@webex/web-capabilities';
61
64
  import {processNewCaptions} from './voicea-meeting';
62
65
 
@@ -138,8 +141,6 @@ import {
138
141
  STAGE_MANAGER_TYPE,
139
142
  LOCUSEVENT,
140
143
  LOCUS_LLM_EVENT,
141
- LLM_DEFAULT_SESSION,
142
- LLM_PRACTICE_SESSION,
143
144
  } from '../constants';
144
145
  import BEHAVIORAL_METRICS from '../metrics/constants';
145
146
  import ParameterError from '../common/errors/parameter';
@@ -157,6 +158,7 @@ import {
157
158
  Configuration as RemoteMediaManagerConfiguration,
158
159
  RemoteMediaManager,
159
160
  Event as RemoteMediaManagerEvent,
161
+ getRemoteMediaManagerConfigForLogging,
160
162
  } from '../multistream/remoteMediaManager';
161
163
  import {
162
164
  Reaction,
@@ -186,7 +188,7 @@ import {ReachabilityMetrics} from '../reachability/reachability.types';
186
188
  import {SetStageOptions, SetStageVideoLayout, UnsetStageVideoLayout} from './request.type';
187
189
  import {Invitee} from './type';
188
190
  import {DataSet, HashTreeMessage, Metadata} from '../hashTree/hashTreeParser';
189
- import {LocusDTO} from '../locus-info/types';
191
+ import {LocusDTO, LocusErrorCodes} from '../locus-info/types';
190
192
  import AIEnableRequest from '../aiEnableRequest';
191
193
 
192
194
  // default callback so we don't call an undefined function, but in practice it should never be used
@@ -277,6 +279,7 @@ export type CallStateForMetrics = {
277
279
  userNameInput?: string;
278
280
  emailInput?: string;
279
281
  pstnCorrelationId?: string;
282
+ meetingJoinPhase?: MetricEventMeetingJoinPhase;
280
283
  };
281
284
 
282
285
  export const MEDIA_UPDATE_TYPE = {
@@ -739,6 +742,26 @@ export default class Meeting extends StatelessWebexPlugin {
739
742
  turnDiscoverySkippedReason: TurnDiscoverySkipReason;
740
743
  turnServerUsed: boolean;
741
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
+
742
765
  isMoveToInProgress = false;
743
766
  registrationIdStatus: string;
744
767
  brbState: BrbState;
@@ -748,6 +771,7 @@ export default class Meeting extends StatelessWebexPlugin {
748
771
  voiceaListenerCallbacks: object = {
749
772
  [VOICEAEVENTS.VOICEA_ANNOUNCEMENT]: (payload: Transcription['languageOptions']) => {
750
773
  this.transcription.languageOptions = payload;
774
+ const eventPayload = {...payload};
751
775
 
752
776
  LoggerProxy.logger.debug(
753
777
  `${EventsUtil.getScopeLog({
@@ -757,11 +781,11 @@ export default class Meeting extends StatelessWebexPlugin {
757
781
  );
758
782
 
759
783
  if (this.getCurUserType() !== 'host') {
760
- delete payload.spokenLanguages;
784
+ delete eventPayload.spokenLanguages;
761
785
  }
762
786
 
763
787
  // @ts-ignore
764
- this.trigger(EVENT_TRIGGERS.MEETING_STARTED_RECEIVING_TRANSCRIPTION, payload);
788
+ this.trigger(EVENT_TRIGGERS.MEETING_STARTED_RECEIVING_TRANSCRIPTION, eventPayload);
765
789
  },
766
790
  [VOICEAEVENTS.CAPTIONS_TURNED_ON]: () => {
767
791
  this.transcription.status = TURN_ON_CAPTION_STATUS.ENABLED;
@@ -816,6 +840,22 @@ export default class Meeting extends StatelessWebexPlugin {
816
840
  private mediaServerIp: string;
817
841
  private llmHealthCheckTimer?: ReturnType<typeof setTimeout>;
818
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
+
819
859
  /**
820
860
  * @param {Object} attrs
821
861
  * @param {Object} options
@@ -969,6 +1009,16 @@ export default class Meeting extends StatelessWebexPlugin {
969
1009
  */
970
1010
  // @ts-ignore
971
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();
972
1022
  /**
973
1023
  * helper class for managing receive slots (for multistream media connections)
974
1024
  */
@@ -1492,17 +1542,7 @@ export default class Meeting extends StatelessWebexPlugin {
1492
1542
  * @private
1493
1543
  * @memberof Meeting
1494
1544
  */
1495
- this.transcription = {
1496
- captions: [],
1497
- isListening: false,
1498
- commandText: '',
1499
- languageOptions: {currentSpokenLanguage: 'en'},
1500
- showCaptionBox: false,
1501
- transcribingRequestStatus: 'INACTIVE',
1502
- isCaptioning: false,
1503
- interimCaptions: {} as Map<string, CaptionData>,
1504
- speakerProxy: {} as Map<string, any>,
1505
- } as Transcription;
1545
+ this.transcription = this.getInitialTranscription();
1506
1546
 
1507
1547
  /**
1508
1548
  * Password status. If it's PASSWORD_STATUS.REQUIRED then verifyPassword() needs to be called
@@ -2090,7 +2130,7 @@ export default class Meeting extends StatelessWebexPlugin {
2090
2130
  this.config.installedOrgID,
2091
2131
  this.locusId,
2092
2132
  extraParams,
2093
- {meetingId: this.id, sendCAevents},
2133
+ {meetingId: this.id, sendCAevents, correlationId: this.correlationId},
2094
2134
  registrationId,
2095
2135
  null,
2096
2136
  classificationId
@@ -2664,29 +2704,28 @@ export default class Meeting extends StatelessWebexPlugin {
2664
2704
  * @memberof Meeting
2665
2705
  */
2666
2706
  private setUpVoiceaListeners() {
2667
- // @ts-ignore
2668
- this.webex.internal.voicea.listenToEvents();
2707
+ if (!this.voiceaChannel) {
2708
+ LoggerProxy.logger.warn('Meeting:index#setUpVoiceaListeners --> voiceaChannel not available');
2669
2709
 
2670
- // @ts-ignore
2671
- this.webex.internal.voicea.on(
2710
+ return;
2711
+ }
2712
+
2713
+ this.voiceaChannel.on(
2672
2714
  VOICEAEVENTS.VOICEA_ANNOUNCEMENT,
2673
2715
  this.voiceaListenerCallbacks[VOICEAEVENTS.VOICEA_ANNOUNCEMENT]
2674
2716
  );
2675
2717
 
2676
- // @ts-ignore
2677
- this.webex.internal.voicea.on(
2718
+ this.voiceaChannel.on(
2678
2719
  VOICEAEVENTS.CAPTIONS_TURNED_ON,
2679
2720
  this.voiceaListenerCallbacks[VOICEAEVENTS.CAPTIONS_TURNED_ON]
2680
2721
  );
2681
2722
 
2682
- // @ts-ignore
2683
- this.webex.internal.voicea.on(
2723
+ this.voiceaChannel.on(
2684
2724
  VOICEAEVENTS.EVA_COMMAND,
2685
2725
  this.voiceaListenerCallbacks[VOICEAEVENTS.EVA_COMMAND]
2686
2726
  );
2687
2727
 
2688
- // @ts-ignore
2689
- this.webex.internal.voicea.on(
2728
+ this.voiceaChannel.on(
2690
2729
  VOICEAEVENTS.NEW_CAPTION,
2691
2730
  this.voiceaListenerCallbacks[VOICEAEVENTS.NEW_CAPTION]
2692
2731
  );
@@ -3031,18 +3070,22 @@ export default class Meeting extends StatelessWebexPlugin {
3031
3070
  // user need to be joined to start the llm and receive transcription
3032
3071
  if (this.isJoined()) {
3033
3072
  // @ts-ignore - config coming from registerPlugin
3034
- if (transcribing && !this.transcription) {
3035
- this.startTranscription();
3036
- } else if (!transcribing && this.transcription) {
3037
- Trigger.trigger(
3038
- this,
3039
- {
3040
- file: 'meeting/index',
3041
- function: 'setupLocusControlsListener',
3042
- },
3043
- EVENT_TRIGGERS.MEETING_STOPPED_RECEIVING_TRANSCRIPTION,
3044
- {caption, transcribing}
3045
- );
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
+ }
3046
3089
  }
3047
3090
  }
3048
3091
  }
@@ -3055,8 +3098,7 @@ export default class Meeting extends StatelessWebexPlugin {
3055
3098
  if (this.transcription?.languageOptions) {
3056
3099
  this.transcription.languageOptions.currentSpokenLanguage = spokenLanguage;
3057
3100
  }
3058
- // @ts-ignore
3059
- this.webex.internal.voicea.onSpokenLanguageUpdate(spokenLanguage, this.id);
3101
+ this.voiceaChannel?.onSpokenLanguageUpdate(spokenLanguage, this.id);
3060
3102
 
3061
3103
  Trigger.trigger(
3062
3104
  this,
@@ -3085,8 +3127,7 @@ export default class Meeting extends StatelessWebexPlugin {
3085
3127
 
3086
3128
  this.locusInfo.on(LOCUSINFO.EVENTS.CONTROLS_MEETING_HESIOD_LLM_ID_UPDATED, ({hesiodLlmId}) => {
3087
3129
  if (hesiodLlmId) {
3088
- // @ts-ignore
3089
- this.webex.internal.voicea.onCaptionServiceIdUpdate(hesiodLlmId);
3130
+ this.voiceaChannel?.onCaptionServiceIdUpdate(hesiodLlmId);
3090
3131
  }
3091
3132
  });
3092
3133
 
@@ -3951,7 +3992,6 @@ export default class Meeting extends StatelessWebexPlugin {
3951
3992
  }`
3952
3993
  );
3953
3994
  }
3954
-
3955
3995
  this.updateLLMConnection();
3956
3996
  });
3957
3997
 
@@ -5452,9 +5492,13 @@ export default class Meeting extends StatelessWebexPlugin {
5452
5492
 
5453
5493
  this.receiveSlotManager.reset();
5454
5494
 
5495
+ // Unpublish/reset send slots while the connection is still open, so each slot's
5496
+ // internal "stop sending" negotiation (and its stream-listener detachment) completes
5497
+ // cleanly instead of racing the connection close below.
5498
+ this.sendSlotManager.reset();
5499
+
5455
5500
  this.mediaProperties.webrtcMediaConnection.close();
5456
5501
  this.mediaProperties.unsetPeerConnection();
5457
- this.sendSlotManager.reset();
5458
5502
  this.setNetworkStatus(undefined);
5459
5503
  }
5460
5504
 
@@ -5862,10 +5906,12 @@ export default class Meeting extends StatelessWebexPlugin {
5862
5906
 
5863
5907
  if (
5864
5908
  CallDiagnosticUtils.isSdpOfferCreationError(error) ||
5865
- CallDiagnosticUtils.isWebrtcApiNotAvailableError(error)
5909
+ CallDiagnosticUtils.isWebrtcApiNotAvailableError(error) ||
5910
+ this.isLocusUserFullError(error)
5866
5911
  ) {
5867
5912
  // errors related to offer creation (for example missing H264 codec) will happen again no matter how many times we try,
5868
5913
  // so there is no point doing a retry
5914
+ // when the locus is full, we also don't want to retry, because it will just fail again
5869
5915
  shouldRetry = false;
5870
5916
  }
5871
5917
 
@@ -5931,7 +5977,9 @@ export default class Meeting extends StatelessWebexPlugin {
5931
5977
 
5932
5978
  this.locusInfo.suspendDestroyMeeting(false);
5933
5979
 
5934
- throw firstError ?? error;
5980
+ // LOCUS_USER_FULL is a definitive capacity error the client must surface, so it takes
5981
+ // precedence over any earlier retryable error stored in firstError.
5982
+ throw this.isLocusUserFullError(error) ? error : firstError ?? error;
5935
5983
  }
5936
5984
  }
5937
5985
 
@@ -6036,8 +6084,7 @@ export default class Meeting extends StatelessWebexPlugin {
6036
6084
 
6037
6085
  try {
6038
6086
  const voiceaListenerCaptionUpdate = (payload) => {
6039
- // @ts-ignore
6040
- this.webex.internal.voicea.off(
6087
+ this.voiceaChannel?.off(
6041
6088
  VOICEAEVENTS.CAPTION_LANGUAGE_UPDATE,
6042
6089
  voiceaListenerCaptionUpdate
6043
6090
  );
@@ -6053,13 +6100,8 @@ export default class Meeting extends StatelessWebexPlugin {
6053
6100
  reject(payload);
6054
6101
  }
6055
6102
  };
6056
- // @ts-ignore
6057
- this.webex.internal.voicea.on(
6058
- VOICEAEVENTS.CAPTION_LANGUAGE_UPDATE,
6059
- voiceaListenerCaptionUpdate
6060
- );
6061
- // @ts-ignore
6062
- this.webex.internal.voicea.requestLanguage(language);
6103
+ this.voiceaChannel?.on(VOICEAEVENTS.CAPTION_LANGUAGE_UPDATE, voiceaListenerCaptionUpdate);
6104
+ this.voiceaChannel?.requestLanguage(language);
6063
6105
  } catch (error) {
6064
6106
  LoggerProxy.logger.error(`Meeting:index#setCaptionLanguage --> ${error}`);
6065
6107
 
@@ -6093,8 +6135,7 @@ export default class Meeting extends StatelessWebexPlugin {
6093
6135
 
6094
6136
  try {
6095
6137
  const voiceaListenerLanguageUpdate = (payload) => {
6096
- // @ts-ignore
6097
- this.webex.internal.voicea.off(
6138
+ this.voiceaChannel?.off(
6098
6139
  VOICEAEVENTS.SPOKEN_LANGUAGE_UPDATE,
6099
6140
  voiceaListenerLanguageUpdate
6100
6141
  );
@@ -6111,14 +6152,9 @@ export default class Meeting extends StatelessWebexPlugin {
6111
6152
  }
6112
6153
  };
6113
6154
 
6114
- // @ts-ignore
6115
- this.webex.internal.voicea.on(
6116
- VOICEAEVENTS.SPOKEN_LANGUAGE_UPDATE,
6117
- voiceaListenerLanguageUpdate
6118
- );
6155
+ this.voiceaChannel?.on(VOICEAEVENTS.SPOKEN_LANGUAGE_UPDATE, voiceaListenerLanguageUpdate);
6119
6156
 
6120
- // @ts-ignore
6121
- this.webex.internal.voicea.setSpokenLanguage(language);
6157
+ this.voiceaChannel?.setSpokenLanguage(language);
6122
6158
  } catch (error) {
6123
6159
  LoggerProxy.logger.error(`Meeting:index#setSpokenLanguage --> ${error}`);
6124
6160
 
@@ -6140,12 +6176,18 @@ export default class Meeting extends StatelessWebexPlugin {
6140
6176
  );
6141
6177
 
6142
6178
  try {
6179
+ if (!this.voiceaChannel) {
6180
+ LoggerProxy.logger.warn(
6181
+ 'Meeting:index#startTranscription --> voiceaChannel not available'
6182
+ );
6183
+
6184
+ return;
6185
+ }
6186
+
6143
6187
  if (!this.areVoiceaEventsSetup) {
6144
6188
  this.setUpVoiceaListeners();
6145
6189
  }
6146
-
6147
- // @ts-ignore
6148
- await this.webex.internal.voicea.turnOnCaptions(options?.spokenLanguage);
6190
+ await this.voiceaChannel.turnOnCaptions(options?.spokenLanguage);
6149
6191
  } catch (error) {
6150
6192
  LoggerProxy.logger.error(`Meeting:index#startTranscription --> ${error}`);
6151
6193
  Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.RECEIVE_TRANSCRIPTION_FAILURE, {
@@ -6162,6 +6204,22 @@ export default class Meeting extends StatelessWebexPlugin {
6162
6204
  }
6163
6205
  }
6164
6206
 
6207
+ /**
6208
+ * Starts transcription when requested by the current Locus controls and an
6209
+ * active LLM channel is ready.
6210
+ * @internal
6211
+ * @returns {void}
6212
+ */
6213
+ public startTranscriptionIfNeeded(): void {
6214
+ if (
6215
+ this.locusInfo.controls?.transcribe?.transcribing &&
6216
+ !this.areVoiceaEventsSetup &&
6217
+ this.voiceaChannel?.isLLMConnected()
6218
+ ) {
6219
+ this.startTranscription();
6220
+ }
6221
+ }
6222
+
6165
6223
  /** Handles Locus LLM events
6166
6224
  *
6167
6225
  * @param {LocusLLMEvent} event - The Locus LLM event to process
@@ -6195,6 +6253,8 @@ export default class Meeting extends StatelessWebexPlugin {
6195
6253
 
6196
6254
  /**
6197
6255
  * Verifies the relay event was delivered for the active LLM session binding.
6256
+ * With the factory pattern, each meeting owns its channel, so we just verify
6257
+ * the route matches our channel's binding or the practice session binding.
6198
6258
  * @param {RelayEvent} event Event object coming from LLM Connection
6199
6259
  * @returns {boolean}
6200
6260
  */
@@ -6205,11 +6265,13 @@ export default class Meeting extends StatelessWebexPlugin {
6205
6265
  return true;
6206
6266
  }
6207
6267
 
6208
- const {llm} = (this as any).webex.internal;
6209
- const isPracticeSession = llm.isConnected(LLM_PRACTICE_SESSION);
6268
+ // With the factory pattern, both channels may be connected simultaneously.
6269
+ // Determine which session is "active" based on whether PS channel is connected.
6270
+ const isPracticeSession = this.webinar?.isPracticeSessionLLMChannelConnected() ?? false;
6271
+
6210
6272
  const expectedBinding = isPracticeSession
6211
- ? llm.getBinding(LLM_PRACTICE_SESSION)
6212
- : llm.getBinding();
6273
+ ? this.webinar?.getPracticeSessionBinding()
6274
+ : this.llmChannel?.getBinding();
6213
6275
 
6214
6276
  if (!expectedBinding || route === expectedBinding) {
6215
6277
  return true;
@@ -6230,9 +6292,10 @@ export default class Meeting extends StatelessWebexPlugin {
6230
6292
  }
6231
6293
  switch (e.data.relayType) {
6232
6294
  case REACTION_RELAY_TYPES.REACTION:
6295
+ // @ts-ignore - config coming from registerPlugin
6233
6296
  if (
6234
6297
  // @ts-ignore - config coming from registerPlugin
6235
- (this.config.receiveReactions || options.receiveReactions) &&
6298
+ this.config.receiveReactions &&
6236
6299
  this.isReactionsSupported()
6237
6300
  ) {
6238
6301
  const member = this.members.membersCollection.get(e.data.sender.participantId);
@@ -6273,32 +6336,27 @@ export default class Meeting extends StatelessWebexPlugin {
6273
6336
  * @returns {void}
6274
6337
  */
6275
6338
  stopTranscription() {
6276
- // @ts-ignore
6277
- this.webex.internal.voicea.off(
6339
+ this.voiceaChannel?.off(
6278
6340
  VOICEAEVENTS.VOICEA_ANNOUNCEMENT,
6279
6341
  this.voiceaListenerCallbacks[VOICEAEVENTS.VOICEA_ANNOUNCEMENT]
6280
6342
  );
6281
6343
 
6282
- // @ts-ignore
6283
- this.webex.internal.voicea.off(
6344
+ this.voiceaChannel?.off(
6284
6345
  VOICEAEVENTS.CAPTIONS_TURNED_ON,
6285
6346
  this.voiceaListenerCallbacks[VOICEAEVENTS.CAPTIONS_TURNED_ON]
6286
6347
  );
6287
6348
 
6288
- // @ts-ignore
6289
- this.webex.internal.voicea.off(
6349
+ this.voiceaChannel?.off(
6290
6350
  VOICEAEVENTS.EVA_COMMAND,
6291
6351
  this.voiceaListenerCallbacks[VOICEAEVENTS.EVA_COMMAND]
6292
6352
  );
6293
6353
 
6294
- // @ts-ignore
6295
- this.webex.internal.voicea.off(
6354
+ this.voiceaChannel?.off(
6296
6355
  VOICEAEVENTS.NEW_CAPTION,
6297
6356
  this.voiceaListenerCallbacks[VOICEAEVENTS.NEW_CAPTION]
6298
6357
  );
6299
6358
 
6300
- // @ts-ignore
6301
- this.webex.internal.voicea.deregisterEvents();
6359
+ this.voiceaChannel?.deregisterEvents();
6302
6360
 
6303
6361
  this.areVoiceaEventsSetup = false;
6304
6362
  this.triggerStopReceivingTranscriptionEvent();
@@ -6331,16 +6389,13 @@ export default class Meeting extends StatelessWebexPlugin {
6331
6389
  */
6332
6390
  private restoreLLMSubscriptionsIfNeeded(): void {
6333
6391
  try {
6334
- const keepTranscriptionSubscribed =
6335
- // @ts-ignore
6336
- this.webex.internal.voicea?.getKeepTranscriptionSubscribed?.();
6392
+ const keepTranscriptionSubscribed = this.voiceaChannel?.getKeepTranscriptionSubscribed();
6337
6393
 
6338
6394
  if (!keepTranscriptionSubscribed) {
6339
6395
  return;
6340
6396
  }
6341
6397
 
6342
- // @ts-ignore
6343
- this.webex.internal.voicea.updateSubchannelSubscriptions({subscribe: ['transcription']});
6398
+ this.voiceaChannel?.updateSubchannelSubscriptions({subscribe: ['transcription']});
6344
6399
  } catch (error) {
6345
6400
  const msg = error?.message || String(error);
6346
6401
 
@@ -6591,10 +6646,6 @@ export default class Meeting extends StatelessWebexPlugin {
6591
6646
  this.saveDataChannelToken(join);
6592
6647
  // @ts-ignore - config coming from registerPlugin
6593
6648
  if (this.config.enableAutomaticLLM) {
6594
- // @ts-ignore
6595
- this.webex.internal.llm.off('online', this.handleLLMOnline);
6596
- // @ts-ignore
6597
- this.webex.internal.llm.on('online', this.handleLLMOnline);
6598
6649
  this.updateLLMConnection({isInitialJoinPhase: true})
6599
6650
  .catch((error) => {
6600
6651
  LoggerProxy.logger.error(
@@ -6629,12 +6680,10 @@ export default class Meeting extends StatelessWebexPlugin {
6629
6680
  this.clearLLMHealthCheckTimer();
6630
6681
 
6631
6682
  this.llmHealthCheckTimer = setTimeout(() => {
6632
- // @ts-ignore
6633
- const isConnected = this.webex.internal.llm.isConnected();
6683
+ const isConnected = this.llmChannel?.isConnected() ?? false;
6634
6684
 
6635
6685
  if (!isConnected) {
6636
- // @ts-ignore
6637
- const {hasEverConnected} = this.webex.internal.llm;
6686
+ const hasEverConnected = this.llmChannel?.hasEverConnected ?? false;
6638
6687
 
6639
6688
  // only send metric if not connected - to avoid too many metrics
6640
6689
  Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.LLM_HEALTHCHECK_FAILURE, {
@@ -6669,10 +6718,11 @@ export default class Meeting extends StatelessWebexPlugin {
6669
6718
  * @returns {void}
6670
6719
  */
6671
6720
  private stopListeningForLLMEvents() {
6672
- // @ts-ignore - fix types
6673
- this.webex.internal.llm.off('event:relay.event', this.processRelayEvent);
6674
- // @ts-ignore - fix types
6675
- this.webex.internal.llm.off(LOCUS_LLM_EVENT, this.processLocusLLMEvent);
6721
+ this.llmChannel?.off('event:relay.event', this.processRelayEvent);
6722
+ this.llmChannel?.off(LOCUS_LLM_EVENT, this.processLocusLLMEvent);
6723
+ this.llmChannel?.off('online', this.handleLLMOnline);
6724
+ this.breakouts?.unregisterLLMChannel();
6725
+ // voiceaChannel persists across LLM reconnects; switchLLMChannel() handles re-subscribing
6676
6726
  this.clearLLMHealthCheckTimer();
6677
6727
  }
6678
6728
 
@@ -6695,59 +6745,52 @@ export default class Meeting extends StatelessWebexPlugin {
6695
6745
  private stopListeningForMeetingEvents() {
6696
6746
  this.stopListeningForLLMEvents();
6697
6747
  this.stopListeningForMercuryEvents();
6698
- if (this.transcription) {
6748
+ if (this.areVoiceaEventsSetup) {
6699
6749
  this.stopTranscription();
6700
- this.transcription = undefined;
6701
6750
  }
6751
+ // Reset to initial shape instead of null - transcription is always a valid object
6752
+ this.transcription = this.getInitialTranscription();
6702
6753
  this.annotation.deregisterEvents();
6703
6754
  }
6704
6755
 
6705
6756
  /**
6706
- * Disconnects and cleans up the default LLM session listeners/timers.
6707
- *
6708
- * Ownership-aware: only calls `disconnectLLM` when this meeting is the
6709
- * current owner of the default LLM session (or when no owner is recorded).
6710
- * Event listeners belonging to this meeting instance are always detached
6711
- * so they do not receive another meeting's relay events.
6757
+ * Disconnects and cleans up the LLM channel owned by this meeting.
6712
6758
  *
6713
6759
  * @param {Object} options
6714
- * @param {boolean} [options.removeOnlineListener=true] removes the one-time online listener
6715
6760
  * @param {boolean} [options.throwOnError=true] rethrows disconnect errors when true
6761
+ * @param {boolean} [options.preserveVoiceaChannel=false] when true, keeps voiceaChannel for switchLLMChannel() during reconnects
6716
6762
  * @returns {Promise<void>}
6717
6763
  */
6718
6764
  private cleanupLLMConneciton = async ({
6719
- removeOnlineListener = true,
6720
6765
  throwOnError = true,
6766
+ preserveVoiceaChannel = false,
6721
6767
  }: {
6722
- removeOnlineListener?: boolean;
6723
6768
  throwOnError?: boolean;
6769
+ preserveVoiceaChannel?: boolean;
6724
6770
  } = {}): Promise<void> => {
6725
- // @ts-ignore - Fix type
6726
- // @ts-ignore - Fix type
6727
- const {currentOwner, isOwner} = this.webex.internal.llm.resolveSessionOwnership(
6728
- this.id,
6729
- LLM_DEFAULT_SESSION
6730
- );
6771
+ // Always clear the timer, even if there's no channel
6772
+ this.clearLLMHealthCheckTimer();
6773
+
6774
+ // Permanent cleanup must deregister voiceaChannel regardless of LLM presence.
6775
+ // When a transient reconnect fails (LLM registration error), llmChannel is undefined
6776
+ // but voiceaChannel may still exist with listeners attached to the old emitter.
6777
+ if (!preserveVoiceaChannel) {
6778
+ this.voiceaChannel?.deregisterEvents();
6779
+ this.voiceaChannel = undefined;
6780
+ }
6781
+
6782
+ if (!this.llmChannel) {
6783
+ return;
6784
+ }
6731
6785
 
6732
6786
  try {
6733
- if (isOwner) {
6734
- // @ts-ignore - Fix type
6735
- await this.webex.internal.llm.disconnectLLM(
6736
- {
6737
- code: 3050,
6738
- reason: 'done (permanent)',
6739
- },
6740
- LLM_DEFAULT_SESSION,
6741
- this.id
6742
- );
6743
- } else {
6744
- LoggerProxy.logger.info(
6745
- `Meeting:index#cleanupLLMConneciton --> skipping disconnect; LLM owned by meeting ${currentOwner}, not ${this.id}`
6746
- );
6747
- }
6787
+ await this.llmChannel.disconnect({
6788
+ code: 3050,
6789
+ reason: 'done (permanent)',
6790
+ });
6748
6791
  } catch (error) {
6749
6792
  LoggerProxy.logger.error(
6750
- 'Meeting:index#cleanupLLMConneciton --> Failed to disconnect default LLM session',
6793
+ 'Meeting:index#cleanupLLMConneciton --> Failed to disconnect LLM channel',
6751
6794
  error
6752
6795
  );
6753
6796
 
@@ -6755,42 +6798,25 @@ export default class Meeting extends StatelessWebexPlugin {
6755
6798
  throw error;
6756
6799
  }
6757
6800
  } finally {
6758
- if (removeOnlineListener) {
6759
- // @ts-ignore - Fix type
6760
- this.webex.internal.llm.off('online', this.handleLLMOnline);
6761
- }
6762
6801
  this.stopListeningForLLMEvents();
6763
-
6764
- // Re-check ownership after awaiting disconnectLLM. If ownership changed
6765
- // while cleanup was in flight, do not clear another meeting's owner tag.
6766
- if (isOwner) {
6767
- const {currentOwner: currentOwnerAfterCleanup} =
6768
- // @ts-ignore - Fix type
6769
- this.webex.internal.llm.resolveSessionOwnership(this.id, LLM_DEFAULT_SESSION);
6770
-
6771
- if (currentOwnerAfterCleanup === this.id) {
6772
- // @ts-ignore - Fix type
6773
- this.webex.internal.llm.setOwnerMeetingId?.(undefined);
6774
- }
6775
- }
6802
+ this.llmChannel = undefined;
6776
6803
  }
6777
6804
  };
6778
6805
 
6779
6806
  /**
6780
- * Clears data channel tokens associated with this meeting ownership.
6781
- * Ownership checks are enforced in internal-plugin-llm.
6807
+ * Sets the datachannel token on the meeting's LLM channel.
6808
+ * Used by the DataChannelAuthTokenInterceptor after refreshing tokens.
6809
+ * @param {string} token - The new datachannel token
6782
6810
  * @returns {void}
6783
6811
  */
6784
- clearDataChannelToken(): void {
6785
- // @ts-ignore
6786
- this.webex.internal.llm.clearDatachannelToken(LLM_DEFAULT_SESSION, this.id);
6787
- // @ts-ignore
6788
- this.webex.internal.llm.clearDatachannelToken(LLM_PRACTICE_SESSION, this.id);
6812
+ setLLMChannelDataToken(token: string): void {
6813
+ this.llmChannel?.setDatachannelToken(token);
6789
6814
  }
6790
6815
 
6791
6816
  /**
6792
- * Saves the data channel tokens from the join response into LLM so that
6793
- * updateLLMConnection / updatePSDataChannel don't need to fetch them from locusInfo.
6817
+ * Saves the data channel tokens from the join response.
6818
+ * Default session token is stored on this.llmChannel when available.
6819
+ * Practice session token is stored on the webinar's practice LLM channel.
6794
6820
  * @param {Object} join - The parsed join response (from MeetingUtil.parseLocusJoin)
6795
6821
  * @returns {void}
6796
6822
  */
@@ -6798,18 +6824,19 @@ export default class Meeting extends StatelessWebexPlugin {
6798
6824
  const datachannelToken = join?.locus?.self?.datachannelToken;
6799
6825
  const practiceSessionDatachannelToken = join?.locus?.self?.practiceSessionDatachannelToken;
6800
6826
 
6827
+ // Store default session token on our LLM channel if it exists
6828
+ if (datachannelToken && this.llmChannel) {
6829
+ this.llmChannel.setDatachannelToken(datachannelToken);
6830
+ }
6831
+
6832
+ // Store the token temporarily for use when channel is created
6801
6833
  if (datachannelToken) {
6802
- // @ts-ignore
6803
- this.webex.internal.llm.setDatachannelToken(datachannelToken, LLM_DEFAULT_SESSION, this.id);
6834
+ this._pendingDatachannelToken = datachannelToken;
6804
6835
  }
6805
6836
 
6837
+ // Practice session token is handled by webinar
6806
6838
  if (practiceSessionDatachannelToken) {
6807
- // @ts-ignore
6808
- this.webex.internal.llm.setDatachannelToken(
6809
- practiceSessionDatachannelToken,
6810
- LLM_PRACTICE_SESSION,
6811
- this.id
6812
- );
6839
+ this.webinar.setPracticeSessionDatachannelToken(practiceSessionDatachannelToken);
6813
6840
  }
6814
6841
  }
6815
6842
 
@@ -6820,11 +6847,8 @@ export default class Meeting extends StatelessWebexPlugin {
6820
6847
  */
6821
6848
  private async ensureDefaultDatachannelTokenAfterAdmit(): Promise<boolean> {
6822
6849
  try {
6823
- // @ts-ignore
6824
- const datachannelToken = this.webex.internal.llm.getDatachannelToken(
6825
- LLM_DEFAULT_SESSION,
6826
- this.id
6827
- );
6850
+ const datachannelToken =
6851
+ this.llmChannel?.getDatachannelToken() ?? this._pendingDatachannelToken;
6828
6852
  // @ts-ignore
6829
6853
  const isDataChannelTokenEnabled = await this.webex.internal.llm.isDataChannelTokenEnabled();
6830
6854
 
@@ -6843,12 +6867,12 @@ export default class Meeting extends StatelessWebexPlugin {
6843
6867
  return false;
6844
6868
  }
6845
6869
 
6846
- // @ts-ignore
6847
- this.webex.internal.llm.setDatachannelToken(
6848
- fetchedDatachannelToken,
6849
- LLM_DEFAULT_SESSION,
6850
- this.id
6851
- );
6870
+ // Store on channel if exists, otherwise save as pending
6871
+ if (this.llmChannel) {
6872
+ this.llmChannel.setDatachannelToken(fetchedDatachannelToken);
6873
+ } else {
6874
+ this._pendingDatachannelToken = fetchedDatachannelToken;
6875
+ }
6852
6876
 
6853
6877
  return true;
6854
6878
  } catch (error) {
@@ -6875,139 +6899,109 @@ export default class Meeting extends StatelessWebexPlugin {
6875
6899
  const {url = undefined, info: {datachannelUrl = undefined} = {}} = this.locusInfo || {};
6876
6900
 
6877
6901
  const isJoined = this.isJoined();
6878
-
6879
6902
  const dataChannelUrl = datachannelUrl;
6880
6903
 
6881
- // Ownership guard: when the default LLM session is already connected and
6882
- // owned by a *different* Meeting instance, do not disconnect or reconfigure
6883
- // it. Another meeting's `updateLLMConnection` must be ignored here to
6884
- // avoid killing the socket it relies on. We only proceed to manage the
6885
- // connection when this meeting is the current owner, or when no owner is
6886
- // set yet (first claim).
6887
- // @ts-ignore - Fix type
6888
- const {currentOwner} = this.webex.internal.llm.resolveSessionOwnership(
6889
- this.id,
6890
- LLM_DEFAULT_SESSION
6891
- );
6892
-
6893
- // Capture connectivity before any reconnect attempt. If LLM was already
6894
- // connected, we must respect current ownership. If it was disconnected,
6895
- // this flow may reclaim stale owner tags after a fresh connect.
6896
- // @ts-ignore - Fix type
6897
- const wasConnected = this.webex.internal.llm.isConnected();
6898
-
6899
- // Prefer ownership-scoped token read. For disconnected stale-owner reclaim
6900
- // flows, fallback to ownerless read so initial register can still carry a
6901
- // token and recover from stale ownership without 401/403 dead-end.
6902
- // @ts-ignore - Fix type
6903
- let datachannelToken = this.webex.internal.llm.getDatachannelToken(
6904
- LLM_DEFAULT_SESSION,
6905
- this.id
6906
- );
6907
-
6908
- if (!datachannelToken && !wasConnected && currentOwner && currentOwner !== this.id) {
6909
- // @ts-ignore - Fix type
6910
- datachannelToken = this.webex.internal.llm.getDatachannelToken(LLM_DEFAULT_SESSION);
6911
- }
6912
-
6913
- // @ts-ignore - Fix type
6914
- if (wasConnected) {
6915
- if (currentOwner && currentOwner !== this.id) {
6916
- // Another meeting owns the live LLM socket. We must not disconnect
6917
- // or reconfigure it -- doing so would tear down a session the
6918
- // owning meeting still relies on. Locus/datachannel URL mismatch is
6919
- // expected here (each meeting has its own locus URL) and is NOT a
6920
- // valid signal of staleness, so we never reclaim from this path.
6921
- // The only safe reclaim mechanism is the `finally`-block owner-tag
6922
- // release in `cleanupLLMConneciton`, which fires when this meeting
6923
- // itself is being torn down.
6924
- LoggerProxy.logger.info(
6925
- `Meeting:index#updateLLMConnection --> skipping; LLM owned by meeting ${currentOwner}, not ${this.id}`
6926
- );
6904
+ // If we have an existing channel, check if we should reuse it or clean it up
6905
+ if (this.llmChannel) {
6906
+ const isSameUrls =
6907
+ url === this.llmChannel.getLocusUrl() &&
6908
+ dataChannelUrl === this.llmChannel.getDatachannelUrl();
6927
6909
 
6910
+ // If already connected to same URLs, skip reconnect
6911
+ if (this.llmChannel.isConnected() && isSameUrls && isJoined) {
6928
6912
  return undefined;
6929
6913
  }
6930
6914
 
6931
- if (
6932
- // @ts-ignore - Fix type
6933
- url === this.webex.internal.llm.getLocusUrl() &&
6934
- // @ts-ignore - Fix type
6935
- dataChannelUrl === this.webex.internal.llm.getDatachannelUrl() &&
6936
- isJoined
6937
- ) {
6915
+ // If currently connecting to same URLs, wait for that to complete
6916
+ if (this.llmChannel.isConnecting() && isSameUrls && isJoined) {
6938
6917
  return undefined;
6939
6918
  }
6940
- await this.cleanupLLMConneciton({removeOnlineListener: false});
6919
+
6920
+ // URLs changed or not joined, disconnect existing channel
6921
+ await this.cleanupLLMConneciton({preserveVoiceaChannel: true});
6941
6922
  }
6942
6923
 
6943
- if (!isJoined) {
6924
+ if (!isJoined || !url || !dataChannelUrl) {
6925
+ // Either not joined, or locusInfo hasn't synced url/datachannelUrl yet
6926
+ // (SELF_UNADMITTED_GUEST/SELF_ADMITTED_GUEST can fire before datachannelUrl is
6927
+ // populated on rejoin). Any stale channel was already disconnected above; don't
6928
+ // create/register a new one with an empty URL. handleDataChannelUrlChange() will
6929
+ // re-invoke this once MEETING_INFO_UPDATED delivers the real datachannelUrl.
6944
6930
  return undefined;
6945
6931
  }
6946
6932
 
6947
- // Bind refresh handler before registration so interceptor-triggered token
6948
- // refresh during register POST can resolve a valid handler.
6949
- // Prefer this meeting as owner, but allow owner-less fallback when a stale
6950
- // foreign owner tag is present on a disconnected session.
6951
- const refreshHandlerOwnerMeetingId =
6952
- currentOwner && currentOwner !== this.id ? undefined : this.id;
6953
- const shouldAlignRefreshHandlerAfterOwnershipClaim = refreshHandlerOwnerMeetingId !== this.id;
6933
+ // Create a new LLM channel for this meeting
6954
6934
  // @ts-ignore - Fix type
6955
- this.webex.internal.llm.setRefreshHandler(
6956
- () => this.refreshDataChannelToken(),
6957
- LLM_DEFAULT_SESSION,
6958
- refreshHandlerOwnerMeetingId
6959
- );
6935
+ this.llmChannel = this.webex.internal.llm.createChannel();
6960
6936
 
6961
- // @ts-ignore - Fix type
6962
- return this.webex.internal.llm
6937
+ // Get token from pending (saved from join response) or channel
6938
+ const datachannelToken = this._pendingDatachannelToken ?? this.llmChannel.getDatachannelToken();
6939
+
6940
+ // Set up refresh handler before registration so interceptor-triggered token
6941
+ // refresh during register POST can resolve a valid handler.
6942
+ this.llmChannel.setRefreshHandler(() => this.refreshDataChannelToken());
6943
+
6944
+ // If we have a pending token, store it on the channel
6945
+ if (this._pendingDatachannelToken) {
6946
+ this.llmChannel.setDatachannelToken(this._pendingDatachannelToken);
6947
+ this._pendingDatachannelToken = undefined;
6948
+ }
6949
+
6950
+ return this.llmChannel
6963
6951
  .registerAndConnect(url, dataChannelUrl, datachannelToken)
6964
6952
  .then((registerAndConnectResult) => {
6965
6953
  this.locusInfo.syncAllHashTreeDatasets({onlyLLM: true});
6966
- // Record ownership of the default LLM session for this meeting so
6967
- // subsequent cross-meeting `updateLLMConnection` / `cleanupLLMConneciton`
6968
- // calls can detect and skip work that doesn't belong to them.
6969
- // @ts-ignore - Fix type
6970
- const {isOwner} = this.webex.internal.llm.resolveSessionOwnership(
6971
- this.id,
6972
- LLM_DEFAULT_SESSION
6973
- );
6974
- const canReclaimAfterDisconnectedStart = !wasConnected;
6975
-
6976
- // Refresh handler is pre-bound before registerAndConnect so token
6977
- // refresh can work even during the registration request itself.
6978
- if (isOwner || canReclaimAfterDisconnectedStart) {
6979
- // Record ownership of the default LLM session for this meeting so
6980
- // subsequent cross-meeting `updateLLMConnection` / `cleanupLLMConneciton`
6981
- // calls can detect and skip work that doesn't belong to them.
6982
- // @ts-ignore - Fix type
6983
- this.webex.internal.llm.setOwnerMeetingId?.(this.id);
6984
-
6985
- // If we pre-bound refresh ownerlessly (stale-owner reclaim path),
6986
- // align the handler with the newly claimed owner immediately after
6987
- // ownership is updated.
6988
- if (shouldAlignRefreshHandlerAfterOwnershipClaim) {
6989
- // @ts-ignore - Fix type
6990
- this.webex.internal.llm.setRefreshHandler(
6991
- () => this.refreshDataChannelToken(),
6992
- LLM_DEFAULT_SESSION,
6993
- this.id
6994
- );
6995
- }
6954
+
6955
+ // Register event listeners on the channel
6956
+ this.llmChannel.off('event:relay.event', this.processRelayEvent);
6957
+ this.llmChannel.on('event:relay.event', this.processRelayEvent);
6958
+ this.llmChannel.off(LOCUS_LLM_EVENT, this.processLocusLLMEvent);
6959
+ this.llmChannel.on(LOCUS_LLM_EVENT, this.processLocusLLMEvent);
6960
+ this.llmChannel.off('online', this.handleLLMOnline);
6961
+ this.llmChannel.on('online', this.handleLLMOnline);
6962
+
6963
+ // Register annotation channel only if not in practice session
6964
+ // (practice session manages its own annotation channel via updatePSDataChannel)
6965
+ if (!this.webinar?.isJoinPracticeSessionDataChannel()) {
6966
+ this.annotation.registerChannel(this.llmChannel);
6996
6967
  }
6997
- // @ts-ignore - Fix type
6998
- this.webex.internal.llm.off('event:relay.event', this.processRelayEvent);
6999
- // @ts-ignore - Fix type
7000
- this.webex.internal.llm.on('event:relay.event', this.processRelayEvent);
7001
- // @ts-ignore - Fix type
7002
- this.webex.internal.llm.off(LOCUS_LLM_EVENT, this.processLocusLLMEvent);
7003
- // @ts-ignore - Fix type
7004
- this.webex.internal.llm.on(LOCUS_LLM_EVENT, this.processLocusLLMEvent);
6968
+
6969
+ // Register breakouts channel
6970
+ this.breakouts.registerLLMChannel(this.llmChannel);
6971
+
7005
6972
  LoggerProxy.logger.info(
7006
6973
  'Meeting:index#updateLLMConnection --> enabled to receive relay events!'
7007
6974
  );
7008
-
7009
6975
  this.startLLMHealthCheckTimer();
7010
6976
 
6977
+ // Switch voiceaChannel to use the new LLM channel (preserves transcription state).
6978
+ // Skip if practice session is active - practice session manages its own voicea binding
6979
+ // via updatePSDataChannel, and switching here would break practice session captions.
6980
+ const isPracticeSessionActive =
6981
+ this.webinar?.isPracticeSessionLLMChannelConnected() ?? false;
6982
+
6983
+ if (!this.voiceaChannel) {
6984
+ // @ts-ignore - Fix type
6985
+ this.voiceaChannel = this.webex.internal.voicea.createChannel();
6986
+ }
6987
+
6988
+ if (!isPracticeSessionActive) {
6989
+ // Fire-and-forget: caption restoration shouldn't block LLM connection result.
6990
+ // transcription is always initialized (reset to initial shape, never null),
6991
+ // so no re-init needed here.
6992
+ this.voiceaChannel
6993
+ .switchLLMChannel(this.llmChannel)
6994
+ .then(() => {
6995
+ this.startTranscriptionIfNeeded();
6996
+ })
6997
+ .catch((error) => {
6998
+ LoggerProxy.logger.warn(
6999
+ 'Meeting:index#updateLLMConnection --> failed to switch voicea channel:',
7000
+ error
7001
+ );
7002
+ });
7003
+ }
7004
+
7011
7005
  if (registerAndConnectResult) {
7012
7006
  if (isInitialJoinPhase) {
7013
7007
  this.sendLLMConnectMetric(registerAndConnectResult);
@@ -7039,6 +7033,9 @@ export default class Meeting extends StatelessWebexPlugin {
7039
7033
  error,
7040
7034
  });
7041
7035
 
7036
+ // Clean up the channel on failure
7037
+ this.llmChannel = undefined;
7038
+
7042
7039
  return Promise.reject(error);
7043
7040
  });
7044
7041
  }
@@ -8204,6 +8201,10 @@ export default class Meeting extends StatelessWebexPlugin {
8204
8201
  );
8205
8202
  }
8206
8203
 
8204
+ private isLocusUserFullError(error: Error | undefined): boolean {
8205
+ return (error as any)?.error?.body?.errorCode === LocusErrorCodes.LOCUS_USER_FULL;
8206
+ }
8207
+
8207
8208
  /**
8208
8209
  * Determines if the next media attempt should use only TURN-TLS (iceTransportPolicy='relay').
8209
8210
  * We do this in the hope that it will minimize the chance of Homer sending DTLS packets on a wrong
@@ -8672,6 +8673,8 @@ export default class Meeting extends StatelessWebexPlugin {
8672
8673
  selectedCandidatePairChanges,
8673
8674
  numTransports,
8674
8675
  iceConnected,
8676
+ iceConnectedAtLeastOnce:
8677
+ error instanceof MediaConnectionTimedOutError ? error.iceConnectedAtLeastOnce : undefined,
8675
8678
  });
8676
8679
  }
8677
8680
  }
@@ -9037,9 +9040,16 @@ export default class Meeting extends StatelessWebexPlugin {
9037
9040
 
9038
9041
  this.hasMediaConnectionConnectedAtLeastOnce = false;
9039
9042
  const LOG_HEADER = 'Meeting:index#addMedia -->';
9043
+ const optionsForLogging = {
9044
+ ...options,
9045
+ remoteMediaManagerConfig: getRemoteMediaManagerConfigForLogging(
9046
+ options.remoteMediaManagerConfig
9047
+ ),
9048
+ };
9049
+
9040
9050
  LoggerProxy.logger.info(
9041
9051
  `${LOG_HEADER} called with: options=${JSON.stringify(
9042
- options
9052
+ optionsForLogging
9043
9053
  )}, turnServerInfo=${JSON.stringify(
9044
9054
  turnServerInfo
9045
9055
  )}, forceTurnDiscovery=${forceTurnDiscovery}, iceTransportPolicy=${iceTransportPolicy}`
@@ -10530,14 +10540,12 @@ export default class Meeting extends StatelessWebexPlugin {
10530
10540
 
10531
10541
  // Listener teardown (transcription, annotation, llm/mercury) runs in
10532
10542
  // stopListeningForMeetingEvents() before /leave and /end so events
10533
- // received mid-teardown do not trigger Locus syncs. Calling it here
10534
- // again would double-emit MEETING_STOPPED_RECEIVING_TRANSCRIPTION
10535
- // because stopTranscription() always fires its trigger.
10536
- //
10537
- // Ownership-aware token clear is encapsulated inside clearDataChannelToken().
10538
- this.clearDataChannelToken();
10539
-
10540
- await this.cleanupLLMConneciton({throwOnError: false});
10543
+ // received mid-teardown do not trigger Locus syncs.
10544
+ // Token cleanup happens automatically when cleanupLLMConneciton destroys the channel.
10545
+ // A new voiceaChannel is created on the next join. In-session LLM reconnects and
10546
+ // practice-session transitions use their own cleanup paths and preserve the channel.
10547
+
10548
+ await this.cleanupLLMConneciton({throwOnError: false, preserveVoiceaChannel: false});
10541
10549
  };
10542
10550
 
10543
10551
  /**
@@ -11273,6 +11281,34 @@ export default class Meeting extends StatelessWebexPlugin {
11273
11281
  }
11274
11282
  }
11275
11283
 
11284
+ /**
11285
+ * Checks if the LLM channel is connected.
11286
+ * Handles practice session context automatically - returns practice session
11287
+ * LLM channel status when in practice session, main LLM channel status otherwise.
11288
+ * @returns {boolean} True if the appropriate LLM channel is connected
11289
+ */
11290
+ public isLLMConnected(): boolean {
11291
+ if (this.webinar?.isJoinPracticeSessionDataChannel()) {
11292
+ return this.webinar.isPracticeSessionLLMChannelConnected();
11293
+ }
11294
+
11295
+ return this.llmChannel?.isConnected() ?? false;
11296
+ }
11297
+
11298
+ /**
11299
+ * Gets the locus URL from the LLM channel.
11300
+ * Handles practice session context automatically - returns practice session
11301
+ * LLM channel's locus URL when in practice session, main LLM channel's locus URL otherwise.
11302
+ * @returns {string | undefined} The locus URL or undefined
11303
+ */
11304
+ public getLLMLocusUrl(): string | undefined {
11305
+ if (this.webinar?.isJoinPracticeSessionDataChannel()) {
11306
+ return this.webinar.getPracticeSessionLocusUrl();
11307
+ }
11308
+
11309
+ return this.llmChannel?.getLocusUrl();
11310
+ }
11311
+
11276
11312
  /**
11277
11313
  * Determines the current data channel token type based on the meeting state.
11278
11314
  *