@webex/plugin-meetings 3.12.0-next.12 → 3.12.0-next.121

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 (227) hide show
  1. package/AGENTS.md +9 -0
  2. package/dist/aiEnableRequest/index.js +15 -2
  3. package/dist/aiEnableRequest/index.js.map +1 -1
  4. package/dist/breakouts/breakout.js +8 -3
  5. package/dist/breakouts/breakout.js.map +1 -1
  6. package/dist/breakouts/events.js +29 -14
  7. package/dist/breakouts/events.js.map +1 -1
  8. package/dist/breakouts/index.js +90 -3
  9. package/dist/breakouts/index.js.map +1 -1
  10. package/dist/common/errors/webex-errors.js +49 -5
  11. package/dist/common/errors/webex-errors.js.map +1 -1
  12. package/dist/config.js +2 -2
  13. package/dist/config.js.map +1 -1
  14. package/dist/constants.js +37 -10
  15. package/dist/constants.js.map +1 -1
  16. package/dist/controls-options-manager/index.js +46 -10
  17. package/dist/controls-options-manager/index.js.map +1 -1
  18. package/dist/hashTree/constants.js +4 -1
  19. package/dist/hashTree/constants.js.map +1 -1
  20. package/dist/hashTree/hashTreeParser.js +1045 -393
  21. package/dist/hashTree/hashTreeParser.js.map +1 -1
  22. package/dist/hashTree/utils.js +20 -0
  23. package/dist/hashTree/utils.js.map +1 -1
  24. package/dist/index.js +7 -0
  25. package/dist/index.js.map +1 -1
  26. package/dist/interceptors/dataChannelAuthToken.js +75 -15
  27. package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
  28. package/dist/interceptors/locusRetry.js +23 -8
  29. package/dist/interceptors/locusRetry.js.map +1 -1
  30. package/dist/interpretation/index.js +10 -1
  31. package/dist/interpretation/index.js.map +1 -1
  32. package/dist/interpretation/interpretation.types.js +7 -0
  33. package/dist/interpretation/interpretation.types.js.map +1 -0
  34. package/dist/interpretation/siLanguage.js +1 -1
  35. package/dist/locus-info/controlsUtils.js +4 -1
  36. package/dist/locus-info/controlsUtils.js.map +1 -1
  37. package/dist/locus-info/index.js +406 -121
  38. package/dist/locus-info/index.js.map +1 -1
  39. package/dist/locus-info/infoUtils.js +36 -5
  40. package/dist/locus-info/infoUtils.js.map +1 -1
  41. package/dist/locus-info/types.js +19 -0
  42. package/dist/locus-info/types.js.map +1 -1
  43. package/dist/media/MediaConnectionAwaiter.js +15 -2
  44. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  45. package/dist/media/index.js +8 -2
  46. package/dist/media/index.js.map +1 -1
  47. package/dist/media/properties.js +4 -5
  48. package/dist/media/properties.js.map +1 -1
  49. package/dist/meeting/in-meeting-actions.js +5 -1
  50. package/dist/meeting/in-meeting-actions.js.map +1 -1
  51. package/dist/meeting/index.js +1667 -834
  52. package/dist/meeting/index.js.map +1 -1
  53. package/dist/meeting/locusMediaRequest.js +229 -82
  54. package/dist/meeting/locusMediaRequest.js.map +1 -1
  55. package/dist/meeting/muteState.js +10 -1
  56. package/dist/meeting/muteState.js.map +1 -1
  57. package/dist/meeting/request.js +5 -2
  58. package/dist/meeting/request.js.map +1 -1
  59. package/dist/meeting/util.js +34 -2
  60. package/dist/meeting/util.js.map +1 -1
  61. package/dist/meeting-info/meeting-info-v2.js +2 -2
  62. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  63. package/dist/meetings/index.js +256 -118
  64. package/dist/meetings/index.js.map +1 -1
  65. package/dist/meetings/meetings.types.js +6 -1
  66. package/dist/meetings/meetings.types.js.map +1 -1
  67. package/dist/meetings/request.js +39 -0
  68. package/dist/meetings/request.js.map +1 -1
  69. package/dist/meetings/util.js +116 -18
  70. package/dist/meetings/util.js.map +1 -1
  71. package/dist/member/index.js +10 -0
  72. package/dist/member/index.js.map +1 -1
  73. package/dist/member/types.js.map +1 -1
  74. package/dist/member/util.js +30 -0
  75. package/dist/member/util.js.map +1 -1
  76. package/dist/members/index.js +101 -43
  77. package/dist/members/index.js.map +1 -1
  78. package/dist/members/util.js +8 -1
  79. package/dist/members/util.js.map +1 -1
  80. package/dist/metrics/constants.js +7 -1
  81. package/dist/metrics/constants.js.map +1 -1
  82. package/dist/multistream/codec/constants.js +63 -0
  83. package/dist/multistream/codec/constants.js.map +1 -0
  84. package/dist/multistream/mediaRequestManager.js +62 -15
  85. package/dist/multistream/mediaRequestManager.js.map +1 -1
  86. package/dist/multistream/receiveSlot.js +9 -0
  87. package/dist/multistream/receiveSlot.js.map +1 -1
  88. package/dist/reachability/clusterReachability.js.map +1 -1
  89. package/dist/reachability/index.js +121 -83
  90. package/dist/reachability/index.js.map +1 -1
  91. package/dist/reachability/reachability.types.js +2 -0
  92. package/dist/reachability/reachability.types.js.map +1 -1
  93. package/dist/reachability/util.js +45 -0
  94. package/dist/reachability/util.js.map +1 -1
  95. package/dist/reactions/reactions.type.js.map +1 -1
  96. package/dist/recording-controller/index.js +1 -3
  97. package/dist/recording-controller/index.js.map +1 -1
  98. package/dist/roap/turnDiscovery.js +8 -1
  99. package/dist/roap/turnDiscovery.js.map +1 -1
  100. package/dist/types/common/errors/webex-errors.d.ts +32 -2
  101. package/dist/types/config.d.ts +2 -2
  102. package/dist/types/constants.d.ts +13 -1
  103. package/dist/types/controls-options-manager/index.d.ts +16 -0
  104. package/dist/types/hashTree/constants.d.ts +1 -0
  105. package/dist/types/hashTree/hashTreeParser.d.ts +189 -22
  106. package/dist/types/hashTree/utils.d.ts +7 -0
  107. package/dist/types/index.d.ts +3 -0
  108. package/dist/types/interceptors/locusRetry.d.ts +4 -4
  109. package/dist/types/interpretation/interpretation.types.d.ts +10 -0
  110. package/dist/types/locus-info/index.d.ts +61 -7
  111. package/dist/types/locus-info/infoUtils.d.ts +8 -0
  112. package/dist/types/locus-info/types.d.ts +21 -1
  113. package/dist/types/media/MediaConnectionAwaiter.d.ts +10 -1
  114. package/dist/types/media/properties.d.ts +6 -2
  115. package/dist/types/meeting/in-meeting-actions.d.ts +4 -0
  116. package/dist/types/meeting/index.d.ts +175 -11
  117. package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
  118. package/dist/types/meeting/request.d.ts +1 -0
  119. package/dist/types/meeting/util.d.ts +9 -0
  120. package/dist/types/meetings/index.d.ts +38 -18
  121. package/dist/types/meetings/meetings.types.d.ts +15 -0
  122. package/dist/types/meetings/request.d.ts +14 -0
  123. package/dist/types/member/index.d.ts +1 -0
  124. package/dist/types/member/types.d.ts +1 -0
  125. package/dist/types/member/util.d.ts +9 -0
  126. package/dist/types/members/index.d.ts +15 -2
  127. package/dist/types/members/util.d.ts +1 -5
  128. package/dist/types/metrics/constants.d.ts +6 -0
  129. package/dist/types/multistream/codec/constants.d.ts +7 -0
  130. package/dist/types/multistream/mediaRequestManager.d.ts +22 -5
  131. package/dist/types/reachability/clusterReachability.d.ts +3 -3
  132. package/dist/types/reachability/index.d.ts +10 -3
  133. package/dist/types/reachability/reachability.types.d.ts +7 -0
  134. package/dist/types/reachability/util.d.ts +17 -0
  135. package/dist/types/reactions/reactions.type.d.ts +3 -0
  136. package/dist/webinar/index.js +307 -161
  137. package/dist/webinar/index.js.map +1 -1
  138. package/package.json +23 -23
  139. package/src/aiEnableRequest/index.ts +16 -0
  140. package/src/breakouts/breakout.ts +3 -1
  141. package/src/breakouts/events.ts +33 -11
  142. package/src/breakouts/index.ts +110 -1
  143. package/src/common/errors/webex-errors.ts +50 -3
  144. package/src/config.ts +2 -2
  145. package/src/constants.ts +21 -3
  146. package/src/controls-options-manager/index.ts +62 -10
  147. package/src/hashTree/constants.ts +7 -0
  148. package/src/hashTree/hashTreeParser.ts +796 -192
  149. package/src/hashTree/utils.ts +19 -0
  150. package/src/index.ts +6 -0
  151. package/src/interceptors/dataChannelAuthToken.ts +88 -12
  152. package/src/interceptors/locusRetry.ts +25 -4
  153. package/src/interpretation/index.ts +27 -9
  154. package/src/interpretation/interpretation.types.ts +11 -0
  155. package/src/locus-info/controlsUtils.ts +3 -1
  156. package/src/locus-info/index.ts +412 -130
  157. package/src/locus-info/infoUtils.ts +41 -6
  158. package/src/locus-info/types.ts +25 -1
  159. package/src/media/MediaConnectionAwaiter.ts +21 -4
  160. package/src/media/index.ts +10 -1
  161. package/src/media/properties.ts +8 -3
  162. package/src/meeting/in-meeting-actions.ts +8 -0
  163. package/src/meeting/index.ts +922 -116
  164. package/src/meeting/locusMediaRequest.ts +106 -6
  165. package/src/meeting/muteState.ts +10 -1
  166. package/src/meeting/request.ts +11 -0
  167. package/src/meeting/util.ts +46 -5
  168. package/src/meeting-info/meeting-info-v2.ts +4 -2
  169. package/src/meetings/index.ts +168 -79
  170. package/src/meetings/meetings.types.ts +19 -0
  171. package/src/meetings/request.ts +43 -0
  172. package/src/meetings/util.ts +117 -4
  173. package/src/member/index.ts +10 -0
  174. package/src/member/types.ts +1 -0
  175. package/src/member/util.ts +29 -0
  176. package/src/members/index.ts +70 -7
  177. package/src/members/util.ts +12 -4
  178. package/src/metrics/constants.ts +6 -0
  179. package/src/multistream/codec/constants.ts +58 -0
  180. package/src/multistream/mediaRequestManager.ts +119 -28
  181. package/src/multistream/receiveSlot.ts +18 -0
  182. package/src/reachability/clusterReachability.ts +3 -2
  183. package/src/reachability/index.ts +47 -16
  184. package/src/reachability/reachability.types.ts +11 -0
  185. package/src/reachability/util.ts +36 -0
  186. package/src/reactions/reactions.type.ts +3 -0
  187. package/src/recording-controller/index.ts +1 -2
  188. package/src/roap/turnDiscovery.ts +9 -1
  189. package/src/webinar/index.ts +216 -38
  190. package/test/unit/spec/aiEnableRequest/index.ts +86 -0
  191. package/test/unit/spec/breakouts/breakout.ts +9 -3
  192. package/test/unit/spec/breakouts/events.ts +120 -2
  193. package/test/unit/spec/breakouts/index.ts +191 -2
  194. package/test/unit/spec/common/errors/webex-errors.ts +78 -0
  195. package/test/unit/spec/controls-options-manager/index.js +139 -32
  196. package/test/unit/spec/hashTree/hashTreeParser.ts +2299 -243
  197. package/test/unit/spec/hashTree/utils.ts +37 -0
  198. package/test/unit/spec/interceptors/dataChannelAuthToken.ts +196 -0
  199. package/test/unit/spec/interceptors/locusRetry.ts +205 -4
  200. package/test/unit/spec/interpretation/index.ts +26 -4
  201. package/test/unit/spec/locus-info/controlsUtils.js +172 -57
  202. package/test/unit/spec/locus-info/index.js +643 -63
  203. package/test/unit/spec/locus-info/infoUtils.js +184 -1
  204. package/test/unit/spec/media/MediaConnectionAwaiter.ts +55 -0
  205. package/test/unit/spec/media/index.ts +92 -0
  206. package/test/unit/spec/media/properties.ts +23 -23
  207. package/test/unit/spec/meeting/in-meeting-actions.ts +4 -0
  208. package/test/unit/spec/meeting/index.js +2704 -135
  209. package/test/unit/spec/meeting/locusMediaRequest.ts +406 -4
  210. package/test/unit/spec/meeting/muteState.js +81 -0
  211. package/test/unit/spec/meeting/request.js +12 -0
  212. package/test/unit/spec/meeting/utils.js +153 -1
  213. package/test/unit/spec/meeting-info/meetinginfov2.js +19 -10
  214. package/test/unit/spec/meetings/index.js +479 -48
  215. package/test/unit/spec/meetings/request.js +141 -0
  216. package/test/unit/spec/meetings/utils.js +402 -51
  217. package/test/unit/spec/member/index.js +7 -0
  218. package/test/unit/spec/member/util.js +89 -0
  219. package/test/unit/spec/members/index.js +216 -0
  220. package/test/unit/spec/members/request.js +37 -1
  221. package/test/unit/spec/members/utils.js +63 -0
  222. package/test/unit/spec/multistream/mediaRequestManager.ts +501 -37
  223. package/test/unit/spec/reachability/index.ts +128 -46
  224. package/test/unit/spec/reachability/util.ts +31 -0
  225. package/test/unit/spec/recording-controller/index.js +9 -8
  226. package/test/unit/spec/roap/turnDiscovery.ts +20 -0
  227. package/test/unit/spec/webinar/index.ts +332 -31
