@webex/plugin-meetings 3.12.0-auth-prejoin-fetch.1 → 3.12.0-llmrefactor.10
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.
- package/dist/aiEnableRequest/index.js +1 -1
- package/dist/annotation/index.js +53 -17
- package/dist/annotation/index.js.map +1 -1
- package/dist/breakouts/breakout.js +1 -1
- package/dist/breakouts/index.js +35 -9
- package/dist/breakouts/index.js.map +1 -1
- package/dist/hashTree/hashTreeParser.js +101 -48
- package/dist/hashTree/hashTreeParser.js.map +1 -1
- package/dist/interceptors/dataChannelAuthToken.js +41 -59
- package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
- package/dist/interpretation/index.js +1 -1
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/locus-info/index.js +27 -2
- package/dist/locus-info/index.js.map +1 -1
- package/dist/locus-info/types.js +2 -1
- package/dist/locus-info/types.js.map +1 -1
- package/dist/meeting/index.js +913 -921
- package/dist/meeting/index.js.map +1 -1
- package/dist/meeting/util.js +5 -1
- package/dist/meeting/util.js.map +1 -1
- package/dist/meeting/voicea-meeting.js +2 -1
- package/dist/meeting/voicea-meeting.js.map +1 -1
- package/dist/meeting-info/meeting-info-v2.js +36 -92
- package/dist/meeting-info/meeting-info-v2.js.map +1 -1
- package/dist/meetings/index.js +33 -93
- package/dist/meetings/index.js.map +1 -1
- package/dist/meetings/meetings.types.js.map +1 -1
- package/dist/types/annotation/index.d.ts +19 -0
- package/dist/types/hashTree/hashTreeParser.d.ts +12 -0
- package/dist/types/locus-info/index.d.ts +6 -0
- package/dist/types/locus-info/types.d.ts +1 -0
- package/dist/types/meeting/index.d.ts +47 -20
- package/dist/types/meeting/util.d.ts +3 -1
- package/dist/types/meeting-info/meeting-info-v2.d.ts +1 -24
- package/dist/types/meetings/index.d.ts +2 -13
- package/dist/types/meetings/meetings.types.d.ts +1 -15
- package/dist/webinar/index.js +298 -255
- package/dist/webinar/index.js.map +1 -1
- package/package.json +21 -21
- package/src/annotation/index.ts +55 -25
- package/src/breakouts/index.ts +33 -11
- package/src/hashTree/hashTreeParser.ts +67 -3
- package/src/interceptors/dataChannelAuthToken.ts +48 -77
- package/src/locus-info/index.ts +20 -0
- package/src/locus-info/types.ts +1 -0
- package/src/meeting/index.ts +318 -332
- package/src/meeting/util.ts +2 -2
- package/src/meeting/voicea-meeting.ts +1 -1
- package/src/meeting-info/meeting-info-v2.ts +18 -74
- package/src/meetings/index.ts +6 -70
- package/src/meetings/meetings.types.ts +1 -17
- package/src/webinar/index.ts +168 -188
- package/test/unit/spec/annotation/index.ts +214 -182
- package/test/unit/spec/breakouts/index.ts +126 -25
- package/test/unit/spec/hashTree/hashTreeParser.ts +212 -1
- package/test/unit/spec/interceptors/dataChannelAuthToken.ts +81 -99
- package/test/unit/spec/locus-info/index.js +79 -0
- package/test/unit/spec/meeting/index.js +979 -701
- package/test/unit/spec/meeting/utils.js +16 -2
- package/test/unit/spec/meeting/voicea-meeting.ts +85 -1
- package/test/unit/spec/meeting-info/meetinginfov2.js +0 -210
- package/test/unit/spec/meetings/index.js +5 -231
- package/test/unit/spec/webinar/index.ts +886 -718
package/src/meeting/index.ts
CHANGED
|
@@ -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 {
|
|
@@ -138,8 +140,6 @@ import {
|
|
|
138
140
|
STAGE_MANAGER_TYPE,
|
|
139
141
|
LOCUSEVENT,
|
|
140
142
|
LOCUS_LLM_EVENT,
|
|
141
|
-
LLM_DEFAULT_SESSION,
|
|
142
|
-
LLM_PRACTICE_SESSION,
|
|
143
143
|
} from '../constants';
|
|
144
144
|
import BEHAVIORAL_METRICS from '../metrics/constants';
|
|
145
145
|
import ParameterError from '../common/errors/parameter';
|
|
@@ -150,7 +150,6 @@ import {
|
|
|
150
150
|
MeetingInfoV2JoinWebinarError,
|
|
151
151
|
MeetingInfoV2JoinForbiddenError,
|
|
152
152
|
} from '../meeting-info/meeting-info-v2';
|
|
153
|
-
import type {PrefetchedMeetingInfo} from '../meetings/meetings.types';
|
|
154
153
|
import {CSI, ReceiveSlotManager} from '../multistream/receiveSlotManager';
|
|
155
154
|
import SendSlotManager from '../multistream/sendSlotManager';
|
|
156
155
|
import {MediaRequestManager} from '../multistream/mediaRequestManager';
|
|
@@ -187,7 +186,7 @@ import {ReachabilityMetrics} from '../reachability/reachability.types';
|
|
|
187
186
|
import {SetStageOptions, SetStageVideoLayout, UnsetStageVideoLayout} from './request.type';
|
|
188
187
|
import {Invitee} from './type';
|
|
189
188
|
import {DataSet, HashTreeMessage, Metadata} from '../hashTree/hashTreeParser';
|
|
190
|
-
import {LocusDTO} from '../locus-info/types';
|
|
189
|
+
import {LocusDTO, LocusErrorCodes} from '../locus-info/types';
|
|
191
190
|
import AIEnableRequest from '../aiEnableRequest';
|
|
192
191
|
|
|
193
192
|
// default callback so we don't call an undefined function, but in practice it should never be used
|
|
@@ -740,6 +739,26 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
740
739
|
turnDiscoverySkippedReason: TurnDiscoverySkipReason;
|
|
741
740
|
turnServerUsed: boolean;
|
|
742
741
|
areVoiceaEventsSetup = false;
|
|
742
|
+
/**
|
|
743
|
+
* Returns the initial transcription object shape.
|
|
744
|
+
* Used by constructor and reset paths to ensure consistent initialization.
|
|
745
|
+
* @private
|
|
746
|
+
* @returns {Transcription}
|
|
747
|
+
*/
|
|
748
|
+
private getInitialTranscription(): Transcription {
|
|
749
|
+
return {
|
|
750
|
+
captions: [],
|
|
751
|
+
isListening: false,
|
|
752
|
+
commandText: '',
|
|
753
|
+
languageOptions: {currentSpokenLanguage: 'en'},
|
|
754
|
+
showCaptionBox: false,
|
|
755
|
+
transcribingRequestStatus: 'INACTIVE',
|
|
756
|
+
isCaptioning: false,
|
|
757
|
+
interimCaptions: {} as Map<string, CaptionData>,
|
|
758
|
+
speakerProxy: {} as Map<string, any>,
|
|
759
|
+
} as Transcription;
|
|
760
|
+
}
|
|
761
|
+
|
|
743
762
|
isMoveToInProgress = false;
|
|
744
763
|
registrationIdStatus: string;
|
|
745
764
|
brbState: BrbState;
|
|
@@ -817,6 +836,22 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
817
836
|
private mediaServerIp: string;
|
|
818
837
|
private llmHealthCheckTimer?: ReturnType<typeof setTimeout>;
|
|
819
838
|
|
|
839
|
+
/**
|
|
840
|
+
* The LLM channel owned by this meeting for datachannel communication.
|
|
841
|
+
* Created in updateLLMConnection, cleaned up in cleanupLLMConneciton.
|
|
842
|
+
*/
|
|
843
|
+
private llmChannel?: LLMChannel;
|
|
844
|
+
|
|
845
|
+
/**
|
|
846
|
+
* The Voicea channel for transcription/captions, bound to this meeting's LLM channel.
|
|
847
|
+
*/
|
|
848
|
+
voiceaChannel?: VoiceaChannel;
|
|
849
|
+
|
|
850
|
+
/**
|
|
851
|
+
* Pending datachannel token saved from join response, used when creating the LLM channel.
|
|
852
|
+
*/
|
|
853
|
+
private _pendingDatachannelToken?: string;
|
|
854
|
+
|
|
820
855
|
/**
|
|
821
856
|
* @param {Object} attrs
|
|
822
857
|
* @param {Object} options
|
|
@@ -970,6 +1005,16 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
970
1005
|
*/
|
|
971
1006
|
// @ts-ignore
|
|
972
1007
|
this.webinar = new Webinar({meetingId: this.id}, {parent: this.webex});
|
|
1008
|
+
/**
|
|
1009
|
+
* VoiceaChannel for transcription/captions. Created without llmChannel;
|
|
1010
|
+
* switchLLMChannel() is called in updateLLMConnection() when LLM connects.
|
|
1011
|
+
* @instance
|
|
1012
|
+
* @type {VoiceaChannel}
|
|
1013
|
+
* @public
|
|
1014
|
+
* @memberof Meeting
|
|
1015
|
+
*/
|
|
1016
|
+
// @ts-ignore - Fix type
|
|
1017
|
+
this.voiceaChannel = this.webex.internal.voicea.createChannel();
|
|
973
1018
|
/**
|
|
974
1019
|
* helper class for managing receive slots (for multistream media connections)
|
|
975
1020
|
*/
|
|
@@ -1493,17 +1538,7 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
1493
1538
|
* @private
|
|
1494
1539
|
* @memberof Meeting
|
|
1495
1540
|
*/
|
|
1496
|
-
this.transcription =
|
|
1497
|
-
captions: [],
|
|
1498
|
-
isListening: false,
|
|
1499
|
-
commandText: '',
|
|
1500
|
-
languageOptions: {currentSpokenLanguage: 'en'},
|
|
1501
|
-
showCaptionBox: false,
|
|
1502
|
-
transcribingRequestStatus: 'INACTIVE',
|
|
1503
|
-
isCaptioning: false,
|
|
1504
|
-
interimCaptions: {} as Map<string, CaptionData>,
|
|
1505
|
-
speakerProxy: {} as Map<string, any>,
|
|
1506
|
-
} as Transcription;
|
|
1541
|
+
this.transcription = this.getInitialTranscription();
|
|
1507
1542
|
|
|
1508
1543
|
/**
|
|
1509
1544
|
* Password status. If it's PASSWORD_STATUS.REQUIRED then verifyPassword() needs to be called
|
|
@@ -2076,33 +2111,26 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
2076
2111
|
sendCAevents = false,
|
|
2077
2112
|
registrationId = null,
|
|
2078
2113
|
classificationId = null,
|
|
2079
|
-
prefetchedMeetingInfo = null,
|
|
2080
2114
|
}): Promise<void> {
|
|
2081
2115
|
try {
|
|
2082
2116
|
const captchaInfo = captchaCode
|
|
2083
2117
|
? {code: captchaCode, id: this.requiredCaptcha.captchaId}
|
|
2084
2118
|
: null;
|
|
2085
2119
|
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
{meetingId: this.id, sendCAevents, correlationId: this.correlationId},
|
|
2101
|
-
registrationId,
|
|
2102
|
-
null,
|
|
2103
|
-
classificationId
|
|
2104
|
-
);
|
|
2105
|
-
}
|
|
2120
|
+
const info = await this.attrs.meetingInfoProvider.fetchMeetingInfo(
|
|
2121
|
+
destination,
|
|
2122
|
+
destinationType,
|
|
2123
|
+
password,
|
|
2124
|
+
captchaInfo,
|
|
2125
|
+
// @ts-ignore - config coming from registerPlugin
|
|
2126
|
+
this.config.installedOrgID,
|
|
2127
|
+
this.locusId,
|
|
2128
|
+
extraParams,
|
|
2129
|
+
{meetingId: this.id, sendCAevents, correlationId: this.correlationId},
|
|
2130
|
+
registrationId,
|
|
2131
|
+
null,
|
|
2132
|
+
classificationId
|
|
2133
|
+
);
|
|
2106
2134
|
|
|
2107
2135
|
this.parseMeetingInfo(info?.body, this.destination, info?.errors);
|
|
2108
2136
|
this.setMeetingInfo(info?.body, info?.url);
|
|
@@ -2297,26 +2325,6 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
2297
2325
|
});
|
|
2298
2326
|
}
|
|
2299
2327
|
|
|
2300
|
-
/**
|
|
2301
|
-
* Consumes meeting information requested before this Meeting was created.
|
|
2302
|
-
*
|
|
2303
|
-
* @param {PrefetchedMeetingInfo} prefetchedMeetingInfo opaque early request handle
|
|
2304
|
-
* @returns {Promise<void>} resolves after the response is applied to this Meeting
|
|
2305
|
-
*/
|
|
2306
|
-
public async consumePrefetchedMeetingInfo(prefetchedMeetingInfo: PrefetchedMeetingInfo) {
|
|
2307
|
-
const {provider, request, extraParams} = prefetchedMeetingInfo;
|
|
2308
|
-
|
|
2309
|
-
await this.prepForFetchMeetingInfo({extraParams}, 'consumePrefetchedMeetingInfo');
|
|
2310
|
-
this.attrs.meetingInfoProvider = provider;
|
|
2311
|
-
|
|
2312
|
-
return this.fetchMeetingInfoInternal({
|
|
2313
|
-
destination: this.destination,
|
|
2314
|
-
destinationType: this.destinationType,
|
|
2315
|
-
extraParams,
|
|
2316
|
-
prefetchedMeetingInfo: {request},
|
|
2317
|
-
});
|
|
2318
|
-
}
|
|
2319
|
-
|
|
2320
2328
|
/**
|
|
2321
2329
|
* Checks if the supplied password/host key is correct. It returns a promise with information whether the
|
|
2322
2330
|
* password and captcha code were correct or not.
|
|
@@ -2692,29 +2700,28 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
2692
2700
|
* @memberof Meeting
|
|
2693
2701
|
*/
|
|
2694
2702
|
private setUpVoiceaListeners() {
|
|
2695
|
-
|
|
2696
|
-
|
|
2703
|
+
if (!this.voiceaChannel) {
|
|
2704
|
+
LoggerProxy.logger.warn('Meeting:index#setUpVoiceaListeners --> voiceaChannel not available');
|
|
2697
2705
|
|
|
2698
|
-
|
|
2699
|
-
|
|
2706
|
+
return;
|
|
2707
|
+
}
|
|
2708
|
+
|
|
2709
|
+
this.voiceaChannel.on(
|
|
2700
2710
|
VOICEAEVENTS.VOICEA_ANNOUNCEMENT,
|
|
2701
2711
|
this.voiceaListenerCallbacks[VOICEAEVENTS.VOICEA_ANNOUNCEMENT]
|
|
2702
2712
|
);
|
|
2703
2713
|
|
|
2704
|
-
|
|
2705
|
-
this.webex.internal.voicea.on(
|
|
2714
|
+
this.voiceaChannel.on(
|
|
2706
2715
|
VOICEAEVENTS.CAPTIONS_TURNED_ON,
|
|
2707
2716
|
this.voiceaListenerCallbacks[VOICEAEVENTS.CAPTIONS_TURNED_ON]
|
|
2708
2717
|
);
|
|
2709
2718
|
|
|
2710
|
-
|
|
2711
|
-
this.webex.internal.voicea.on(
|
|
2719
|
+
this.voiceaChannel.on(
|
|
2712
2720
|
VOICEAEVENTS.EVA_COMMAND,
|
|
2713
2721
|
this.voiceaListenerCallbacks[VOICEAEVENTS.EVA_COMMAND]
|
|
2714
2722
|
);
|
|
2715
2723
|
|
|
2716
|
-
|
|
2717
|
-
this.webex.internal.voicea.on(
|
|
2724
|
+
this.voiceaChannel.on(
|
|
2718
2725
|
VOICEAEVENTS.NEW_CAPTION,
|
|
2719
2726
|
this.voiceaListenerCallbacks[VOICEAEVENTS.NEW_CAPTION]
|
|
2720
2727
|
);
|
|
@@ -3059,18 +3066,22 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
3059
3066
|
// user need to be joined to start the llm and receive transcription
|
|
3060
3067
|
if (this.isJoined()) {
|
|
3061
3068
|
// @ts-ignore - config coming from registerPlugin
|
|
3062
|
-
if (transcribing && !this.
|
|
3063
|
-
this.
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3069
|
+
if (transcribing && !this.areVoiceaEventsSetup) {
|
|
3070
|
+
if (this.voiceaChannel?.isLLMConnected()) {
|
|
3071
|
+
this.startTranscription();
|
|
3072
|
+
}
|
|
3073
|
+
} else if (!transcribing) {
|
|
3074
|
+
if (this.areVoiceaEventsSetup) {
|
|
3075
|
+
Trigger.trigger(
|
|
3076
|
+
this,
|
|
3077
|
+
{
|
|
3078
|
+
file: 'meeting/index',
|
|
3079
|
+
function: 'setupLocusControlsListener',
|
|
3080
|
+
},
|
|
3081
|
+
EVENT_TRIGGERS.MEETING_STOPPED_RECEIVING_TRANSCRIPTION,
|
|
3082
|
+
{caption, transcribing}
|
|
3083
|
+
);
|
|
3084
|
+
}
|
|
3074
3085
|
}
|
|
3075
3086
|
}
|
|
3076
3087
|
}
|
|
@@ -3083,8 +3094,7 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
3083
3094
|
if (this.transcription?.languageOptions) {
|
|
3084
3095
|
this.transcription.languageOptions.currentSpokenLanguage = spokenLanguage;
|
|
3085
3096
|
}
|
|
3086
|
-
|
|
3087
|
-
this.webex.internal.voicea.onSpokenLanguageUpdate(spokenLanguage, this.id);
|
|
3097
|
+
this.voiceaChannel?.onSpokenLanguageUpdate(spokenLanguage, this.id);
|
|
3088
3098
|
|
|
3089
3099
|
Trigger.trigger(
|
|
3090
3100
|
this,
|
|
@@ -3113,8 +3123,7 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
3113
3123
|
|
|
3114
3124
|
this.locusInfo.on(LOCUSINFO.EVENTS.CONTROLS_MEETING_HESIOD_LLM_ID_UPDATED, ({hesiodLlmId}) => {
|
|
3115
3125
|
if (hesiodLlmId) {
|
|
3116
|
-
|
|
3117
|
-
this.webex.internal.voicea.onCaptionServiceIdUpdate(hesiodLlmId);
|
|
3126
|
+
this.voiceaChannel?.onCaptionServiceIdUpdate(hesiodLlmId);
|
|
3118
3127
|
}
|
|
3119
3128
|
});
|
|
3120
3129
|
|
|
@@ -3979,7 +3988,6 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
3979
3988
|
}`
|
|
3980
3989
|
);
|
|
3981
3990
|
}
|
|
3982
|
-
|
|
3983
3991
|
this.updateLLMConnection();
|
|
3984
3992
|
});
|
|
3985
3993
|
|
|
@@ -5890,10 +5898,12 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
5890
5898
|
|
|
5891
5899
|
if (
|
|
5892
5900
|
CallDiagnosticUtils.isSdpOfferCreationError(error) ||
|
|
5893
|
-
CallDiagnosticUtils.isWebrtcApiNotAvailableError(error)
|
|
5901
|
+
CallDiagnosticUtils.isWebrtcApiNotAvailableError(error) ||
|
|
5902
|
+
this.isLocusUserFullError(error)
|
|
5894
5903
|
) {
|
|
5895
5904
|
// errors related to offer creation (for example missing H264 codec) will happen again no matter how many times we try,
|
|
5896
5905
|
// so there is no point doing a retry
|
|
5906
|
+
// when the locus is full, we also don't want to retry, because it will just fail again
|
|
5897
5907
|
shouldRetry = false;
|
|
5898
5908
|
}
|
|
5899
5909
|
|
|
@@ -5959,7 +5969,9 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
5959
5969
|
|
|
5960
5970
|
this.locusInfo.suspendDestroyMeeting(false);
|
|
5961
5971
|
|
|
5962
|
-
|
|
5972
|
+
// LOCUS_USER_FULL is a definitive capacity error the client must surface, so it takes
|
|
5973
|
+
// precedence over any earlier retryable error stored in firstError.
|
|
5974
|
+
throw this.isLocusUserFullError(error) ? error : firstError ?? error;
|
|
5963
5975
|
}
|
|
5964
5976
|
}
|
|
5965
5977
|
|
|
@@ -6064,8 +6076,7 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
6064
6076
|
|
|
6065
6077
|
try {
|
|
6066
6078
|
const voiceaListenerCaptionUpdate = (payload) => {
|
|
6067
|
-
|
|
6068
|
-
this.webex.internal.voicea.off(
|
|
6079
|
+
this.voiceaChannel?.off(
|
|
6069
6080
|
VOICEAEVENTS.CAPTION_LANGUAGE_UPDATE,
|
|
6070
6081
|
voiceaListenerCaptionUpdate
|
|
6071
6082
|
);
|
|
@@ -6081,13 +6092,8 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
6081
6092
|
reject(payload);
|
|
6082
6093
|
}
|
|
6083
6094
|
};
|
|
6084
|
-
|
|
6085
|
-
this.
|
|
6086
|
-
VOICEAEVENTS.CAPTION_LANGUAGE_UPDATE,
|
|
6087
|
-
voiceaListenerCaptionUpdate
|
|
6088
|
-
);
|
|
6089
|
-
// @ts-ignore
|
|
6090
|
-
this.webex.internal.voicea.requestLanguage(language);
|
|
6095
|
+
this.voiceaChannel?.on(VOICEAEVENTS.CAPTION_LANGUAGE_UPDATE, voiceaListenerCaptionUpdate);
|
|
6096
|
+
this.voiceaChannel?.requestLanguage(language);
|
|
6091
6097
|
} catch (error) {
|
|
6092
6098
|
LoggerProxy.logger.error(`Meeting:index#setCaptionLanguage --> ${error}`);
|
|
6093
6099
|
|
|
@@ -6121,8 +6127,7 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
6121
6127
|
|
|
6122
6128
|
try {
|
|
6123
6129
|
const voiceaListenerLanguageUpdate = (payload) => {
|
|
6124
|
-
|
|
6125
|
-
this.webex.internal.voicea.off(
|
|
6130
|
+
this.voiceaChannel?.off(
|
|
6126
6131
|
VOICEAEVENTS.SPOKEN_LANGUAGE_UPDATE,
|
|
6127
6132
|
voiceaListenerLanguageUpdate
|
|
6128
6133
|
);
|
|
@@ -6139,14 +6144,9 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
6139
6144
|
}
|
|
6140
6145
|
};
|
|
6141
6146
|
|
|
6142
|
-
|
|
6143
|
-
this.webex.internal.voicea.on(
|
|
6144
|
-
VOICEAEVENTS.SPOKEN_LANGUAGE_UPDATE,
|
|
6145
|
-
voiceaListenerLanguageUpdate
|
|
6146
|
-
);
|
|
6147
|
+
this.voiceaChannel?.on(VOICEAEVENTS.SPOKEN_LANGUAGE_UPDATE, voiceaListenerLanguageUpdate);
|
|
6147
6148
|
|
|
6148
|
-
|
|
6149
|
-
this.webex.internal.voicea.setSpokenLanguage(language);
|
|
6149
|
+
this.voiceaChannel?.setSpokenLanguage(language);
|
|
6150
6150
|
} catch (error) {
|
|
6151
6151
|
LoggerProxy.logger.error(`Meeting:index#setSpokenLanguage --> ${error}`);
|
|
6152
6152
|
|
|
@@ -6168,12 +6168,18 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
6168
6168
|
);
|
|
6169
6169
|
|
|
6170
6170
|
try {
|
|
6171
|
+
if (!this.voiceaChannel) {
|
|
6172
|
+
LoggerProxy.logger.warn(
|
|
6173
|
+
'Meeting:index#startTranscription --> voiceaChannel not available'
|
|
6174
|
+
);
|
|
6175
|
+
|
|
6176
|
+
return;
|
|
6177
|
+
}
|
|
6178
|
+
|
|
6171
6179
|
if (!this.areVoiceaEventsSetup) {
|
|
6172
6180
|
this.setUpVoiceaListeners();
|
|
6173
6181
|
}
|
|
6174
|
-
|
|
6175
|
-
// @ts-ignore
|
|
6176
|
-
await this.webex.internal.voicea.turnOnCaptions(options?.spokenLanguage);
|
|
6182
|
+
await this.voiceaChannel.turnOnCaptions(options?.spokenLanguage);
|
|
6177
6183
|
} catch (error) {
|
|
6178
6184
|
LoggerProxy.logger.error(`Meeting:index#startTranscription --> ${error}`);
|
|
6179
6185
|
Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.RECEIVE_TRANSCRIPTION_FAILURE, {
|
|
@@ -6190,6 +6196,22 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
6190
6196
|
}
|
|
6191
6197
|
}
|
|
6192
6198
|
|
|
6199
|
+
/**
|
|
6200
|
+
* Starts transcription when requested by the current Locus controls and an
|
|
6201
|
+
* active LLM channel is ready.
|
|
6202
|
+
* @internal
|
|
6203
|
+
* @returns {void}
|
|
6204
|
+
*/
|
|
6205
|
+
public startTranscriptionIfNeeded(): void {
|
|
6206
|
+
if (
|
|
6207
|
+
this.locusInfo.controls?.transcribe?.transcribing &&
|
|
6208
|
+
!this.areVoiceaEventsSetup &&
|
|
6209
|
+
this.voiceaChannel?.isLLMConnected()
|
|
6210
|
+
) {
|
|
6211
|
+
this.startTranscription();
|
|
6212
|
+
}
|
|
6213
|
+
}
|
|
6214
|
+
|
|
6193
6215
|
/** Handles Locus LLM events
|
|
6194
6216
|
*
|
|
6195
6217
|
* @param {LocusLLMEvent} event - The Locus LLM event to process
|
|
@@ -6223,6 +6245,8 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
6223
6245
|
|
|
6224
6246
|
/**
|
|
6225
6247
|
* Verifies the relay event was delivered for the active LLM session binding.
|
|
6248
|
+
* With the factory pattern, each meeting owns its channel, so we just verify
|
|
6249
|
+
* the route matches our channel's binding or the practice session binding.
|
|
6226
6250
|
* @param {RelayEvent} event Event object coming from LLM Connection
|
|
6227
6251
|
* @returns {boolean}
|
|
6228
6252
|
*/
|
|
@@ -6233,11 +6257,13 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
6233
6257
|
return true;
|
|
6234
6258
|
}
|
|
6235
6259
|
|
|
6236
|
-
|
|
6237
|
-
|
|
6260
|
+
// With the factory pattern, both channels may be connected simultaneously.
|
|
6261
|
+
// Determine which session is "active" based on whether PS channel is connected.
|
|
6262
|
+
const isPracticeSession = this.webinar?.isPracticeSessionLLMChannelConnected() ?? false;
|
|
6263
|
+
|
|
6238
6264
|
const expectedBinding = isPracticeSession
|
|
6239
|
-
?
|
|
6240
|
-
:
|
|
6265
|
+
? this.webinar?.getPracticeSessionBinding()
|
|
6266
|
+
: this.llmChannel?.getBinding();
|
|
6241
6267
|
|
|
6242
6268
|
if (!expectedBinding || route === expectedBinding) {
|
|
6243
6269
|
return true;
|
|
@@ -6258,9 +6284,10 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
6258
6284
|
}
|
|
6259
6285
|
switch (e.data.relayType) {
|
|
6260
6286
|
case REACTION_RELAY_TYPES.REACTION:
|
|
6287
|
+
// @ts-ignore - config coming from registerPlugin
|
|
6261
6288
|
if (
|
|
6262
6289
|
// @ts-ignore - config coming from registerPlugin
|
|
6263
|
-
|
|
6290
|
+
this.config.receiveReactions &&
|
|
6264
6291
|
this.isReactionsSupported()
|
|
6265
6292
|
) {
|
|
6266
6293
|
const member = this.members.membersCollection.get(e.data.sender.participantId);
|
|
@@ -6301,32 +6328,27 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
6301
6328
|
* @returns {void}
|
|
6302
6329
|
*/
|
|
6303
6330
|
stopTranscription() {
|
|
6304
|
-
|
|
6305
|
-
this.webex.internal.voicea.off(
|
|
6331
|
+
this.voiceaChannel?.off(
|
|
6306
6332
|
VOICEAEVENTS.VOICEA_ANNOUNCEMENT,
|
|
6307
6333
|
this.voiceaListenerCallbacks[VOICEAEVENTS.VOICEA_ANNOUNCEMENT]
|
|
6308
6334
|
);
|
|
6309
6335
|
|
|
6310
|
-
|
|
6311
|
-
this.webex.internal.voicea.off(
|
|
6336
|
+
this.voiceaChannel?.off(
|
|
6312
6337
|
VOICEAEVENTS.CAPTIONS_TURNED_ON,
|
|
6313
6338
|
this.voiceaListenerCallbacks[VOICEAEVENTS.CAPTIONS_TURNED_ON]
|
|
6314
6339
|
);
|
|
6315
6340
|
|
|
6316
|
-
|
|
6317
|
-
this.webex.internal.voicea.off(
|
|
6341
|
+
this.voiceaChannel?.off(
|
|
6318
6342
|
VOICEAEVENTS.EVA_COMMAND,
|
|
6319
6343
|
this.voiceaListenerCallbacks[VOICEAEVENTS.EVA_COMMAND]
|
|
6320
6344
|
);
|
|
6321
6345
|
|
|
6322
|
-
|
|
6323
|
-
this.webex.internal.voicea.off(
|
|
6346
|
+
this.voiceaChannel?.off(
|
|
6324
6347
|
VOICEAEVENTS.NEW_CAPTION,
|
|
6325
6348
|
this.voiceaListenerCallbacks[VOICEAEVENTS.NEW_CAPTION]
|
|
6326
6349
|
);
|
|
6327
6350
|
|
|
6328
|
-
|
|
6329
|
-
this.webex.internal.voicea.deregisterEvents();
|
|
6351
|
+
this.voiceaChannel?.deregisterEvents();
|
|
6330
6352
|
|
|
6331
6353
|
this.areVoiceaEventsSetup = false;
|
|
6332
6354
|
this.triggerStopReceivingTranscriptionEvent();
|
|
@@ -6359,16 +6381,13 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
6359
6381
|
*/
|
|
6360
6382
|
private restoreLLMSubscriptionsIfNeeded(): void {
|
|
6361
6383
|
try {
|
|
6362
|
-
const keepTranscriptionSubscribed =
|
|
6363
|
-
// @ts-ignore
|
|
6364
|
-
this.webex.internal.voicea?.getKeepTranscriptionSubscribed?.();
|
|
6384
|
+
const keepTranscriptionSubscribed = this.voiceaChannel?.getKeepTranscriptionSubscribed();
|
|
6365
6385
|
|
|
6366
6386
|
if (!keepTranscriptionSubscribed) {
|
|
6367
6387
|
return;
|
|
6368
6388
|
}
|
|
6369
6389
|
|
|
6370
|
-
|
|
6371
|
-
this.webex.internal.voicea.updateSubchannelSubscriptions({subscribe: ['transcription']});
|
|
6390
|
+
this.voiceaChannel?.updateSubchannelSubscriptions({subscribe: ['transcription']});
|
|
6372
6391
|
} catch (error) {
|
|
6373
6392
|
const msg = error?.message || String(error);
|
|
6374
6393
|
|
|
@@ -6619,10 +6638,6 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
6619
6638
|
this.saveDataChannelToken(join);
|
|
6620
6639
|
// @ts-ignore - config coming from registerPlugin
|
|
6621
6640
|
if (this.config.enableAutomaticLLM) {
|
|
6622
|
-
// @ts-ignore
|
|
6623
|
-
this.webex.internal.llm.off('online', this.handleLLMOnline);
|
|
6624
|
-
// @ts-ignore
|
|
6625
|
-
this.webex.internal.llm.on('online', this.handleLLMOnline);
|
|
6626
6641
|
this.updateLLMConnection({isInitialJoinPhase: true})
|
|
6627
6642
|
.catch((error) => {
|
|
6628
6643
|
LoggerProxy.logger.error(
|
|
@@ -6657,12 +6672,10 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
6657
6672
|
this.clearLLMHealthCheckTimer();
|
|
6658
6673
|
|
|
6659
6674
|
this.llmHealthCheckTimer = setTimeout(() => {
|
|
6660
|
-
|
|
6661
|
-
const isConnected = this.webex.internal.llm.isConnected();
|
|
6675
|
+
const isConnected = this.llmChannel?.isConnected() ?? false;
|
|
6662
6676
|
|
|
6663
6677
|
if (!isConnected) {
|
|
6664
|
-
|
|
6665
|
-
const {hasEverConnected} = this.webex.internal.llm;
|
|
6678
|
+
const hasEverConnected = this.llmChannel?.hasEverConnected ?? false;
|
|
6666
6679
|
|
|
6667
6680
|
// only send metric if not connected - to avoid too many metrics
|
|
6668
6681
|
Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.LLM_HEALTHCHECK_FAILURE, {
|
|
@@ -6697,10 +6710,11 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
6697
6710
|
* @returns {void}
|
|
6698
6711
|
*/
|
|
6699
6712
|
private stopListeningForLLMEvents() {
|
|
6700
|
-
|
|
6701
|
-
this.
|
|
6702
|
-
|
|
6703
|
-
this.
|
|
6713
|
+
this.llmChannel?.off('event:relay.event', this.processRelayEvent);
|
|
6714
|
+
this.llmChannel?.off(LOCUS_LLM_EVENT, this.processLocusLLMEvent);
|
|
6715
|
+
this.llmChannel?.off('online', this.handleLLMOnline);
|
|
6716
|
+
this.breakouts?.unregisterLLMChannel();
|
|
6717
|
+
// voiceaChannel persists across LLM reconnects; switchLLMChannel() handles re-subscribing
|
|
6704
6718
|
this.clearLLMHealthCheckTimer();
|
|
6705
6719
|
}
|
|
6706
6720
|
|
|
@@ -6723,59 +6737,52 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
6723
6737
|
private stopListeningForMeetingEvents() {
|
|
6724
6738
|
this.stopListeningForLLMEvents();
|
|
6725
6739
|
this.stopListeningForMercuryEvents();
|
|
6726
|
-
if (this.
|
|
6740
|
+
if (this.areVoiceaEventsSetup) {
|
|
6727
6741
|
this.stopTranscription();
|
|
6728
|
-
this.transcription = undefined;
|
|
6729
6742
|
}
|
|
6743
|
+
// Reset to initial shape instead of null - transcription is always a valid object
|
|
6744
|
+
this.transcription = this.getInitialTranscription();
|
|
6730
6745
|
this.annotation.deregisterEvents();
|
|
6731
6746
|
}
|
|
6732
6747
|
|
|
6733
6748
|
/**
|
|
6734
|
-
* Disconnects and cleans up the
|
|
6735
|
-
*
|
|
6736
|
-
* Ownership-aware: only calls `disconnectLLM` when this meeting is the
|
|
6737
|
-
* current owner of the default LLM session (or when no owner is recorded).
|
|
6738
|
-
* Event listeners belonging to this meeting instance are always detached
|
|
6739
|
-
* so they do not receive another meeting's relay events.
|
|
6749
|
+
* Disconnects and cleans up the LLM channel owned by this meeting.
|
|
6740
6750
|
*
|
|
6741
6751
|
* @param {Object} options
|
|
6742
|
-
* @param {boolean} [options.removeOnlineListener=true] removes the one-time online listener
|
|
6743
6752
|
* @param {boolean} [options.throwOnError=true] rethrows disconnect errors when true
|
|
6753
|
+
* @param {boolean} [options.preserveVoiceaChannel=false] when true, keeps voiceaChannel for switchLLMChannel() during reconnects
|
|
6744
6754
|
* @returns {Promise<void>}
|
|
6745
6755
|
*/
|
|
6746
6756
|
private cleanupLLMConneciton = async ({
|
|
6747
|
-
removeOnlineListener = true,
|
|
6748
6757
|
throwOnError = true,
|
|
6758
|
+
preserveVoiceaChannel = false,
|
|
6749
6759
|
}: {
|
|
6750
|
-
removeOnlineListener?: boolean;
|
|
6751
6760
|
throwOnError?: boolean;
|
|
6761
|
+
preserveVoiceaChannel?: boolean;
|
|
6752
6762
|
} = {}): Promise<void> => {
|
|
6753
|
-
//
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
|
|
6757
|
-
|
|
6758
|
-
|
|
6763
|
+
// Always clear the timer, even if there's no channel
|
|
6764
|
+
this.clearLLMHealthCheckTimer();
|
|
6765
|
+
|
|
6766
|
+
// Permanent cleanup must deregister voiceaChannel regardless of LLM presence.
|
|
6767
|
+
// When a transient reconnect fails (LLM registration error), llmChannel is undefined
|
|
6768
|
+
// but voiceaChannel may still exist with listeners attached to the old emitter.
|
|
6769
|
+
if (!preserveVoiceaChannel) {
|
|
6770
|
+
this.voiceaChannel?.deregisterEvents();
|
|
6771
|
+
this.voiceaChannel = undefined;
|
|
6772
|
+
}
|
|
6773
|
+
|
|
6774
|
+
if (!this.llmChannel) {
|
|
6775
|
+
return;
|
|
6776
|
+
}
|
|
6759
6777
|
|
|
6760
6778
|
try {
|
|
6761
|
-
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
|
|
6765
|
-
code: 3050,
|
|
6766
|
-
reason: 'done (permanent)',
|
|
6767
|
-
},
|
|
6768
|
-
LLM_DEFAULT_SESSION,
|
|
6769
|
-
this.id
|
|
6770
|
-
);
|
|
6771
|
-
} else {
|
|
6772
|
-
LoggerProxy.logger.info(
|
|
6773
|
-
`Meeting:index#cleanupLLMConneciton --> skipping disconnect; LLM owned by meeting ${currentOwner}, not ${this.id}`
|
|
6774
|
-
);
|
|
6775
|
-
}
|
|
6779
|
+
await this.llmChannel.disconnect({
|
|
6780
|
+
code: 3050,
|
|
6781
|
+
reason: 'done (permanent)',
|
|
6782
|
+
});
|
|
6776
6783
|
} catch (error) {
|
|
6777
6784
|
LoggerProxy.logger.error(
|
|
6778
|
-
'Meeting:index#cleanupLLMConneciton --> Failed to disconnect
|
|
6785
|
+
'Meeting:index#cleanupLLMConneciton --> Failed to disconnect LLM channel',
|
|
6779
6786
|
error
|
|
6780
6787
|
);
|
|
6781
6788
|
|
|
@@ -6783,42 +6790,25 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
6783
6790
|
throw error;
|
|
6784
6791
|
}
|
|
6785
6792
|
} finally {
|
|
6786
|
-
if (removeOnlineListener) {
|
|
6787
|
-
// @ts-ignore - Fix type
|
|
6788
|
-
this.webex.internal.llm.off('online', this.handleLLMOnline);
|
|
6789
|
-
}
|
|
6790
6793
|
this.stopListeningForLLMEvents();
|
|
6791
|
-
|
|
6792
|
-
// Re-check ownership after awaiting disconnectLLM. If ownership changed
|
|
6793
|
-
// while cleanup was in flight, do not clear another meeting's owner tag.
|
|
6794
|
-
if (isOwner) {
|
|
6795
|
-
const {currentOwner: currentOwnerAfterCleanup} =
|
|
6796
|
-
// @ts-ignore - Fix type
|
|
6797
|
-
this.webex.internal.llm.resolveSessionOwnership(this.id, LLM_DEFAULT_SESSION);
|
|
6798
|
-
|
|
6799
|
-
if (currentOwnerAfterCleanup === this.id) {
|
|
6800
|
-
// @ts-ignore - Fix type
|
|
6801
|
-
this.webex.internal.llm.setOwnerMeetingId?.(undefined);
|
|
6802
|
-
}
|
|
6803
|
-
}
|
|
6794
|
+
this.llmChannel = undefined;
|
|
6804
6795
|
}
|
|
6805
6796
|
};
|
|
6806
6797
|
|
|
6807
6798
|
/**
|
|
6808
|
-
*
|
|
6809
|
-
*
|
|
6799
|
+
* Sets the datachannel token on the meeting's LLM channel.
|
|
6800
|
+
* Used by the DataChannelAuthTokenInterceptor after refreshing tokens.
|
|
6801
|
+
* @param {string} token - The new datachannel token
|
|
6810
6802
|
* @returns {void}
|
|
6811
6803
|
*/
|
|
6812
|
-
|
|
6813
|
-
|
|
6814
|
-
this.webex.internal.llm.clearDatachannelToken(LLM_DEFAULT_SESSION, this.id);
|
|
6815
|
-
// @ts-ignore
|
|
6816
|
-
this.webex.internal.llm.clearDatachannelToken(LLM_PRACTICE_SESSION, this.id);
|
|
6804
|
+
setLLMChannelDataToken(token: string): void {
|
|
6805
|
+
this.llmChannel?.setDatachannelToken(token);
|
|
6817
6806
|
}
|
|
6818
6807
|
|
|
6819
6808
|
/**
|
|
6820
|
-
* Saves the data channel tokens from the join response
|
|
6821
|
-
*
|
|
6809
|
+
* Saves the data channel tokens from the join response.
|
|
6810
|
+
* Default session token is stored on this.llmChannel when available.
|
|
6811
|
+
* Practice session token is stored on the webinar's practice LLM channel.
|
|
6822
6812
|
* @param {Object} join - The parsed join response (from MeetingUtil.parseLocusJoin)
|
|
6823
6813
|
* @returns {void}
|
|
6824
6814
|
*/
|
|
@@ -6826,18 +6816,19 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
6826
6816
|
const datachannelToken = join?.locus?.self?.datachannelToken;
|
|
6827
6817
|
const practiceSessionDatachannelToken = join?.locus?.self?.practiceSessionDatachannelToken;
|
|
6828
6818
|
|
|
6819
|
+
// Store default session token on our LLM channel if it exists
|
|
6820
|
+
if (datachannelToken && this.llmChannel) {
|
|
6821
|
+
this.llmChannel.setDatachannelToken(datachannelToken);
|
|
6822
|
+
}
|
|
6823
|
+
|
|
6824
|
+
// Store the token temporarily for use when channel is created
|
|
6829
6825
|
if (datachannelToken) {
|
|
6830
|
-
|
|
6831
|
-
this.webex.internal.llm.setDatachannelToken(datachannelToken, LLM_DEFAULT_SESSION, this.id);
|
|
6826
|
+
this._pendingDatachannelToken = datachannelToken;
|
|
6832
6827
|
}
|
|
6833
6828
|
|
|
6829
|
+
// Practice session token is handled by webinar
|
|
6834
6830
|
if (practiceSessionDatachannelToken) {
|
|
6835
|
-
|
|
6836
|
-
this.webex.internal.llm.setDatachannelToken(
|
|
6837
|
-
practiceSessionDatachannelToken,
|
|
6838
|
-
LLM_PRACTICE_SESSION,
|
|
6839
|
-
this.id
|
|
6840
|
-
);
|
|
6831
|
+
this.webinar.setPracticeSessionDatachannelToken(practiceSessionDatachannelToken);
|
|
6841
6832
|
}
|
|
6842
6833
|
}
|
|
6843
6834
|
|
|
@@ -6848,11 +6839,8 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
6848
6839
|
*/
|
|
6849
6840
|
private async ensureDefaultDatachannelTokenAfterAdmit(): Promise<boolean> {
|
|
6850
6841
|
try {
|
|
6851
|
-
|
|
6852
|
-
|
|
6853
|
-
LLM_DEFAULT_SESSION,
|
|
6854
|
-
this.id
|
|
6855
|
-
);
|
|
6842
|
+
const datachannelToken =
|
|
6843
|
+
this.llmChannel?.getDatachannelToken() ?? this._pendingDatachannelToken;
|
|
6856
6844
|
// @ts-ignore
|
|
6857
6845
|
const isDataChannelTokenEnabled = await this.webex.internal.llm.isDataChannelTokenEnabled();
|
|
6858
6846
|
|
|
@@ -6871,12 +6859,12 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
6871
6859
|
return false;
|
|
6872
6860
|
}
|
|
6873
6861
|
|
|
6874
|
-
//
|
|
6875
|
-
this.
|
|
6876
|
-
fetchedDatachannelToken
|
|
6877
|
-
|
|
6878
|
-
this.
|
|
6879
|
-
|
|
6862
|
+
// Store on channel if exists, otherwise save as pending
|
|
6863
|
+
if (this.llmChannel) {
|
|
6864
|
+
this.llmChannel.setDatachannelToken(fetchedDatachannelToken);
|
|
6865
|
+
} else {
|
|
6866
|
+
this._pendingDatachannelToken = fetchedDatachannelToken;
|
|
6867
|
+
}
|
|
6880
6868
|
|
|
6881
6869
|
return true;
|
|
6882
6870
|
} catch (error) {
|
|
@@ -6903,139 +6891,104 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
6903
6891
|
const {url = undefined, info: {datachannelUrl = undefined} = {}} = this.locusInfo || {};
|
|
6904
6892
|
|
|
6905
6893
|
const isJoined = this.isJoined();
|
|
6906
|
-
|
|
6907
6894
|
const dataChannelUrl = datachannelUrl;
|
|
6908
6895
|
|
|
6909
|
-
//
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
// set yet (first claim).
|
|
6915
|
-
// @ts-ignore - Fix type
|
|
6916
|
-
const {currentOwner} = this.webex.internal.llm.resolveSessionOwnership(
|
|
6917
|
-
this.id,
|
|
6918
|
-
LLM_DEFAULT_SESSION
|
|
6919
|
-
);
|
|
6920
|
-
|
|
6921
|
-
// Capture connectivity before any reconnect attempt. If LLM was already
|
|
6922
|
-
// connected, we must respect current ownership. If it was disconnected,
|
|
6923
|
-
// this flow may reclaim stale owner tags after a fresh connect.
|
|
6924
|
-
// @ts-ignore - Fix type
|
|
6925
|
-
const wasConnected = this.webex.internal.llm.isConnected();
|
|
6926
|
-
|
|
6927
|
-
// Prefer ownership-scoped token read. For disconnected stale-owner reclaim
|
|
6928
|
-
// flows, fallback to ownerless read so initial register can still carry a
|
|
6929
|
-
// token and recover from stale ownership without 401/403 dead-end.
|
|
6930
|
-
// @ts-ignore - Fix type
|
|
6931
|
-
let datachannelToken = this.webex.internal.llm.getDatachannelToken(
|
|
6932
|
-
LLM_DEFAULT_SESSION,
|
|
6933
|
-
this.id
|
|
6934
|
-
);
|
|
6935
|
-
|
|
6936
|
-
if (!datachannelToken && !wasConnected && currentOwner && currentOwner !== this.id) {
|
|
6937
|
-
// @ts-ignore - Fix type
|
|
6938
|
-
datachannelToken = this.webex.internal.llm.getDatachannelToken(LLM_DEFAULT_SESSION);
|
|
6939
|
-
}
|
|
6940
|
-
|
|
6941
|
-
// @ts-ignore - Fix type
|
|
6942
|
-
if (wasConnected) {
|
|
6943
|
-
if (currentOwner && currentOwner !== this.id) {
|
|
6944
|
-
// Another meeting owns the live LLM socket. We must not disconnect
|
|
6945
|
-
// or reconfigure it -- doing so would tear down a session the
|
|
6946
|
-
// owning meeting still relies on. Locus/datachannel URL mismatch is
|
|
6947
|
-
// expected here (each meeting has its own locus URL) and is NOT a
|
|
6948
|
-
// valid signal of staleness, so we never reclaim from this path.
|
|
6949
|
-
// The only safe reclaim mechanism is the `finally`-block owner-tag
|
|
6950
|
-
// release in `cleanupLLMConneciton`, which fires when this meeting
|
|
6951
|
-
// itself is being torn down.
|
|
6952
|
-
LoggerProxy.logger.info(
|
|
6953
|
-
`Meeting:index#updateLLMConnection --> skipping; LLM owned by meeting ${currentOwner}, not ${this.id}`
|
|
6954
|
-
);
|
|
6896
|
+
// If we have an existing channel, check if we should reuse it or clean it up
|
|
6897
|
+
if (this.llmChannel) {
|
|
6898
|
+
const isSameUrls =
|
|
6899
|
+
url === this.llmChannel.getLocusUrl() &&
|
|
6900
|
+
dataChannelUrl === this.llmChannel.getDatachannelUrl();
|
|
6955
6901
|
|
|
6902
|
+
// If already connected to same URLs, skip reconnect
|
|
6903
|
+
if (this.llmChannel.isConnected() && isSameUrls && isJoined) {
|
|
6956
6904
|
return undefined;
|
|
6957
6905
|
}
|
|
6958
6906
|
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
url === this.webex.internal.llm.getLocusUrl() &&
|
|
6962
|
-
// @ts-ignore - Fix type
|
|
6963
|
-
dataChannelUrl === this.webex.internal.llm.getDatachannelUrl() &&
|
|
6964
|
-
isJoined
|
|
6965
|
-
) {
|
|
6907
|
+
// If currently connecting to same URLs, wait for that to complete
|
|
6908
|
+
if (this.llmChannel.isConnecting() && isSameUrls && isJoined) {
|
|
6966
6909
|
return undefined;
|
|
6967
6910
|
}
|
|
6968
|
-
|
|
6911
|
+
|
|
6912
|
+
// URLs changed or not joined, disconnect existing channel
|
|
6913
|
+
await this.cleanupLLMConneciton({preserveVoiceaChannel: true});
|
|
6969
6914
|
}
|
|
6970
6915
|
|
|
6971
6916
|
if (!isJoined) {
|
|
6972
6917
|
return undefined;
|
|
6973
6918
|
}
|
|
6974
6919
|
|
|
6975
|
-
//
|
|
6976
|
-
// refresh during register POST can resolve a valid handler.
|
|
6977
|
-
// Prefer this meeting as owner, but allow owner-less fallback when a stale
|
|
6978
|
-
// foreign owner tag is present on a disconnected session.
|
|
6979
|
-
const refreshHandlerOwnerMeetingId =
|
|
6980
|
-
currentOwner && currentOwner !== this.id ? undefined : this.id;
|
|
6981
|
-
const shouldAlignRefreshHandlerAfterOwnershipClaim = refreshHandlerOwnerMeetingId !== this.id;
|
|
6920
|
+
// Create a new LLM channel for this meeting
|
|
6982
6921
|
// @ts-ignore - Fix type
|
|
6983
|
-
this.webex.internal.llm.
|
|
6984
|
-
() => this.refreshDataChannelToken(),
|
|
6985
|
-
LLM_DEFAULT_SESSION,
|
|
6986
|
-
refreshHandlerOwnerMeetingId
|
|
6987
|
-
);
|
|
6922
|
+
this.llmChannel = this.webex.internal.llm.createChannel();
|
|
6988
6923
|
|
|
6989
|
-
//
|
|
6990
|
-
|
|
6924
|
+
// Get token from pending (saved from join response) or channel
|
|
6925
|
+
const datachannelToken = this._pendingDatachannelToken ?? this.llmChannel.getDatachannelToken();
|
|
6926
|
+
|
|
6927
|
+
// Set up refresh handler before registration so interceptor-triggered token
|
|
6928
|
+
// refresh during register POST can resolve a valid handler.
|
|
6929
|
+
this.llmChannel.setRefreshHandler(() => this.refreshDataChannelToken());
|
|
6930
|
+
|
|
6931
|
+
// If we have a pending token, store it on the channel
|
|
6932
|
+
if (this._pendingDatachannelToken) {
|
|
6933
|
+
this.llmChannel.setDatachannelToken(this._pendingDatachannelToken);
|
|
6934
|
+
this._pendingDatachannelToken = undefined;
|
|
6935
|
+
}
|
|
6936
|
+
|
|
6937
|
+
return this.llmChannel
|
|
6991
6938
|
.registerAndConnect(url, dataChannelUrl, datachannelToken)
|
|
6992
6939
|
.then((registerAndConnectResult) => {
|
|
6993
6940
|
this.locusInfo.syncAllHashTreeDatasets({onlyLLM: true});
|
|
6994
|
-
|
|
6995
|
-
//
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
);
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
//
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
// Record ownership of the default LLM session for this meeting so
|
|
7008
|
-
// subsequent cross-meeting `updateLLMConnection` / `cleanupLLMConneciton`
|
|
7009
|
-
// calls can detect and skip work that doesn't belong to them.
|
|
7010
|
-
// @ts-ignore - Fix type
|
|
7011
|
-
this.webex.internal.llm.setOwnerMeetingId?.(this.id);
|
|
7012
|
-
|
|
7013
|
-
// If we pre-bound refresh ownerlessly (stale-owner reclaim path),
|
|
7014
|
-
// align the handler with the newly claimed owner immediately after
|
|
7015
|
-
// ownership is updated.
|
|
7016
|
-
if (shouldAlignRefreshHandlerAfterOwnershipClaim) {
|
|
7017
|
-
// @ts-ignore - Fix type
|
|
7018
|
-
this.webex.internal.llm.setRefreshHandler(
|
|
7019
|
-
() => this.refreshDataChannelToken(),
|
|
7020
|
-
LLM_DEFAULT_SESSION,
|
|
7021
|
-
this.id
|
|
7022
|
-
);
|
|
7023
|
-
}
|
|
6941
|
+
|
|
6942
|
+
// Register event listeners on the channel
|
|
6943
|
+
this.llmChannel.off('event:relay.event', this.processRelayEvent);
|
|
6944
|
+
this.llmChannel.on('event:relay.event', this.processRelayEvent);
|
|
6945
|
+
this.llmChannel.off(LOCUS_LLM_EVENT, this.processLocusLLMEvent);
|
|
6946
|
+
this.llmChannel.on(LOCUS_LLM_EVENT, this.processLocusLLMEvent);
|
|
6947
|
+
this.llmChannel.off('online', this.handleLLMOnline);
|
|
6948
|
+
this.llmChannel.on('online', this.handleLLMOnline);
|
|
6949
|
+
|
|
6950
|
+
// Register annotation channel only if not in practice session
|
|
6951
|
+
// (practice session manages its own annotation channel via updatePSDataChannel)
|
|
6952
|
+
if (!this.webinar?.isJoinPracticeSessionDataChannel()) {
|
|
6953
|
+
this.annotation.registerChannel(this.llmChannel);
|
|
7024
6954
|
}
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
|
|
7029
|
-
// @ts-ignore - Fix type
|
|
7030
|
-
this.webex.internal.llm.off(LOCUS_LLM_EVENT, this.processLocusLLMEvent);
|
|
7031
|
-
// @ts-ignore - Fix type
|
|
7032
|
-
this.webex.internal.llm.on(LOCUS_LLM_EVENT, this.processLocusLLMEvent);
|
|
6955
|
+
|
|
6956
|
+
// Register breakouts channel
|
|
6957
|
+
this.breakouts.registerLLMChannel(this.llmChannel);
|
|
6958
|
+
|
|
7033
6959
|
LoggerProxy.logger.info(
|
|
7034
6960
|
'Meeting:index#updateLLMConnection --> enabled to receive relay events!'
|
|
7035
6961
|
);
|
|
7036
|
-
|
|
7037
6962
|
this.startLLMHealthCheckTimer();
|
|
7038
6963
|
|
|
6964
|
+
// Switch voiceaChannel to use the new LLM channel (preserves transcription state).
|
|
6965
|
+
// Skip if practice session is active - practice session manages its own voicea binding
|
|
6966
|
+
// via updatePSDataChannel, and switching here would break practice session captions.
|
|
6967
|
+
const isPracticeSessionActive =
|
|
6968
|
+
this.webinar?.isPracticeSessionLLMChannelConnected() ?? false;
|
|
6969
|
+
|
|
6970
|
+
if (!this.voiceaChannel) {
|
|
6971
|
+
// @ts-ignore - Fix type
|
|
6972
|
+
this.voiceaChannel = this.webex.internal.voicea.createChannel();
|
|
6973
|
+
}
|
|
6974
|
+
|
|
6975
|
+
if (!isPracticeSessionActive) {
|
|
6976
|
+
// Fire-and-forget: caption restoration shouldn't block LLM connection result.
|
|
6977
|
+
// transcription is always initialized (reset to initial shape, never null),
|
|
6978
|
+
// so no re-init needed here.
|
|
6979
|
+
this.voiceaChannel
|
|
6980
|
+
.switchLLMChannel(this.llmChannel)
|
|
6981
|
+
.then(() => {
|
|
6982
|
+
this.startTranscriptionIfNeeded();
|
|
6983
|
+
})
|
|
6984
|
+
.catch((error) => {
|
|
6985
|
+
LoggerProxy.logger.warn(
|
|
6986
|
+
'Meeting:index#updateLLMConnection --> failed to switch voicea channel:',
|
|
6987
|
+
error
|
|
6988
|
+
);
|
|
6989
|
+
});
|
|
6990
|
+
}
|
|
6991
|
+
|
|
7039
6992
|
if (registerAndConnectResult) {
|
|
7040
6993
|
if (isInitialJoinPhase) {
|
|
7041
6994
|
this.sendLLMConnectMetric(registerAndConnectResult);
|
|
@@ -7067,6 +7020,9 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
7067
7020
|
error,
|
|
7068
7021
|
});
|
|
7069
7022
|
|
|
7023
|
+
// Clean up the channel on failure
|
|
7024
|
+
this.llmChannel = undefined;
|
|
7025
|
+
|
|
7070
7026
|
return Promise.reject(error);
|
|
7071
7027
|
});
|
|
7072
7028
|
}
|
|
@@ -8232,6 +8188,10 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
8232
8188
|
);
|
|
8233
8189
|
}
|
|
8234
8190
|
|
|
8191
|
+
private isLocusUserFullError(error: Error | undefined): boolean {
|
|
8192
|
+
return (error as any)?.error?.body?.errorCode === LocusErrorCodes.LOCUS_USER_FULL;
|
|
8193
|
+
}
|
|
8194
|
+
|
|
8235
8195
|
/**
|
|
8236
8196
|
* Determines if the next media attempt should use only TURN-TLS (iceTransportPolicy='relay').
|
|
8237
8197
|
* We do this in the hope that it will minimize the chance of Homer sending DTLS packets on a wrong
|
|
@@ -10558,14 +10518,12 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
10558
10518
|
|
|
10559
10519
|
// Listener teardown (transcription, annotation, llm/mercury) runs in
|
|
10560
10520
|
// stopListeningForMeetingEvents() before /leave and /end so events
|
|
10561
|
-
// received mid-teardown do not trigger Locus syncs.
|
|
10562
|
-
//
|
|
10563
|
-
//
|
|
10564
|
-
//
|
|
10565
|
-
|
|
10566
|
-
this.
|
|
10567
|
-
|
|
10568
|
-
await this.cleanupLLMConneciton({throwOnError: false});
|
|
10521
|
+
// received mid-teardown do not trigger Locus syncs.
|
|
10522
|
+
// Token cleanup happens automatically when cleanupLLMConneciton destroys the channel.
|
|
10523
|
+
// A new voiceaChannel is created on the next join. In-session LLM reconnects and
|
|
10524
|
+
// practice-session transitions use their own cleanup paths and preserve the channel.
|
|
10525
|
+
|
|
10526
|
+
await this.cleanupLLMConneciton({throwOnError: false, preserveVoiceaChannel: false});
|
|
10569
10527
|
};
|
|
10570
10528
|
|
|
10571
10529
|
/**
|
|
@@ -11301,6 +11259,34 @@ export default class Meeting extends StatelessWebexPlugin {
|
|
|
11301
11259
|
}
|
|
11302
11260
|
}
|
|
11303
11261
|
|
|
11262
|
+
/**
|
|
11263
|
+
* Checks if the LLM channel is connected.
|
|
11264
|
+
* Handles practice session context automatically - returns practice session
|
|
11265
|
+
* LLM channel status when in practice session, main LLM channel status otherwise.
|
|
11266
|
+
* @returns {boolean} True if the appropriate LLM channel is connected
|
|
11267
|
+
*/
|
|
11268
|
+
public isLLMConnected(): boolean {
|
|
11269
|
+
if (this.webinar?.isJoinPracticeSessionDataChannel()) {
|
|
11270
|
+
return this.webinar.isPracticeSessionLLMChannelConnected();
|
|
11271
|
+
}
|
|
11272
|
+
|
|
11273
|
+
return this.llmChannel?.isConnected() ?? false;
|
|
11274
|
+
}
|
|
11275
|
+
|
|
11276
|
+
/**
|
|
11277
|
+
* Gets the locus URL from the LLM channel.
|
|
11278
|
+
* Handles practice session context automatically - returns practice session
|
|
11279
|
+
* LLM channel's locus URL when in practice session, main LLM channel's locus URL otherwise.
|
|
11280
|
+
* @returns {string | undefined} The locus URL or undefined
|
|
11281
|
+
*/
|
|
11282
|
+
public getLLMLocusUrl(): string | undefined {
|
|
11283
|
+
if (this.webinar?.isJoinPracticeSessionDataChannel()) {
|
|
11284
|
+
return this.webinar.getPracticeSessionLocusUrl();
|
|
11285
|
+
}
|
|
11286
|
+
|
|
11287
|
+
return this.llmChannel?.getLocusUrl();
|
|
11288
|
+
}
|
|
11289
|
+
|
|
11304
11290
|
/**
|
|
11305
11291
|
* Determines the current data channel token type based on the meeting state.
|
|
11306
11292
|
*
|