@@ -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,10 @@ 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';
38
37
 
39
38
  import {
40
39
  LocalStream,
@@ -67,6 +66,7 @@ import {
67
66
  NoMediaEstablishedYetError,
68
67
  UserNotJoinedError,
69
68
  AddMediaFailed,
69
+ MediaConnectionTimedOutError,
70
70
  SdpResponseTimeoutError,
71
71
  } from '../common/errors/webex-errors';
72
72
 
@@ -77,6 +77,7 @@ import Roap, {type TurnDiscoveryResult, type TurnDiscoverySkipReason} from '../r
77
77
  import {type TurnServerInfo} from '../roap/types';
78
78
  import Media, {type BundlePolicy} from '../media';
79
79
  import MediaProperties from '../media/properties';
80
+ import {type FailureResult as MediaConnectionAwaiterFailureResult} from '../media/MediaConnectionAwaiter';
80
81
  import MeetingStateMachine from './state';
81
82
  import {createMuteState} from './muteState';
82
83
  import LocusInfo, {LocusLLMEvent} from '../locus-info';
@@ -137,6 +138,8 @@ import {
137
138
  STAGE_MANAGER_TYPE,
138
139
  LOCUSEVENT,
139
140
  LOCUS_LLM_EVENT,
141
+ LLM_DEFAULT_SESSION,
142
+ LLM_PRACTICE_SESSION,
140
143
  } from '../constants';
141
144
  import BEHAVIORAL_METRICS from '../metrics/constants';
142
145
  import ParameterError from '../common/errors/parameter';
@@ -190,6 +193,7 @@ import AIEnableRequest from '../aiEnableRequest';
190
193
  const DEFAULT_ICE_PHASE_CALLBACK = () => 'JOIN_MEETING_FINAL';
191
194
 
192
195
  const LLM_HEALTHCHECK_TIMER_MS = 3 * 60 * 1000;
196
+ const JOIN_WITH_MEDIA_RETRY_MAX_COUNT = 2;
193
197
 
194
198
  const logRequest = (request: any, {logText = ''}) => {
195
199
  LoggerProxy.logger.info(`${logText} - sending request`);
@@ -612,7 +616,7 @@ export default class Meeting extends StatelessWebexPlugin {
612
616
  webinar: any;
613
617
  conversationUrl: string;
614
618
  callStateForMetrics: CallStateForMetrics;
615
- destination: string;
619
+ destination: string | LocusDTO;
616
620
  destinationType: DESTINATION_TYPE;
617
621
  deviceUrl: string;
618
622
  hostId: string;
@@ -651,6 +655,8 @@ export default class Meeting extends StatelessWebexPlugin {
651
655
  floorGrantPending: boolean;
652
656
  hasJoinedOnce: boolean;
653
657
  hasWebsocketConnected: boolean;
658
+ private mercuryOnlineHandler?: () => void;
659
+ private mercuryOfflineHandler?: () => void;
654
660
  inMeetingActions: InMeetingActions;
655
661
  isLocalShareLive: boolean;
656
662
  isRoapInProgress: boolean;
@@ -662,6 +668,7 @@ export default class Meeting extends StatelessWebexPlugin {
662
668
  joinedWith?: any;
663
669
  selfId?: string;
664
670
  roles: any[];
671
+ canNotViewTheParticipantList?: boolean;
665
672
  // ... there is more ... see SelfUtils.parse()
666
673
  // end of the group
667
674
  locusMediaRequest?: LocusMediaRequest;
@@ -735,6 +742,8 @@ export default class Meeting extends StatelessWebexPlugin {
735
742
  isMoveToInProgress = false;
736
743
  registrationIdStatus: string;
737
744
  brbState: BrbState;
745
+ private emittedBreakoutJoinResponseMoveIds: Set<string> = new Set();
746
+ private promisesWaitingForPropUpdate: Record<string, Defer> = {};
738
747
 
739
748
  voiceaListenerCallbacks: object = {
740
749
  [VOICEAEVENTS.VOICEA_ANNOUNCEMENT]: (payload: Transcription['languageOptions']) => {
@@ -784,13 +793,20 @@ export default class Meeting extends StatelessWebexPlugin {
784
793
  private addMediaData: {
785
794
  retriedWithTurnServer: boolean;
786
795
  icePhaseCallback: () => string;
796
+ iceTransportPolicy?: RTCIceTransportPolicy;
787
797
  };
788
798
 
789
799
  private sendSlotManager: SendSlotManager = new SendSlotManager(LoggerProxy);
790
800
  private deferSDPAnswer?: Defer; // used for waiting for a response
791
801
  private sdpResponseTimer?: ReturnType<typeof setTimeout>;
792
802
  private hasMediaConnectionConnectedAtLeastOnce: boolean;
793
- private joinWithMediaRetryInfo?: {isRetry: boolean; prevJoinResponse?: any};
803
+ private joinWithMediaRetryInfo: {
804
+ retryCount: number;
805
+ prevJoinResponse?: any;
806
+ firstError?: Error;
807
+ prevError?: Error;
808
+ };
809
+
794
810
  private connectionStateHandler?: ConnectionStateHandler;
795
811
  private iceCandidateErrors: Map<string, number>;
796
812
  private iceCandidatesCount: number;
@@ -935,7 +951,7 @@ export default class Meeting extends StatelessWebexPlugin {
935
951
  this.simultaneousInterpretation = new SimultaneousInterpretation({}, {parent: this.webex});
936
952
 
937
953
  // @ts-ignore
938
- this.aiEnableRequest = new AIEnableRequest({}, {parent: this.webex});
954
+ this.aiEnableRequest = new AIEnableRequest({locusUrl: this.locusUrl}, {parent: this.webex});
939
955
 
940
956
  /**
941
957
  * @instance
@@ -966,6 +982,7 @@ export default class Meeting extends StatelessWebexPlugin {
966
982
  },
967
983
  (csi: CSI) => (this.members.findMemberByCsi(csi) as any)?.id
968
984
  );
985
+
969
986
  /**
970
987
  * Object containing helper classes for managing media requests for audio/video/screenshare (for multistream media connections)
971
988
  * All multistream media requests sent out for this meeting have to go through them.
@@ -985,6 +1002,7 @@ export default class Meeting extends StatelessWebexPlugin {
985
1002
  mediaRequests
986
1003
  );
987
1004
  },
1005
+ this.getIngressPayloadTypeCallback.bind(this),
988
1006
  {
989
1007
  // @ts-ignore - config coming from registerPlugin
990
1008
  degradationPreferences: this.config.degradationPreferences,
@@ -1006,6 +1024,7 @@ export default class Meeting extends StatelessWebexPlugin {
1006
1024
  mediaRequests
1007
1025
  );
1008
1026
  },
1027
+ this.getIngressPayloadTypeCallback.bind(this),
1009
1028
  {
1010
1029
  // @ts-ignore - config coming from registerPlugin
1011
1030
  degradationPreferences: this.config.degradationPreferences,
@@ -1027,6 +1046,7 @@ export default class Meeting extends StatelessWebexPlugin {
1027
1046
  mediaRequests
1028
1047
  );
1029
1048
  },
1049
+ this.getIngressPayloadTypeCallback.bind(this),
1030
1050
  {
1031
1051
  // @ts-ignore - config coming from registerPlugin
1032
1052
  degradationPreferences: this.config.degradationPreferences,
@@ -1048,11 +1068,14 @@ export default class Meeting extends StatelessWebexPlugin {
1048
1068
  mediaRequests
1049
1069
  );
1050
1070
  },
1071
+ this.getIngressPayloadTypeCallback.bind(this),
1051
1072
  {
1052
1073
  // @ts-ignore - config coming from registerPlugin
1053
1074
  degradationPreferences: this.config.degradationPreferences,
1054
1075
  kind: 'video',
1055
1076
  trimRequestsToNumOfSources: false,
1077
+ // @ts-ignore - config coming from registerPlugin
1078
+ enableAv1: this.config.enableAv1SlidesSupport,
1056
1079
  }
1057
1080
  ),
1058
1081
  };
@@ -1372,7 +1395,48 @@ export default class Meeting extends StatelessWebexPlugin {
1372
1395
  * @memberof Meeting
1373
1396
  */
1374
1397
  // @ts-ignore - Fix type
1375
- this.locusInfo = new LocusInfo(this.updateMeetingObject.bind(this), this.webex, this.id);
1398
+ this.locusInfo = new LocusInfo(
1399
+ {
1400
+ updateMeeting: this.updateMeetingObject.bind(this),
1401
+ syncLatencyTracker: {
1402
+ // Compute/store latency timestamps live on CallDiagnosticLatencies, while
1403
+ // submitting the client.locus.sync.complete CA event is owned by the metrics
1404
+ // facade. Wire each method to the layer that owns that responsibility.
1405
+ saveLatency: (...args) =>
1406
+ // @ts-ignore
1407
+ this.webex.internal.newMetrics.callDiagnosticLatencies.saveLatency(...args),
1408
+ saveTimestamp: (saveTimestampOptions: {
1409
+ key: string;
1410
+ value?: number;
1411
+ options: {meetingId: string; dataSetName: string; trackingId?: string};
1412
+ }) => {
1413
+ // @ts-ignore
1414
+ this.webex.internal.newMetrics.callDiagnosticLatencies.saveTimestamp(
1415
+ saveTimestampOptions
1416
+ );
1417
+
1418
+ // The /sync response is one of the two milestones (the other is the LLM message) that
1419
+ // complete client.locus.sync.complete. Try to complete now: the metric is emitted only
1420
+ // once both the LLM message and the /sync response have arrived (either can come first).
1421
+ if (
1422
+ saveTimestampOptions.key === 'internal.client.locus.sync.response' &&
1423
+ saveTimestampOptions.options?.trackingId
1424
+ ) {
1425
+ this.tryCompleteLocusSyncLatency(
1426
+ saveTimestampOptions.options.meetingId,
1427
+ saveTimestampOptions.options.trackingId
1428
+ );
1429
+ }
1430
+ },
1431
+ clearLocusSyncLatency: (...args) =>
1432
+ // @ts-ignore
1433
+ this.webex.internal.newMetrics.callDiagnosticLatencies.clearLocusSyncLatency(...args),
1434
+ },
1435
+ },
1436
+ // @ts-ignore
1437
+ this.webex,
1438
+ this.id
1439
+ );
1376
1440
 
1377
1441
  // We had to add listeners first before setting up the locus instance
1378
1442
  /**
@@ -1557,6 +1621,8 @@ export default class Meeting extends StatelessWebexPlugin {
1557
1621
  this.controlsOptionsManager = new ControlsOptionsManager(this.meetingRequest, {
1558
1622
  locusUrl: this.locusInfo?.url,
1559
1623
  displayHints: [],
1624
+ getControls: () => this.locusInfo?.controls,
1625
+ isWebinar: () => this.locusInfo?.info?.isWebinar,
1560
1626
  });
1561
1627
 
1562
1628
  this.setUpLocusInfoListeners();
@@ -1655,11 +1721,11 @@ export default class Meeting extends StatelessWebexPlugin {
1655
1721
  /**
1656
1722
  * Information needed for a retry of a call to joinWithMedia
1657
1723
  * @instance
1658
- * @type {{isRetry: boolean; prevJoinResponse?: any}}
1724
+ * @type {{retryCount: number; prevJoinResponse?: any}}
1659
1725
  * @private
1660
1726
  * @memberof Meeting
1661
1727
  */
1662
- this.joinWithMediaRetryInfo = {isRetry: false, prevJoinResponse: undefined};
1728
+ this.joinWithMediaRetryInfo = {retryCount: 0, prevJoinResponse: undefined};
1663
1729
 
1664
1730
  /**
1665
1731
  * Connection state handler
@@ -1713,6 +1779,37 @@ export default class Meeting extends StatelessWebexPlugin {
1713
1779
  this.mediaServerIp = undefined;
1714
1780
  }
1715
1781
 
1782
+ /**
1783
+ * Get the ingress payload type for a given media type and codec mime type
1784
+ * @param {MediaType} mediaType - The media type
1785
+ * @param {MediaCodecMimeType} codecMimeType - The codec mime type
1786
+ * @returns {number | undefined} - The ingress payload type
1787
+ * @private
1788
+ * @memberof Meeting
1789
+ */
1790
+ private getIngressPayloadTypeCallback(
1791
+ mediaType: MediaType,
1792
+ codecMimeType: MediaCodecMimeType
1793
+ ): number | undefined {
1794
+ if (this.isMultistream) {
1795
+ try {
1796
+ return this.mediaProperties.webrtcMediaConnection.getIngressPayloadType(
1797
+ mediaType,
1798
+ codecMimeType
1799
+ );
1800
+ } catch (error) {
1801
+ LoggerProxy.logger.info(
1802
+ `Meeting:index#mediaRequestManager --> failed to get ingress payload type for mediaType=${mediaType}, codecMimeType=${codecMimeType}`,
1803
+ error
1804
+ );
1805
+
1806
+ return undefined;
1807
+ }
1808
+ }
1809
+
1810
+ return undefined;
1811
+ }
1812
+
1716
1813
  /**
1717
1814
  * Temporary func to return webex object,
1718
1815
  * in order to access internal plugin metrics
@@ -2325,6 +2422,89 @@ export default class Meeting extends StatelessWebexPlugin {
2325
2422
  });
2326
2423
  }
2327
2424
 
2425
+ /**
2426
+ * Handles the LLM state-update message that resulted from a Locus /sync. Records the LLM arrival
2427
+ * time (the milestone that gates client.locus.sync.complete - the metric is emitted only for LLM
2428
+ * flows) and then tries to complete the metric.
2429
+ * @param {string} meetingId meeting id
2430
+ * @param {string} trackingId sync tracking id echoed back on the LLM message
2431
+ * @returns {void}
2432
+ * @private
2433
+ * @memberof Meeting
2434
+ */
2435
+ private onLocusSyncLlmMessage(meetingId: string, trackingId: string) {
2436
+ // @ts-ignore
2437
+ this.webex.internal.newMetrics.callDiagnosticLatencies.recordLocusSyncMessageReceived(
2438
+ meetingId,
2439
+ trackingId
2440
+ );
2441
+
2442
+ this.tryCompleteLocusSyncLatency(meetingId, trackingId);
2443
+ }
2444
+
2445
+ /**
2446
+ * Attempts to complete the Locus sync latency metric and emit client.locus.sync.complete. The
2447
+ * metric is emitted only once BOTH the /sync response and the resulting LLM message have arrived
2448
+ * (in either order); until then the record is kept so the missing milestone can still land. Both
2449
+ * trigger points (the LLM message handler and the /sync response timestamp) call this, so the
2450
+ * metric fires as soon as the second milestone is in.
2451
+ * @param {string} meetingId meeting id
2452
+ * @param {string} trackingId sync tracking id used to match the pending record
2453
+ * @returns {void}
2454
+ * @private
2455
+ * @memberof Meeting
2456
+ */
2457
+ private tryCompleteLocusSyncLatency(meetingId: string, trackingId: string) {
2458
+ const completed =
2459
+ // @ts-ignore
2460
+ this.webex.internal.newMetrics.callDiagnosticLatencies.completeLocusSyncLatency(
2461
+ meetingId,
2462
+ trackingId
2463
+ );
2464
+
2465
+ if (completed) {
2466
+ this.emitLocusSyncCompleteMetric(meetingId, completed);
2467
+ }
2468
+ }
2469
+
2470
+ /**
2471
+ * Submits the client.locus.sync.complete Call Analyzer event for a completed Locus sync latency
2472
+ * measurement.
2473
+ * @param {string} meetingId meeting id
2474
+ * @param {object} completed completed sync latency payload from the metrics plugin
2475
+ * @returns {void}
2476
+ * @private
2477
+ * @memberof Meeting
2478
+ */
2479
+ private emitLocusSyncCompleteMetric(
2480
+ meetingId: string,
2481
+ completed: {dataSet: string; syncLatency: object}
2482
+ ) {
2483
+ // @ts-ignore
2484
+ const llmWebsocketUrl = this.webex.internal.llm?.getWebSocketUrl?.() || undefined;
2485
+
2486
+ // Per the LLM sync-latency spec, the event carries the LLM websocket url identifier,
2487
+ // the llmInfo.dataSet (main, atd-active or atd-unmuted) and the syncLatency block.
2488
+ const clientEvent = {
2489
+ name: 'client.locus.sync.complete',
2490
+ payload: {
2491
+ identifiers: {
2492
+ llmWebsocketUrl,
2493
+ },
2494
+ llmInfo: {
2495
+ dataSet: completed.dataSet,
2496
+ },
2497
+ syncLatency: completed.syncLatency,
2498
+ },
2499
+ options: {
2500
+ meetingId,
2501
+ },
2502
+ };
2503
+
2504
+ // @ts-ignore
2505
+ this.webex.internal.newMetrics.submitClientEvent(clientEvent);
2506
+ }
2507
+
2328
2508
  /**
2329
2509
  * Proxy function for all the listener set ups
2330
2510
  * @returns {undefined}
@@ -2789,7 +2969,7 @@ export default class Meeting extends StatelessWebexPlugin {
2789
2969
  private setupLocusControlsListener() {
2790
2970
  this.locusInfo.on(
2791
2971
  LOCUSINFO.EVENTS.CONTROLS_RECORDING_UPDATED,
2792
- ({state, modifiedBy, lastModified}) => {
2972
+ ({state, modifiedBy, lastModified, modifiedByServiceAppName, modifiedByServiceAppId}) => {
2793
2973
  let event;
2794
2974
 
2795
2975
  switch (state) {
@@ -2815,6 +2995,8 @@ export default class Meeting extends StatelessWebexPlugin {
2815
2995
  state: state === RECORDING_STATE.RESUMED ? RECORDING_STATE.RECORDING : state,
2816
2996
  modifiedBy,
2817
2997
  lastModified,
2998
+ modifiedByServiceAppName,
2999
+ modifiedByServiceAppId,
2818
3000
  };
2819
3001
  Trigger.trigger(
2820
3002
  this,
@@ -3213,7 +3395,7 @@ export default class Meeting extends StatelessWebexPlugin {
3213
3395
  }
3214
3396
 
3215
3397
  LoggerProxy.logger.info(
3216
- `Meeting:index#setUpLocusInfoMediaInactiveListener --> this.shareStatus=${this.shareStatus} newShareStatus=${newShareStatus}`
3398
+ `Meeting:index#setUpLocusMediaSharesListener --> this.shareStatus=${this.shareStatus} newShareStatus=${newShareStatus}`
3217
3399
  );
3218
3400
 
3219
3401
  if (newShareStatus !== this.shareStatus) {
@@ -3459,13 +3641,12 @@ export default class Meeting extends StatelessWebexPlugin {
3459
3641
  this.breakouts.locusUrlUpdate(url);
3460
3642
  this.simultaneousInterpretation.locusUrlUpdate(url);
3461
3643
  this.annotation.locusUrlUpdate(url);
3644
+ this.aiEnableRequest.locusUrlUpdate(url);
3462
3645
  this.locusUrl = url;
3463
3646
  this.locusId = this.locusUrl?.split('/').pop();
3464
3647
  this.recordingController.setLocusUrl(this.locusUrl);
3465
3648
  this.controlsOptionsManager.setLocusUrl(this.locusUrl, !!isMainLocus);
3466
3649
  this.webinar.locusUrlUpdate(url);
3467
- // @ts-ignore
3468
- this.webex.internal.llm.setRefreshHandler(() => this.refreshDataChannelToken());
3469
3650
 
3470
3651
  Trigger.trigger(
3471
3652
  this,
@@ -3734,7 +3915,7 @@ export default class Meeting extends StatelessWebexPlugin {
3734
3915
  });
3735
3916
  this.updateLLMConnection();
3736
3917
  });
3737
- this.locusInfo.on(LOCUSINFO.EVENTS.SELF_ADMITTED_GUEST, (payload) => {
3918
+ this.locusInfo.on(LOCUSINFO.EVENTS.SELF_ADMITTED_GUEST, async (payload) => {
3738
3919
  this.stopKeepAlive();
3739
3920
 
3740
3921
  if (payload) {
@@ -3761,13 +3942,15 @@ export default class Meeting extends StatelessWebexPlugin {
3761
3942
  }
3762
3943
  this.rtcMetrics?.sendNextMetrics();
3763
3944
 
3764
- this.ensureDefaultDatachannelTokenAfterAdmit().catch((error) => {
3945
+ try {
3946
+ await this.ensureDefaultDatachannelTokenAfterAdmit();
3947
+ } catch (error) {
3765
3948
  LoggerProxy.logger.warn(
3766
3949
  `Meeting:index#setUpLocusInfoSelfListener --> failed post-admit token prefetch flow: ${
3767
3950
  error?.message || String(error)
3768
3951
  }`
3769
3952
  );
3770
- });
3953
+ }
3771
3954
 
3772
3955
  this.updateLLMConnection();
3773
3956
  });
@@ -3813,6 +3996,9 @@ export default class Meeting extends StatelessWebexPlugin {
3813
3996
  });
3814
3997
 
3815
3998
  this.locusInfo.on(LOCUSINFO.EVENTS.SELF_CANNOT_VIEW_PARTICIPANT_LIST_CHANGE, (payload) => {
3999
+ // canViewTheParticipantList meeting action depends on this value, so we need to update meeting actions
4000
+ this.updateMeetingActions();
4001
+
3816
4002
  Trigger.trigger(
3817
4003
  this,
3818
4004
  {
@@ -4007,7 +4193,14 @@ export default class Meeting extends StatelessWebexPlugin {
4007
4193
  // is not changed by any delta event
4008
4194
  if (object && Object.keys(object).length) {
4009
4195
  Object.keys(object).forEach((key) => {
4196
+ const previousValue = this[key];
4197
+
4010
4198
  this[key] = object[key];
4199
+
4200
+ if (this.promisesWaitingForPropUpdate[key] && previousValue !== object[key]) {
4201
+ this.promisesWaitingForPropUpdate[key].resolve();
4202
+ delete this.promisesWaitingForPropUpdate[key];
4203
+ }
4011
4204
  });
4012
4205
  }
4013
4206
  }
@@ -4145,7 +4338,12 @@ export default class Meeting extends StatelessWebexPlugin {
4145
4338
  }
4146
4339
 
4147
4340
  /**
4148
- * Transfer the moderator role to another eligible member
4341
+ * Transfer the moderator role to another eligible member.
4342
+ *
4343
+ * If the target member is currently joined in the current session, the request is
4344
+ * sent against the current locus. Otherwise, we search the breakout sessions and,
4345
+ * when the member is found in one, we send the request against that breakout
4346
+ * session's locus url instead.
4149
4347
  * @param {String} memberId
4150
4348
  * @param {Boolean} moderator
4151
4349
  * @returns {Promise} see #members.transferHostToMember
@@ -4153,7 +4351,21 @@ export default class Meeting extends StatelessWebexPlugin {
4153
4351
  * @memberof Meeting
4154
4352
  */
4155
4353
  public transfer(memberId: string, moderator = true) {
4156
- return this.members.transferHostToMember(memberId, moderator);
4354
+ const targetMember = this.members.membersCollection.get(memberId);
4355
+
4356
+ if (targetMember?.isInMeeting) {
4357
+ return this.members.transferHostToMember(memberId, moderator);
4358
+ }
4359
+
4360
+ const breakout = this.breakouts?.breakouts?.models?.find((bo: any) => {
4361
+ const breakoutMember = bo.members?.membersCollection?.get(memberId);
4362
+
4363
+ return breakoutMember?.isInMeeting;
4364
+ });
4365
+
4366
+ const breakoutLocusUrl = breakout?.breakoutRosterLocus?.url;
4367
+
4368
+ return this.members.transferHostToMember(memberId, moderator, breakoutLocusUrl);
4157
4369
  }
4158
4370
 
4159
4371
  /**
@@ -4611,6 +4823,13 @@ export default class Meeting extends StatelessWebexPlugin {
4611
4823
  ),
4612
4824
  isAttendeeRequestAiAssistantDeclinedAll:
4613
4825
  MeetingUtil.attendeeRequestAiAssistantDeclinedAll(this.userDisplayHints),
4826
+ isAnonymizeDisplayNamesEnabled: MeetingUtil.isAnonymizeDisplayNamesEnabled(
4827
+ this.userDisplayHints
4828
+ ),
4829
+ canViewTheParticipantList: MeetingUtil.canViewTheParticipantList(
4830
+ this.userDisplayHints,
4831
+ this.canNotViewTheParticipantList ?? false
4832
+ ),
4614
4833
  }) || changed;
4615
4834
  }
4616
4835
  if (changed) {
@@ -4659,6 +4878,34 @@ export default class Meeting extends StatelessWebexPlugin {
4659
4878
  this.sipUri = sipUri;
4660
4879
  }
4661
4880
 
4881
+ /**
4882
+ * After initial locus setup, refreshes destination with synced locus data and optionally
4883
+ * performs deferred meeting info fetch when initial locus was incomplete.
4884
+ * @param {LocusDTO} locus
4885
+ * @returns {void}
4886
+ */
4887
+ public async finalizeMeetingAfterInitialLocusSetup(locus: LocusDTO): Promise<void> {
4888
+ if (locus && this?.destinationType === DESTINATION_TYPE.LOCUS_ID) {
4889
+ // destination is initialized from the initial locus snapshot in constructor,
4890
+ // so refresh it after locus sync to avoid stale partial hash-tree data.
4891
+ this.destination = locus;
4892
+ }
4893
+ if (
4894
+ (!this.meetingInfo || isEmpty(this.meetingInfo)) &&
4895
+ (this.destination as LocusDTO)?.info &&
4896
+ !this.fetchMeetingInfoTimeoutId &&
4897
+ !MeetingsUtil.isOneOnOneCall(locus)
4898
+ ) {
4899
+ try {
4900
+ await this.fetchMeetingInfo({});
4901
+ } catch (error: any) {
4902
+ LoggerProxy.logger.info(
4903
+ `Meeting:index#finalizeMeetingAfterInitialLocusSetup --> deferred fetchMeetingInfo failed: ${error.message}`
4904
+ );
4905
+ }
4906
+ }
4907
+ }
4908
+
4662
4909
  /**
4663
4910
  * Set the locus info the class instance. Should be called with the parsed locus
4664
4911
  * we got in the join response.
@@ -5130,8 +5377,7 @@ export default class Meeting extends StatelessWebexPlugin {
5130
5377
  public setMercuryListener() {
5131
5378
  // Client will have a socket manager and handle reconnecting to mercury, when we reconnect to mercury
5132
5379
  // if the meeting has active peer connections, it should try to reconnect.
5133
- // @ts-ignore
5134
- this.webex.internal.mercury.on(ONLINE, () => {
5380
+ this.mercuryOnlineHandler = () => {
5135
5381
  LoggerProxy.logger.info('Meeting:index#setMercuryListener --> Web socket online');
5136
5382
 
5137
5383
  // Only send restore event when it was disconnected before and for connected later
@@ -5141,15 +5387,47 @@ export default class Meeting extends StatelessWebexPlugin {
5141
5387
  });
5142
5388
  }
5143
5389
  this.hasWebsocketConnected = true;
5144
- });
5390
+ };
5145
5391
 
5146
- // @ts-ignore
5147
- this.webex.internal.mercury.on(OFFLINE, () => {
5392
+ this.mercuryOfflineHandler = () => {
5148
5393
  LoggerProxy.logger.error('Meeting:index#setMercuryListener --> Web socket offline');
5149
5394
  Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.MERCURY_CONNECTION_FAILURE, {
5150
5395
  correlation_id: this.correlationId,
5151
5396
  });
5152
- });
5397
+ };
5398
+
5399
+ // @ts-ignore
5400
+ this.webex.internal.mercury.on(ONLINE, this.mercuryOnlineHandler);
5401
+ // @ts-ignore
5402
+ this.webex.internal.mercury.on(OFFLINE, this.mercuryOfflineHandler);
5403
+ }
5404
+
5405
+ /**
5406
+ * Removes this meeting's Mercury ONLINE/OFFLINE event listeners registered
5407
+ * by setMercuryListener(). Must be called before Locus /leave to avoid
5408
+ * unnecessary syncs/metrics triggered by events received while leaving
5409
+ * (per Locus team recommendation).
5410
+ *
5411
+ * Mercury is a process-wide singleton shared with other plugins, so we
5412
+ * pass the bound handler refs to .off() to avoid clearing every listener
5413
+ * for ONLINE/OFFLINE on the shared emitter.
5414
+ *
5415
+ * Idempotent: subsequent calls are no-ops because the handler refs are
5416
+ * cleared after detaching.
5417
+ * @private
5418
+ * @returns {void}
5419
+ */
5420
+ private stopListeningForMercuryEvents() {
5421
+ if (this.mercuryOnlineHandler) {
5422
+ // @ts-ignore
5423
+ this.webex.internal.mercury.off(ONLINE, this.mercuryOnlineHandler);
5424
+ this.mercuryOnlineHandler = undefined;
5425
+ }
5426
+ if (this.mercuryOfflineHandler) {
5427
+ // @ts-ignore
5428
+ this.webex.internal.mercury.off(OFFLINE, this.mercuryOfflineHandler);
5429
+ this.mercuryOfflineHandler = undefined;
5430
+ }
5153
5431
  }
5154
5432
 
5155
5433
  /**
@@ -5173,6 +5451,7 @@ export default class Meeting extends StatelessWebexPlugin {
5173
5451
  );
5174
5452
 
5175
5453
  this.receiveSlotManager.reset();
5454
+
5176
5455
  this.mediaProperties.webrtcMediaConnection.close();
5177
5456
  this.mediaProperties.unsetPeerConnection();
5178
5457
  this.sendSlotManager.reset();
@@ -5460,7 +5739,7 @@ export default class Meeting extends StatelessWebexPlugin {
5460
5739
  } = {}
5461
5740
  ) {
5462
5741
  const {mediaOptions, joinOptions = {}} = options;
5463
- const {isRetry, prevJoinResponse} = this.joinWithMediaRetryInfo;
5742
+ const {retryCount, prevJoinResponse, prevError} = this.joinWithMediaRetryInfo;
5464
5743
 
5465
5744
  if (!mediaOptions?.allowMediaInLobby) {
5466
5745
  return Promise.reject(
@@ -5471,9 +5750,6 @@ export default class Meeting extends StatelessWebexPlugin {
5471
5750
 
5472
5751
  LoggerProxy.logger.info('Meeting:index#joinWithMedia called');
5473
5752
 
5474
- let joined = false;
5475
- let joinResponse = prevJoinResponse;
5476
-
5477
5753
  /* Before we do anything, check if RTCPeerConnection is available. Normally this is checked
5478
5754
  by addMediaInternal() itself when creating the media connection, but since joinWithMedia()
5479
5755
  is a convenience method that does both join() and addMedia(), we want to fail fast here
@@ -5486,12 +5762,28 @@ export default class Meeting extends StatelessWebexPlugin {
5486
5762
  );
5487
5763
  }
5488
5764
 
5765
+ /* While we're trying to join, we may fail and be doing a retry. In that case,
5766
+ we sometimes get dropped by Locus as a result of the 1st failed attempt.
5767
+ That notification from Locus needs to be ignored, otherwise it causes the meeting to be
5768
+ cleaned up and prevents the retry from running correctly.
5769
+ */
5770
+ this.locusInfo.suspendDestroyMeeting(true);
5771
+
5772
+ let joined = false;
5773
+ let joinResponse = prevJoinResponse;
5774
+
5775
+ const shouldJoin =
5776
+ !joinResponse || // first try, when the join response is empty
5777
+ (prevError && prevError instanceof UserNotJoinedError) || // last try failed with UserNotJoinedError
5778
+ this.isErrorMeaningLocusDroppedUs(prevError) ||
5779
+ MeetingUtil.isUserInLeftState(this.locusInfo); // locus dropped the connection before we can re-try addMedia
5780
+
5489
5781
  try {
5490
5782
  let turnServerInfo;
5491
5783
  let turnDiscoverySkippedReason;
5492
5784
  let forceTurnDiscovery = false;
5493
5785
 
5494
- if (!joinResponse) {
5786
+ if (shouldJoin) {
5495
5787
  // This is the 1st attempt or a retry after join request failed -> we need to do a join with TURN discovery
5496
5788
 
5497
5789
  const turnDiscoveryRequest = await this.roap.generateTurnDiscoveryRequestMessage(
@@ -5530,16 +5822,24 @@ export default class Meeting extends StatelessWebexPlugin {
5530
5822
  joined = true;
5531
5823
  }
5532
5824
 
5825
+ const shouldRetryMediaWithOnlyTurnTLS = await this.shouldRetryMediaWithOnlyTurnTLS(prevError);
5826
+
5533
5827
  const mediaResponse = await this.addMediaInternal(
5534
5828
  () => {
5535
- return this.joinWithMediaRetryInfo.isRetry ? 'JOIN_MEETING_FINAL' : 'JOIN_MEETING_RETRY';
5829
+ // callback is not called when UserNotJoinedError is thrown
5830
+ return this.joinWithMediaRetryInfo.retryCount >= 1
5831
+ ? 'JOIN_MEETING_FINAL'
5832
+ : 'JOIN_MEETING_RETRY';
5536
5833
  },
5537
- turnServerInfo,
5538
5834
  forceTurnDiscovery,
5835
+ turnServerInfo,
5836
+ shouldRetryMediaWithOnlyTurnTLS ? 'relay' : undefined,
5539
5837
  mediaOptions
5540
5838
  );
5541
5839
 
5542
- this.joinWithMediaRetryInfo = {isRetry: false, prevJoinResponse: undefined};
5840
+ this.joinWithMediaRetryInfo = {retryCount: 0, prevJoinResponse: undefined};
5841
+
5842
+ this.locusInfo.suspendDestroyMeeting(false);
5543
5843
 
5544
5844
  return {
5545
5845
  join: joinResponse,
@@ -5553,8 +5853,12 @@ export default class Meeting extends StatelessWebexPlugin {
5553
5853
 
5554
5854
  this.roap.abortTurnDiscovery();
5555
5855
 
5556
- // if this was the first attempt, let's do a retry
5557
- let shouldRetry = !isRetry;
5856
+ // let's do a retry (but not on 1-1 calls, because the flow would get too complicated)
5857
+ let shouldRetry =
5858
+ !MeetingsUtil.isOneOnOneCall(this.locusInfo.parsedLocus) &&
5859
+ (retryCount < 1 ||
5860
+ ((error instanceof UserNotJoinedError || this.isErrorMeaningLocusDroppedUs(error)) &&
5861
+ retryCount < JOIN_WITH_MEDIA_RETRY_MAX_COUNT));
5558
5862
 
5559
5863
  if (
5560
5864
  CallDiagnosticUtils.isSdpOfferCreationError(error) ||
@@ -5579,8 +5883,8 @@ export default class Meeting extends StatelessWebexPlugin {
5579
5883
  });
5580
5884
  }
5581
5885
 
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)) {
5886
+ // we only want to call leave if join was successful, and we won't be doing any more retries
5887
+ if (joined && !shouldRetry) {
5584
5888
  try {
5585
5889
  await this.leave({resourceId: joinOptions?.resourceId, reason: 'joinWithMedia failure'});
5586
5890
  } catch (e) {
@@ -5597,7 +5901,7 @@ export default class Meeting extends StatelessWebexPlugin {
5597
5901
  reason: error.message,
5598
5902
  stack: error.stack,
5599
5903
  leaveErrorReason: leaveError?.message,
5600
- isRetry,
5904
+ isRetry: retryCount > 0,
5601
5905
  },
5602
5906
  {
5603
5907
  type: error.name,
@@ -5606,15 +5910,28 @@ export default class Meeting extends StatelessWebexPlugin {
5606
5910
 
5607
5911
  if (shouldRetry) {
5608
5912
  LoggerProxy.logger.warn('Meeting:index#joinWithMedia --> retrying call to joinWithMedia');
5609
- this.joinWithMediaRetryInfo.isRetry = true;
5913
+ this.joinWithMediaRetryInfo.retryCount = retryCount + 1;
5610
5914
  this.joinWithMediaRetryInfo.prevJoinResponse = joinResponse;
5915
+ this.joinWithMediaRetryInfo.prevError = error;
5916
+ if (!this.joinWithMediaRetryInfo.firstError) {
5917
+ this.joinWithMediaRetryInfo.firstError = error;
5918
+ }
5611
5919
 
5612
5920
  return this.joinWithMedia(options);
5613
5921
  }
5614
5922
 
5615
- this.joinWithMediaRetryInfo = {isRetry: false, prevJoinResponse: undefined};
5923
+ const {firstError} = this.joinWithMediaRetryInfo;
5616
5924
 
5617
- throw error;
5925
+ this.joinWithMediaRetryInfo = {
5926
+ retryCount: 0,
5927
+ prevJoinResponse: undefined,
5928
+ firstError: undefined,
5929
+ prevError: undefined,
5930
+ };
5931
+
5932
+ this.locusInfo.suspendDestroyMeeting(false);
5933
+
5934
+ throw firstError ?? error;
5618
5935
  }
5619
5936
  }
5620
5937
 
@@ -5857,7 +6174,18 @@ export default class Meeting extends StatelessWebexPlugin {
5857
6174
  storeEventForDebugging('llm', event.data);
5858
6175
  }
5859
6176
 
6177
+ const {trackingId} = event;
6178
+
5860
6179
  this.locusInfo.parse(this, event.data);
6180
+
6181
+ // Only the client whose /sync request tracking id matches the tracking id echoed back on this
6182
+ // LLM message should emit client.locus.sync.complete. The tracking id lives at the top level
6183
+ // of the received LLM event envelope. When it is absent there is nothing to correlate, so
6184
+ // skip. onLocusSyncLlmMessage records the LLM arrival time and is a no-op unless a stored
6185
+ // record for this meeting matches the tracking id.
6186
+ if (trackingId) {
6187
+ this.onLocusSyncLlmMessage(this.id, trackingId);
6188
+ }
5861
6189
  } else {
5862
6190
  LoggerProxy.logger.warn(
5863
6191
  `Meeting:index#processLocusLLMEvent --> Unknown event type: ${event.data.eventType}`
@@ -5865,6 +6193,31 @@ export default class Meeting extends StatelessWebexPlugin {
5865
6193
  }
5866
6194
  };
5867
6195
 
6196
+ /**
6197
+ * Verifies the relay event was delivered for the active LLM session binding.
6198
+ * @param {RelayEvent} event Event object coming from LLM Connection
6199
+ * @returns {boolean}
6200
+ */
6201
+ private isRelayEventRouteValid(event: RelayEvent): boolean {
6202
+ const route = event?.headers?.route;
6203
+
6204
+ if (!route) {
6205
+ return true;
6206
+ }
6207
+
6208
+ const {llm} = (this as any).webex.internal;
6209
+ const isPracticeSession = llm.isConnected(LLM_PRACTICE_SESSION);
6210
+ const expectedBinding = isPracticeSession
6211
+ ? llm.getBinding(LLM_PRACTICE_SESSION)
6212
+ : llm.getBinding();
6213
+
6214
+ if (!expectedBinding || route === expectedBinding) {
6215
+ return true;
6216
+ }
6217
+
6218
+ return false;
6219
+ }
6220
+
5868
6221
  /**
5869
6222
  * Callback called when a relay event is received from meeting LLM Connection
5870
6223
  * @param {RelayEvent} e Event object coming from LLM Connection
@@ -5872,6 +6225,9 @@ export default class Meeting extends StatelessWebexPlugin {
5872
6225
  * @returns {void}
5873
6226
  */
5874
6227
  private processRelayEvent = (e: RelayEvent): void => {
6228
+ if (!this.isRelayEventRouteValid(e)) {
6229
+ return;
6230
+ }
5875
6231
  switch (e.data.relayType) {
5876
6232
  case REACTION_RELAY_TYPES.REACTION:
5877
6233
  if (
@@ -5975,10 +6331,11 @@ export default class Meeting extends StatelessWebexPlugin {
5975
6331
  */
5976
6332
  private restoreLLMSubscriptionsIfNeeded(): void {
5977
6333
  try {
5978
- // @ts-ignore
5979
- const isCaptionBoxOn = this.webex.internal.voicea?.getIsCaptionBoxOn?.();
6334
+ const keepTranscriptionSubscribed =
6335
+ // @ts-ignore
6336
+ this.webex.internal.voicea?.getKeepTranscriptionSubscribed?.();
5980
6337
 
5981
- if (!isCaptionBoxOn) {
6338
+ if (!keepTranscriptionSubscribed) {
5982
6339
  return;
5983
6340
  }
5984
6341
 
@@ -6002,6 +6359,7 @@ export default class Meeting extends StatelessWebexPlugin {
6002
6359
  */
6003
6360
  private handleLLMOnline = (): void => {
6004
6361
  this.restoreLLMSubscriptionsIfNeeded();
6362
+ this.locusInfo.syncAllHashTreeDatasets({onlyLLM: true});
6005
6363
 
6006
6364
  Trigger.trigger(
6007
6365
  this,
@@ -6237,7 +6595,7 @@ export default class Meeting extends StatelessWebexPlugin {
6237
6595
  this.webex.internal.llm.off('online', this.handleLLMOnline);
6238
6596
  // @ts-ignore
6239
6597
  this.webex.internal.llm.on('online', this.handleLLMOnline);
6240
- this.updateLLMConnection()
6598
+ this.updateLLMConnection({isInitialJoinPhase: true})
6241
6599
  .catch((error) => {
6242
6600
  LoggerProxy.logger.error(
6243
6601
  'Meeting:index#join --> Transcription Socket Connection Failed',
@@ -6301,8 +6659,57 @@ export default class Meeting extends StatelessWebexPlugin {
6301
6659
  }
6302
6660
  }
6303
6661
 
6662
+ /**
6663
+ * Removes LLM event listeners and clears the health check timer.
6664
+ * Must be called before Locus /leave to avoid unnecessary syncs triggered
6665
+ * by events received while leaving (per Locus team recommendation).
6666
+ * Idempotent: safe to call multiple times; .off() is a no-op when no
6667
+ * matching listener is registered.
6668
+ * @private
6669
+ * @returns {void}
6670
+ */
6671
+ 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);
6676
+ this.clearLLMHealthCheckTimer();
6677
+ }
6678
+
6679
+ /**
6680
+ * Stops listening on every event bus (LLM, Mercury, voicea/transcription,
6681
+ * annotation) that could otherwise deliver events to this meeting while
6682
+ * Locus is processing /leave or /end. Per the Locus team recommendation,
6683
+ * this must run before the Locus request is dispatched to avoid
6684
+ * unnecessary syncs triggered by in-flight events.
6685
+ *
6686
+ * Voicea (transcription) subscribes to llm 'event:relay.event' internally,
6687
+ * and the annotation plugin subscribes to both mercury and llm, so both
6688
+ * must be torn down alongside the direct LLM/Mercury listeners.
6689
+ *
6690
+ * Idempotent: safe to call multiple times; .off() is a no-op when no
6691
+ * matching listener is registered, and stopTranscription is guarded.
6692
+ * @private
6693
+ * @returns {void}
6694
+ */
6695
+ private stopListeningForMeetingEvents() {
6696
+ this.stopListeningForLLMEvents();
6697
+ this.stopListeningForMercuryEvents();
6698
+ if (this.transcription) {
6699
+ this.stopTranscription();
6700
+ this.transcription = undefined;
6701
+ }
6702
+ this.annotation.deregisterEvents();
6703
+ }
6704
+
6304
6705
  /**
6305
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.
6712
+ *
6306
6713
  * @param {Object} options
6307
6714
  * @param {boolean} [options.removeOnlineListener=true] removes the one-time online listener
6308
6715
  * @param {boolean} [options.throwOnError=true] rethrows disconnect errors when true
@@ -6315,12 +6722,29 @@ export default class Meeting extends StatelessWebexPlugin {
6315
6722
  removeOnlineListener?: boolean;
6316
6723
  throwOnError?: boolean;
6317
6724
  } = {}): 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
+ );
6731
+
6318
6732
  try {
6319
- // @ts-ignore - Fix type
6320
- await this.webex.internal.llm.disconnectLLM({
6321
- code: 3050,
6322
- reason: 'done (permanent)',
6323
- });
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
+ }
6324
6748
  } catch (error) {
6325
6749
  LoggerProxy.logger.error(
6326
6750
  'Meeting:index#cleanupLLMConneciton --> Failed to disconnect default LLM session',
@@ -6335,23 +6759,33 @@ export default class Meeting extends StatelessWebexPlugin {
6335
6759
  // @ts-ignore - Fix type
6336
6760
  this.webex.internal.llm.off('online', this.handleLLMOnline);
6337
6761
  }
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);
6762
+ 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);
6342
6770
 
6343
- this.clearLLMHealthCheckTimer();
6771
+ if (currentOwnerAfterCleanup === this.id) {
6772
+ // @ts-ignore - Fix type
6773
+ this.webex.internal.llm.setOwnerMeetingId?.(undefined);
6774
+ }
6775
+ }
6344
6776
  }
6345
6777
  };
6346
6778
 
6347
6779
  /**
6348
- * Clears all data channel tokens stored in LLM.
6349
- * Called during meeting cleanup to ensure stale tokens are not reused.
6780
+ * Clears data channel tokens associated with this meeting ownership.
6781
+ * Ownership checks are enforced in internal-plugin-llm.
6350
6782
  * @returns {void}
6351
6783
  */
6352
6784
  clearDataChannelToken(): void {
6353
6785
  // @ts-ignore
6354
- this.webex.internal.llm.resetDatachannelTokens();
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);
6355
6789
  }
6356
6790
 
6357
6791
  /**
@@ -6366,14 +6800,15 @@ export default class Meeting extends StatelessWebexPlugin {
6366
6800
 
6367
6801
  if (datachannelToken) {
6368
6802
  // @ts-ignore
6369
- this.webex.internal.llm.setDatachannelToken(datachannelToken, DataChannelTokenType.Default);
6803
+ this.webex.internal.llm.setDatachannelToken(datachannelToken, LLM_DEFAULT_SESSION, this.id);
6370
6804
  }
6371
6805
 
6372
6806
  if (practiceSessionDatachannelToken) {
6373
6807
  // @ts-ignore
6374
6808
  this.webex.internal.llm.setDatachannelToken(
6375
6809
  practiceSessionDatachannelToken,
6376
- DataChannelTokenType.PracticeSession
6810
+ LLM_PRACTICE_SESSION,
6811
+ this.id
6377
6812
  );
6378
6813
  }
6379
6814
  }
@@ -6386,7 +6821,10 @@ export default class Meeting extends StatelessWebexPlugin {
6386
6821
  private async ensureDefaultDatachannelTokenAfterAdmit(): Promise<boolean> {
6387
6822
  try {
6388
6823
  // @ts-ignore
6389
- const datachannelToken = this.webex.internal.llm.getDatachannelToken();
6824
+ const datachannelToken = this.webex.internal.llm.getDatachannelToken(
6825
+ LLM_DEFAULT_SESSION,
6826
+ this.id
6827
+ );
6390
6828
  // @ts-ignore
6391
6829
  const isDataChannelTokenEnabled = await this.webex.internal.llm.isDataChannelTokenEnabled();
6392
6830
 
@@ -6408,7 +6846,8 @@ export default class Meeting extends StatelessWebexPlugin {
6408
6846
  // @ts-ignore
6409
6847
  this.webex.internal.llm.setDatachannelToken(
6410
6848
  fetchedDatachannelToken,
6411
- DataChannelTokenType.Default
6849
+ LLM_DEFAULT_SESSION,
6850
+ this.id
6412
6851
  );
6413
6852
 
6414
6853
  return true;
@@ -6427,23 +6866,68 @@ export default class Meeting extends StatelessWebexPlugin {
6427
6866
  /**
6428
6867
  * Connects to low latency mercury and reconnects if the address has changed
6429
6868
  * It will also disconnect if called when the meeting has ended
6869
+ * @param {Object} [options]
6870
+ * @param {boolean} [options.isInitialJoinPhase] true when called from initial join flow
6430
6871
  * @returns {Promise}
6431
6872
  */
6432
- async updateLLMConnection() {
6873
+ async updateLLMConnection({isInitialJoinPhase = false}: {isInitialJoinPhase?: boolean} = {}) {
6433
6874
  // @ts-ignore - Fix type
6434
6875
  const {url = undefined, info: {datachannelUrl = undefined} = {}} = this.locusInfo || {};
6435
6876
 
6436
6877
  const isJoined = this.isJoined();
6437
6878
 
6438
- // @ts-ignore
6439
- const datachannelToken = this.webex.internal.llm.getDatachannelToken(
6440
- DataChannelTokenType.Default
6879
+ const dataChannelUrl = datachannelUrl;
6880
+
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
6441
6891
  );
6442
6892
 
6443
- const dataChannelUrl = datachannelUrl;
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
+ }
6444
6912
 
6445
6913
  // @ts-ignore - Fix type
6446
- if (this.webex.internal.llm.isConnected()) {
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
+ );
6927
+
6928
+ return undefined;
6929
+ }
6930
+
6447
6931
  if (
6448
6932
  // @ts-ignore - Fix type
6449
6933
  url === this.webex.internal.llm.getLocusUrl() &&
@@ -6460,10 +6944,56 @@ export default class Meeting extends StatelessWebexPlugin {
6460
6944
  return undefined;
6461
6945
  }
6462
6946
 
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;
6954
+ // @ts-ignore - Fix type
6955
+ this.webex.internal.llm.setRefreshHandler(
6956
+ () => this.refreshDataChannelToken(),
6957
+ LLM_DEFAULT_SESSION,
6958
+ refreshHandlerOwnerMeetingId
6959
+ );
6960
+
6463
6961
  // @ts-ignore - Fix type
6464
6962
  return this.webex.internal.llm
6465
6963
  .registerAndConnect(url, dataChannelUrl, datachannelToken)
6466
6964
  .then((registerAndConnectResult) => {
6965
+ 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
+ }
6996
+ }
6467
6997
  // @ts-ignore - Fix type
6468
6998
  this.webex.internal.llm.off('event:relay.event', this.processRelayEvent);
6469
6999
  // @ts-ignore - Fix type
@@ -6478,10 +7008,114 @@ export default class Meeting extends StatelessWebexPlugin {
6478
7008
 
6479
7009
  this.startLLMHealthCheckTimer();
6480
7010
 
7011
+ if (registerAndConnectResult) {
7012
+ if (isInitialJoinPhase) {
7013
+ this.sendLLMConnectMetric(registerAndConnectResult);
7014
+ }
7015
+
7016
+ this.breakouts?.trigger(BREAKOUTS.EVENTS.LLM_CONNECT_RESPONSE, {
7017
+ meeting: this,
7018
+ llmLatency: registerAndConnectResult,
7019
+ });
7020
+ }
7021
+
6481
7022
  return Promise.resolve(registerAndConnectResult);
7023
+ })
7024
+ .catch((error) => {
7025
+ // Prefer the partial timing registerAndConnect attaches when register succeeded but the
7026
+ // websocket connect() failed, so a ws failure isn't misreported as register never completing.
7027
+ const llmLatency = {
7028
+ clientLLMDatachannelResponseTime: error?.timing?.clientLLMDatachannelResponseTime ?? 0,
7029
+ clientLLMWebSocketConnectTime: 0,
7030
+ };
7031
+
7032
+ if (isInitialJoinPhase) {
7033
+ this.sendLLMConnectMetric(llmLatency, error);
7034
+ }
7035
+
7036
+ this.breakouts?.trigger(BREAKOUTS.EVENTS.LLM_CONNECT_RESPONSE, {
7037
+ meeting: this,
7038
+ llmLatency,
7039
+ error,
7040
+ });
7041
+
7042
+ return Promise.reject(error);
6482
7043
  });
6483
7044
  }
6484
7045
 
7046
+ /**
7047
+ * Ensures breakout join response metric with LLM latency is emitted only once per breakout move id.
7048
+ * @param {string | undefined} breakoutMoveId
7049
+ * @param {boolean} [hasLLMLatency=false]
7050
+ * @returns {boolean}
7051
+ */
7052
+ private shouldEmitBreakoutJoinResponseMetric(
7053
+ breakoutMoveId?: string,
7054
+ hasLLMLatency = false
7055
+ ): boolean {
7056
+ if (!breakoutMoveId) {
7057
+ return false;
7058
+ }
7059
+
7060
+ if (!hasLLMLatency) {
7061
+ // When automatic LLM is enabled, updateLLMConnection will emit this same breakout join
7062
+ // response after the LLM connection finishes, including llmLatency and llmWebsocketUrl.
7063
+ // Suppress the earlier non-LLM event to avoid sending two events for the same move id,
7064
+ // where the first one would be missing the LLM-specific fields we want to validate.
7065
+ // @ts-ignore - config coming from registerPlugin
7066
+ return !this.config.enableAutomaticLLM;
7067
+ }
7068
+
7069
+ if (this.emittedBreakoutJoinResponseMoveIds.has(breakoutMoveId)) {
7070
+ return false;
7071
+ }
7072
+
7073
+ this.emittedBreakoutJoinResponseMoveIds.add(breakoutMoveId);
7074
+
7075
+ return true;
7076
+ }
7077
+
7078
+ /**
7079
+ * Sends LLM connect latencies for initial join flow.
7080
+ * @param {RegisterAndConnectTiming} timings
7081
+ * @param {any} [error]
7082
+ * @returns {void}
7083
+ */
7084
+ private sendLLMConnectMetric(timings: RegisterAndConnectTiming, error?: any) {
7085
+ // @ts-ignore
7086
+ const llmWebsocketUrl = this.webex.internal.llm.getWebSocketUrl?.() || undefined;
7087
+ const {clientLLMDatachannelResponseTime = 0, clientLLMWebSocketConnectTime} = timings || {};
7088
+
7089
+ const llmLatency: any = {
7090
+ clientLLMDatachannelResponseTime,
7091
+ };
7092
+
7093
+ if (clientLLMWebSocketConnectTime !== undefined) {
7094
+ llmLatency.clientLLMWebSocketConnectTime = clientLLMWebSocketConnectTime;
7095
+ }
7096
+
7097
+ const payload: any = {
7098
+ identifiers: {
7099
+ llmWebsocketUrl,
7100
+ },
7101
+ llmLatency,
7102
+ };
7103
+
7104
+ const options: any = {
7105
+ meetingId: this.id,
7106
+ ...(error && {rawError: error}),
7107
+ };
7108
+
7109
+ const metricEvent = {
7110
+ name: 'client.llm.connect.response',
7111
+ payload,
7112
+ options,
7113
+ };
7114
+
7115
+ // @ts-ignore
7116
+ this.webex.internal.newMetrics.submitClientEvent(metricEvent);
7117
+ }
7118
+
6485
7119
  /**
6486
7120
  * Use phone for meeting audio
6487
7121
  * @param {String} phoneNumber If provided, it will dial-out using this number. If not provided, dial-in will be used
@@ -6909,16 +7543,32 @@ export default class Meeting extends StatelessWebexPlugin {
6909
7543
  // @ts-ignore
6910
7544
  const cdl = this.webex.internal.newMetrics.callDiagnosticLatencies;
6911
7545
 
7546
+ // Compute the offer->answer latency from when the local SDP offer was generated up to now,
7547
+ // rather than from the stored remote-sdp-received timestamp. That stored timestamp uses
7548
+ // saveFirstTimestampOnly, so if waitForRemoteSDPAnswer() already timed out and submitted a
7549
+ // remote-sdp-received event, the stored value would be pinned to the timeout time and would
7550
+ // under-report an answer that arrives late. This handler fires exactly when the answer is
7551
+ // processed, so Date.now() is the accurate "received" time.
7552
+ // (submitClientEvent below still records the remote-sdp-received timestamp used by the CA
7553
+ // join-time metric, so we don't need to save it here.)
7554
+ const localSdpGeneratedTimestamp = cdl.latencyTimestamps.get(
7555
+ 'client.media-engine.local-sdp-generated'
7556
+ );
7557
+ const localSDPGenRemoteSDPRecv =
7558
+ localSdpGeneratedTimestamp !== undefined
7559
+ ? Date.now() - localSdpGeneratedTimestamp
7560
+ : undefined;
7561
+
6912
7562
  // @ts-ignore
6913
7563
  this.webex.internal.newMetrics.submitClientEvent({
6914
7564
  name: 'client.media-engine.remote-sdp-received',
7565
+ payload: {
7566
+ eventData: {
7567
+ localSDPGenRemoteSDPRecv,
7568
+ },
7569
+ },
6915
7570
  options: {meetingId: this.id},
6916
7571
  });
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
7572
 
6923
7573
  if (this.deferSDPAnswer) {
6924
7574
  this.deferSDPAnswer.resolve();
@@ -7504,23 +8154,104 @@ export default class Meeting extends StatelessWebexPlugin {
7504
8154
  }
7505
8155
  }
7506
8156
  });
8157
+ this.statsAnalyzer.on(StatsAnalyzerEventNames.STATS_UPDATE, (data) => {
8158
+ // Extract srtpCipher from transport stats
8159
+ let srtpCipher: string | undefined;
8160
+ for (const stats of data.stats.values()) {
8161
+ if (stats.type === 'transport' && stats.srtpCipher) {
8162
+ srtpCipher = stats.srtpCipher as string;
8163
+ break;
8164
+ }
8165
+ }
8166
+
8167
+ // Only emit event if srtpCipher has changed
8168
+ if (srtpCipher && srtpCipher !== this.mediaProperties.srtpCipher) {
8169
+ LoggerProxy.logger.info(
8170
+ `Meeting:index#setupStatsAnalyzerEventHandlers --> SRTP cipher changed from ${this.mediaProperties.srtpCipher} to ${srtpCipher}`
8171
+ );
8172
+ this.mediaProperties.srtpCipher = srtpCipher;
8173
+ Trigger.trigger(
8174
+ this,
8175
+ {
8176
+ file: 'meeting/index',
8177
+ function: 'setupStatsAnalyzerEventHandlers',
8178
+ },
8179
+ EVENT_TRIGGERS.MEETING_SRTP_CIPHER_UPDATED,
8180
+ {srtpCipher}
8181
+ );
8182
+ }
8183
+ });
7507
8184
  };
7508
8185
 
7509
8186
  getMediaConnectionDebugId() {
7510
8187
  return `MC-${this.id.substring(0, 4)}`;
7511
8188
  }
7512
8189
 
8190
+ /**
8191
+ * Checks if the error indicates that Locus dropped us from the meeting,
8192
+ * either directly on the error or wrapped inside an AddMediaFailed cause.
8193
+ * This method is meant to be called only with errors thrown by Meeting.addMediaInternal()
8194
+ *
8195
+ * @param {Error} error
8196
+ * @returns {boolean}
8197
+ */
8198
+ private isErrorMeaningLocusDroppedUs(error: Error | undefined): boolean {
8199
+ const statusCode = (error as any)?.statusCode;
8200
+ const causeStatusCode = (error as any)?.cause?.statusCode;
8201
+
8202
+ return (
8203
+ statusCode === 409 || statusCode === 403 || causeStatusCode === 409 || causeStatusCode === 403
8204
+ );
8205
+ }
8206
+
8207
+ /**
8208
+ * Determines if the next media attempt should use only TURN-TLS (iceTransportPolicy='relay').
8209
+ * We do this in the hope that it will minimize the chance of Homer sending DTLS packets on a wrong
8210
+ * transport (as there will be only 1 transport) and dealing with firewalls that let STUN packets through, but block
8211
+ * other UDP traffic.
8212
+ *
8213
+ * For clients landing on video mesh nodes (VMN), reachability might still have successful TLS (to public nodes)
8214
+ * but TURN discovery will result in empty TURN urls array and iceTransportPolicy='relay' will still be overriden to undefined,
8215
+ * see the code in establishMediaConnection()
8216
+ *
8217
+ * @param {Error} prevError - The error from the previous addMedia attempt
8218
+ * @returns {Promise<boolean>}
8219
+ */
8220
+ private async shouldRetryMediaWithOnlyTurnTLS(prevError: Error | undefined): Promise<boolean> {
8221
+ if (
8222
+ this.isMultistream &&
8223
+ prevError instanceof AddMediaFailed &&
8224
+ prevError.isDtlsHandshakeFailure &&
8225
+ prevError.connectionType === 'UDP'
8226
+ ) {
8227
+ const hasTlsReachability =
8228
+ // @ts-ignore
8229
+ await this.webex.meetings.reachability.isAnyClusterReachableViaProtocol('xtls');
8230
+
8231
+ if (hasTlsReachability) {
8232
+ LoggerProxy.logger.info(
8233
+ 'Meeting:index#shouldRetryMediaWithOnlyTurnTLS --> previous attempt failed due to DTLS handshake failure over UDP and TLS reachability is available'
8234
+ );
8235
+
8236
+ return true;
8237
+ }
8238
+ }
8239
+
8240
+ return false;
8241
+ }
8242
+
7513
8243
  /**
7514
8244
  * Creates a webrtc media connection and publishes streams to it
7515
8245
  *
7516
8246
  * @param {Object} turnServerInfo TURN server information
7517
8247
  * @param {BundlePolicy} [bundlePolicy] Bundle policy settings
7518
- * @param {AddMediaOptions} [options] Options for enabling/disabling audio/video
8248
+ * @param {RTCIceTransportPolicy} [iceTransportPolicy] ICE transport policy override
7519
8249
  * @returns {RoapMediaConnection | MultistreamRoapMediaConnection}
7520
8250
  */
7521
8251
  private async createMediaConnection(
7522
8252
  turnServerInfo?: TurnServerInfo,
7523
- bundlePolicy?: BundlePolicy
8253
+ bundlePolicy?: BundlePolicy,
8254
+ iceTransportPolicy?: RTCIceTransportPolicy
7524
8255
  ) {
7525
8256
  this.rtcMetrics = this.isMultistream
7526
8257
  ? // @ts-ignore
@@ -7544,12 +8275,15 @@ export default class Meeting extends StatelessWebexPlugin {
7544
8275
  enableExtmap: this.config.enableExtmap,
7545
8276
  turnServerInfo,
7546
8277
  bundlePolicy,
8278
+ iceTransportPolicy,
7547
8279
  // @ts-ignore - config coming from registerPlugin
7548
8280
  iceCandidatesTimeout: this.config.iceCandidatesGatheringTimeout,
7549
8281
  // @ts-ignore - config coming from registerPlugin
7550
8282
  disableAudioMainDtx: this.config.experimental.disableAudioMainDtx,
7551
8283
  // @ts-ignore - config coming from registerPlugin
7552
8284
  enableAudioTwcc: this.config.enableAudioTwccForMultistream,
8285
+ // @ts-ignore - config coming from registerPlugin
8286
+ enableAv1SlidesSupport: this.config.enableAv1SlidesSupport,
7553
8287
  stopIceGatheringAfterFirstRelayCandidate:
7554
8288
  // @ts-ignore - config coming from registerPlugin
7555
8289
  this.config.stopIceGatheringAfterFirstRelayCandidate,
@@ -7569,6 +8303,7 @@ export default class Meeting extends StatelessWebexPlugin {
7569
8303
  this.mediaProperties.mediaDirection.receiveShare,
7570
8304
  ];
7571
8305
 
8306
+ this.sendSlotManager.reset();
7572
8307
  this.sendSlotManager.createSlot(mc, MediaType.VideoMain, videoEnabled);
7573
8308
  this.sendSlotManager.createSlot(mc, MediaType.AudioMain, audioEnabled);
7574
8309
  this.sendSlotManager.createSlot(mc, MediaType.VideoSlides, shareEnabled);
@@ -7668,7 +8403,7 @@ export default class Meeting extends StatelessWebexPlugin {
7668
8403
  try {
7669
8404
  await this.mediaProperties.waitForMediaConnectionConnected(this.correlationId);
7670
8405
  } catch (error) {
7671
- const {iceConnected} = error;
8406
+ const {iceConnected} = error as MediaConnectionAwaiterFailureResult;
7672
8407
 
7673
8408
  if (!this.hasMediaConnectionConnectedAtLeastOnce) {
7674
8409
  // Only send CA event for join flow if we haven't successfully connected media yet
@@ -7708,13 +8443,12 @@ export default class Meeting extends StatelessWebexPlugin {
7708
8443
  });
7709
8444
  }
7710
8445
 
7711
- const timedOutError = new Error(
7712
- `Timed out waiting for media connection to be connected, correlationId=${this.correlationId}`
8446
+ throw new MediaConnectionTimedOutError(
8447
+ `Timed out waiting for media connection to be connected, correlationId=${this.correlationId}`,
8448
+ iceConnected,
8449
+ // keep reference to the original rejected result (which is the object the SDK reports to CA as rawError above)
8450
+ error
7713
8451
  );
7714
-
7715
- timedOutError.cause = error;
7716
-
7717
- throw timedOutError;
7718
8452
  }
7719
8453
  }
7720
8454
 
@@ -7760,12 +8494,12 @@ export default class Meeting extends StatelessWebexPlugin {
7760
8494
  return !member.isSelf && !member.isPairedWithSelf && !member.isAudioMuted;
7761
8495
  });
7762
8496
 
7763
- if (atLeastOneUnmutedOtherMember) {
7764
- this.mediaProperties.sendMediaIssueMetric(
7765
- 'inbound_audio',
7766
- data.issueSubType,
7767
- this.correlationId
7768
- );
8497
+ // we also ignore any issues while we're waiting in the lobby, as we're not receiving any audio yet
8498
+ if (atLeastOneUnmutedOtherMember && !this.isUserUnadmitted) {
8499
+ this.mediaProperties.sendMediaIssueMetric('inbound_audio', data.issueSubType, {
8500
+ correlationId: this.correlationId,
8501
+ isMultistream: this.isMultistream,
8502
+ });
7769
8503
 
7770
8504
  Trigger.trigger(
7771
8505
  this,
@@ -7927,7 +8661,18 @@ export default class Meeting extends StatelessWebexPlugin {
7927
8661
  error
7928
8662
  );
7929
8663
 
7930
- throw new AddMediaFailed(error);
8664
+ const {connectionType, selectedCandidatePairChanges, numTransports} =
8665
+ await this.mediaProperties.getCurrentConnectionInfo();
8666
+
8667
+ const iceConnected = error instanceof MediaConnectionTimedOutError && error.iceConnected;
8668
+
8669
+ throw new AddMediaFailed({
8670
+ cause: error,
8671
+ connectionType,
8672
+ selectedCandidatePairChanges,
8673
+ numTransports,
8674
+ iceConnected,
8675
+ });
7931
8676
  }
7932
8677
  }
7933
8678
 
@@ -8002,7 +8747,21 @@ export default class Meeting extends StatelessWebexPlugin {
8002
8747
  ({turnServerInfo} = await this.doTurnDiscovery(isReconnecting, isForced));
8003
8748
  }
8004
8749
 
8005
- const mc = await this.createMediaConnection(turnServerInfo, bundlePolicy);
8750
+ if (
8751
+ (!turnServerInfo || !turnServerInfo.urls?.length) &&
8752
+ this.addMediaData.iceTransportPolicy === 'relay'
8753
+ ) {
8754
+ LoggerProxy.logger.info(
8755
+ `${LOG_HEADER} cannot do iceTransportPolicy=relay, because there is no turn server info available`
8756
+ );
8757
+ // drop the forced relay policy and use the default, because we don't have a TURN server
8758
+ this.addMediaData.iceTransportPolicy = undefined;
8759
+ }
8760
+ const mediaConnection = await this.createMediaConnection(
8761
+ turnServerInfo,
8762
+ bundlePolicy,
8763
+ this.addMediaData.iceTransportPolicy
8764
+ );
8006
8765
 
8007
8766
  LoggerProxy.logger.info(
8008
8767
  `${LOG_HEADER} media connection created this.isMultistream=${this.isMultistream}`
@@ -8039,7 +8798,7 @@ export default class Meeting extends StatelessWebexPlugin {
8039
8798
  await this.remoteMediaManager.start();
8040
8799
  }
8041
8800
 
8042
- await mc.initiateOffer();
8801
+ await mediaConnection.initiateOffer();
8043
8802
 
8044
8803
  await this.waitForRemoteSDPAnswer();
8045
8804
 
@@ -8107,6 +8866,9 @@ export default class Meeting extends StatelessWebexPlugin {
8107
8866
 
8108
8867
  this.isMultistream = false;
8109
8868
 
8869
+ // reset iceTransportPolicy, because it's only applied for multistream media connections
8870
+ this.addMediaData.iceTransportPolicy = undefined;
8871
+
8110
8872
  if (this.mediaProperties.webrtcMediaConnection) {
8111
8873
  // close peer connection, but don't reset mute state information, because we will want to use it on the retry
8112
8874
  this.closePeerConnections(false);
@@ -8187,6 +8949,8 @@ export default class Meeting extends StatelessWebexPlugin {
8187
8949
  regionCode: this.webex.meetings.geoHintInfo?.regionCode,
8188
8950
  },
8189
8951
  preferTranscoding: !this.isMultistream,
8952
+ getCurrentSelfUrl: () => this.selfUrl,
8953
+ waitForSelfUrlChange: () => this.waitForSelfUrlChange(),
8190
8954
  },
8191
8955
  {
8192
8956
  // @ts-ignore
@@ -8195,6 +8959,41 @@ export default class Meeting extends StatelessWebexPlugin {
8195
8959
  );
8196
8960
  }
8197
8961
 
8962
+ /**
8963
+ * Waits for LocusInfo to update meeting.selfUrl, with a timeout fallback.
8964
+ * @returns {Promise<void>}
8965
+ * @private
8966
+ * @memberof Meeting
8967
+ */
8968
+ private waitForSelfUrlChange(): Promise<void> {
8969
+ if (this.joinWithMediaRetryInfo.retryCount > 0) {
8970
+ /* During joinWithMedia() retries we can get 403/409 from Locus and it doesn't mean
8971
+ * that the selfUrl will change, it is usually caused by Locus dropping us as a result of
8972
+ * media connection failure during joinWithMedia's earlier media connection attempt,
8973
+ * so we don't want to wait for selfUrl change as this would only slow down the join process. */
8974
+ LoggerProxy.logger.info(
8975
+ 'Meeting:index#waitForSelfUrlChange --> joinWithMedia retry in progress, will not wait for selfUrl change'
8976
+ );
8977
+
8978
+ return Promise.resolve();
8979
+ }
8980
+
8981
+ if (!this.promisesWaitingForPropUpdate.selfUrl) {
8982
+ const pendingSelfUrlUpdate = new Defer();
8983
+
8984
+ this.promisesWaitingForPropUpdate.selfUrl = pendingSelfUrlUpdate;
8985
+
8986
+ setTimeout(() => {
8987
+ if (this.promisesWaitingForPropUpdate.selfUrl === pendingSelfUrlUpdate) {
8988
+ delete this.promisesWaitingForPropUpdate.selfUrl;
8989
+ pendingSelfUrlUpdate.resolve();
8990
+ }
8991
+ }, 5000);
8992
+ }
8993
+
8994
+ return this.promisesWaitingForPropUpdate.selfUrl.promise;
8995
+ }
8996
+
8198
8997
  /**
8199
8998
  * Creates a media connection to the server. Media connection is required for sending or receiving any audio/video.
8200
8999
  *
@@ -8206,8 +9005,9 @@ export default class Meeting extends StatelessWebexPlugin {
8206
9005
  addMedia(options: AddMediaOptions = {}): Promise<void> {
8207
9006
  return this.addMediaInternal(
8208
9007
  () => (this.turnServerUsed ? 'JOIN_MEETING_FINAL' : 'JOIN_MEETING_RETRY'),
8209
- undefined,
8210
9008
  false,
9009
+ undefined /* turnServerInfo - it will be fetched via doTurnDiscovery() */,
9010
+ undefined /* iceTransportPolicy - we're relying on the default value */,
8211
9011
  options
8212
9012
  );
8213
9013
  }
@@ -8216,8 +9016,9 @@ export default class Meeting extends StatelessWebexPlugin {
8216
9016
  * Internal version of addMedia() with some more arguments for finer control of its behavior
8217
9017
  *
8218
9018
  * @param {Function} icePhaseCallback - callback to determine the icePhase for CA "client.ice.end" failure events
8219
- * @param {TurnServerInfo} turnServerInfo - TURN server information
8220
9019
  * @param {boolean} forceTurnDiscovery - if true, TURN discovery will be done
9020
+ * @param {TurnServerInfo} turnServerInfo - TURN server information
9021
+ * @param {RTCIceTransportPolicy} [iceTransportPolicy] - ICE transport policy override
8221
9022
  * @param {AddMediaOptions} options - same as options of the public addMedia() method
8222
9023
  * @returns {Promise<void>}
8223
9024
  * @protected
@@ -8225,12 +9026,14 @@ export default class Meeting extends StatelessWebexPlugin {
8225
9026
  */
8226
9027
  protected async addMediaInternal(
8227
9028
  icePhaseCallback: () => string,
8228
- turnServerInfo: TurnServerInfo,
8229
- forceTurnDiscovery,
9029
+ forceTurnDiscovery: boolean,
9030
+ turnServerInfo?: TurnServerInfo,
9031
+ iceTransportPolicy?: RTCIceTransportPolicy,
8230
9032
  options: AddMediaOptions = {}
8231
9033
  ): Promise<void> {
8232
9034
  this.addMediaData.retriedWithTurnServer = false;
8233
9035
  this.addMediaData.icePhaseCallback = icePhaseCallback;
9036
+ this.addMediaData.iceTransportPolicy = iceTransportPolicy;
8234
9037
 
8235
9038
  this.hasMediaConnectionConnectedAtLeastOnce = false;
8236
9039
  const LOG_HEADER = 'Meeting:index#addMedia -->';
@@ -8239,7 +9042,7 @@ export default class Meeting extends StatelessWebexPlugin {
8239
9042
  options
8240
9043
  )}, turnServerInfo=${JSON.stringify(
8241
9044
  turnServerInfo
8242
- )}, forceTurnDiscovery=${forceTurnDiscovery}`
9045
+ )}, forceTurnDiscovery=${forceTurnDiscovery}, iceTransportPolicy=${iceTransportPolicy}`
8243
9046
  );
8244
9047
 
8245
9048
  if (options.allowMediaInLobby !== true && this.meetingState !== FULL_STATE.ACTIVE) {
@@ -8353,12 +9156,7 @@ export default class Meeting extends StatelessWebexPlugin {
8353
9156
 
8354
9157
  // Establish new media connection with forced TURN discovery
8355
9158
  // 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
- );
9159
+ await this.establishMediaConnection(remoteMediaManagerConfig, bundlePolicy, true);
8362
9160
  } else {
8363
9161
  throw error;
8364
9162
  }
@@ -8387,7 +9185,8 @@ export default class Meeting extends StatelessWebexPlugin {
8387
9185
  numTransports,
8388
9186
  isMultistream: this.isMultistream,
8389
9187
  retriedWithTurnServer: this.addMediaData.retriedWithTurnServer,
8390
- isJoinWithMediaRetry: this.joinWithMediaRetryInfo.isRetry,
9188
+ isJoinWithMediaRetry: this.joinWithMediaRetryInfo.retryCount > 0,
9189
+ iceTransportPolicy: this.addMediaData.iceTransportPolicy || 'all',
8391
9190
  ...reachabilityMetrics,
8392
9191
  ...iceCandidateErrors,
8393
9192
  iceCandidatesCount: this.iceCandidatesCount,
@@ -8409,14 +9208,16 @@ export default class Meeting extends StatelessWebexPlugin {
8409
9208
  // We can log ReceiveSlot SSRCs only after the SDP exchange, so doing it here:
8410
9209
  this.remoteMediaManager?.logAllReceiveSlots();
8411
9210
  this.startPeriodicLogUpload();
8412
- } catch (error) {
9211
+ } catch (error: any) {
8413
9212
  LoggerProxy.logger.error(`${LOG_HEADER} failed to establish media connection: `, error);
8414
9213
 
8415
9214
  // @ts-ignore
8416
9215
  const reachabilityMetrics = await this.getMediaReachabilityMetricFields();
8417
9216
 
8418
- const {selectedCandidatePairChanges, numTransports} =
8419
- await this.mediaProperties.getCurrentConnectionInfo();
9217
+ const {connectionType, selectedCandidatePairChanges, numTransports} =
9218
+ error instanceof AddMediaFailed
9219
+ ? error
9220
+ : await this.mediaProperties.getCurrentConnectionInfo();
8420
9221
 
8421
9222
  const iceCandidateErrors = Object.fromEntries(this.iceCandidateErrors);
8422
9223
 
@@ -8432,7 +9233,8 @@ export default class Meeting extends StatelessWebexPlugin {
8432
9233
  turnServerUsed: this.turnServerUsed,
8433
9234
  retriedWithTurnServer: this.addMediaData.retriedWithTurnServer,
8434
9235
  isMultistream: this.isMultistream,
8435
- isJoinWithMediaRetry: this.joinWithMediaRetryInfo.isRetry,
9236
+ isJoinWithMediaRetry: this.joinWithMediaRetryInfo.retryCount > 0,
9237
+ iceTransportPolicy: this.addMediaData.iceTransportPolicy || 'all',
8436
9238
  signalingState:
8437
9239
  this.mediaProperties.webrtcMediaConnection?.multistreamConnection?.pc?.pc
8438
9240
  ?.signalingState ||
@@ -8448,6 +9250,7 @@ export default class Meeting extends StatelessWebexPlugin {
8448
9250
  ?.iceConnectionState ||
8449
9251
  this.mediaProperties.webrtcMediaConnection?.mediaConnection?.pc?.iceConnectionState ||
8450
9252
  'unknown',
9253
+ connectionType,
8451
9254
  ...reachabilityMetrics,
8452
9255
  ...iceCandidateErrors,
8453
9256
  iceCandidatesCount: this.iceCandidatesCount,
@@ -8796,6 +9599,7 @@ export default class Meeting extends StatelessWebexPlugin {
8796
9599
  options: {meetingId: this.id},
8797
9600
  });
8798
9601
  LoggerProxy.logger.log('Meeting:index#leave --> Leaving a meeting');
9602
+ this.stopListeningForMeetingEvents();
8799
9603
 
8800
9604
  return MeetingUtil.leaveMeeting(this, options)
8801
9605
  .then(async (leave) => {
@@ -9661,6 +10465,8 @@ export default class Meeting extends StatelessWebexPlugin {
9661
10465
  locus_id: this.locusId,
9662
10466
  });
9663
10467
 
10468
+ this.stopListeningForMeetingEvents();
10469
+
9664
10470
  return MeetingUtil.endMeetingForAll(this)
9665
10471
  .then(async (end) => {
9666
10472
  this.meetingFiniteStateMachine.end();
@@ -9722,12 +10528,15 @@ export default class Meeting extends StatelessWebexPlugin {
9722
10528
  }
9723
10529
  this.queuedMediaUpdates = [];
9724
10530
 
9725
- this.stopTranscription();
9726
- this.transcription = undefined;
9727
-
9728
- this.annotation.deregisterEvents();
9729
-
10531
+ // Listener teardown (transcription, annotation, llm/mercury) runs in
10532
+ // 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().
9730
10538
  this.clearDataChannelToken();
10539
+
9731
10540
  await this.cleanupLLMConneciton({throwOnError: false});
9732
10541
  };
9733
10542
 
@@ -9804,15 +10613,12 @@ export default class Meeting extends StatelessWebexPlugin {
9804
10613
  * @public
9805
10614
  * @memberof Meeting
9806
10615
  */
9807
- public sendReaction(reactionType: ReactionServerType, skinToneType?: SkinToneType) {
10616
+ public sendReaction(reactionType: string, skinToneType?: SkinToneType) {
9808
10617
  const reactionChannelUrl = this.locusInfo?.controls?.reactions?.reactionChannelUrl as string;
9809
10618
  const participantId = this.members.selfId;
9810
10619
 
9811
- const reactionData = Reactions[reactionType];
10620
+ const reactionData = Reactions[reactionType] || {type: reactionType};
9812
10621
 
9813
- if (!reactionData) {
9814
- return Promise.reject(new Error(`${reactionType} is not a valid reaction.`));
9815
- }
9816
10622
  const skinToneData = SkinTones[skinToneType] || SkinTones.normal;
9817
10623
  const reaction: Reaction = {
9818
10624
  ...reactionData,